Package eu.bandm.tools.xantlr.runtime
Class HistoryToken
java.lang.Object
antlr.Token
antlr.CommonToken
antlr.CommonHiddenStreamToken
eu.bandm.tools.xantlr.runtime.HistoryToken
- All Implemented Interfaces:
Cloneable
public class HistoryToken
extends antlr.CommonHiddenStreamToken
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
Attention : Whenever applying a Filter to a token stream of HistoryTokens, it must be derived from
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.-
Field Summary
Fields inherited from class antlr.CommonHiddenStreamToken
hiddenAfter, hiddenBeforeFields inherited from class antlr.CommonToken
col, line, textFields inherited from class antlr.Token
badToken, EOF_TYPE, INVALID_TYPE, MIN_USER_TYPE, NULL_TREE_LOOKAHEAD, SKIP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic antlr.TokenStreamchain(antlr.CharScanner in) final intfinal Stringfinal intvoidsetFilename(String filename) voidsetLastToken(int line, int column) voidsetLastToken(String filename, int line, int column) Methods inherited from class antlr.CommonHiddenStreamToken
getHiddenAfter, getHiddenBefore, setHiddenAfter, setHiddenBeforeMethods inherited from class antlr.CommonToken
getColumn, getLine, getText, setColumn, setLine, setText, toStringMethods inherited from class antlr.Token
getType, setType
-
Constructor Details
-
HistoryToken
public HistoryToken() -
HistoryToken
-
-
Method Details
-
setFilename
- Overrides:
setFilenamein classantlr.Token
-
getFilename
- Overrides:
getFilenamein classantlr.Token
-
setLastToken
public void setLastToken(int line, int column) -
setLastToken
-
getLastTokenFilename
-
getLastTokenLine
public final int getLastTokenLine() -
getLastTokenColumn
public final int getLastTokenColumn() -
chain
public static antlr.TokenStream chain(antlr.CharScanner in)
-