A runtime class for
xantlr. generated lexers and parsers,
which carries over information from the last consumed token.
A Lexer generated by xantlr provides the END point of each recognized token.
In the context of event generation as done by any xantlr generated parsers,
location information has to be constructed, which needs the
end position of the
last, not the current, token.
To provide an access to this data, the objects of this class
are tokens which duplicate some positional information of their predecessor in the
token stream.
E.g., whenever a
X_LLkParser
is used, it has to be linked to a lexer
by
new MyParser(HistoryToken.chain(MyLexer))
.
Attention :
Whenever applying a
Filter to a token stream of
HistoryTokens, it must be derived from
HistoryTokenFilter
, for
additionally copying this information across the tokens discarded.