Interface LexicalAnalyzer


  • public interface LexicalAnalyzer
    Lexical analyzer.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Token getToken()
      Get next token.
      void reset​(java.io.Reader reader, int line, int offset, int column)
      Resets lexer.
      void reset​(java.io.Reader reader, int line, int offset, int column, int lexerState)
      Resets lexer.
    • Method Detail

      • reset

        void reset​(java.io.Reader reader,
                   int line,
                   int offset,
                   int column)
        Resets lexer.

        Internal counters (actual position, actual column, row, etc.) should be cleared. Lexical analyzer should prepare itself to start parsing from the beginning of the document.

        Parameters:
        reader - Source code reader
        line - from this line should lexical analyzer start, usually 0
        offset - from this char should lexical analyzer start, usually 0
        column - from this column should lexical analyzer start, usually 0
      • reset

        void reset​(java.io.Reader reader,
                   int line,
                   int offset,
                   int column,
                   int lexerState)
        Resets lexer.
        Parameters:
        reader - Source code reader
        line - from this line should lexical analyzer start, usually 0
        offset - from this char should lexical analyzer start, usually 0
        column - from this column should lexical analyzer start, usually 0
        lexerState - lexer state
      • getToken

        Token getToken()
                throws java.io.IOException
        Get next token.

        Tokens are retrieved as in "iterator" style - the actual position is a mutable state stored in the lexer.

        Returns:
        next token
        Throws:
        java.io.IOException - is thrown when the token could not be read