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 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, hiddenBefore

    Fields inherited from class antlr.CommonToken

    col, line, text

    Fields inherited from class antlr.Token

    badToken, EOF_TYPE, INVALID_TYPE, MIN_USER_TYPE, NULL_TREE_LOOKAHEAD, SKIP
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    HistoryToken(int type, String text)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static antlr.TokenStream
    chain(antlr.CharScanner in)
     
     
    final int
     
    final String
     
    final int
     
    void
    setFilename(String filename)
     
    void
    setLastToken(int line, int column)
     
    void
    setLastToken(String filename, int line, int column)
     

    Methods inherited from class antlr.CommonHiddenStreamToken

    getHiddenAfter, getHiddenBefore, setHiddenAfter, setHiddenBefore

    Methods inherited from class antlr.CommonToken

    getColumn, getLine, getText, setColumn, setLine, setText, toString

    Methods inherited from class antlr.Token

    getType, setType

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • HistoryToken

      public HistoryToken()
    • HistoryToken

      public HistoryToken(int type, String text)
  • Method Details

    • setFilename

      public void setFilename(String filename)
      Overrides:
      setFilename in class antlr.Token
    • getFilename

      public String getFilename()
      Overrides:
      getFilename in class antlr.Token
    • setLastToken

      public void setLastToken(int line, int column)
    • setLastToken

      public void setLastToken(String filename, int line, int column)
    • getLastTokenFilename

      public final String getLastTokenFilename()
    • getLastTokenLine

      public final int getLastTokenLine()
    • getLastTokenColumn

      public final int getLastTokenColumn()
    • chain

      public static antlr.TokenStream chain(antlr.CharScanner in)