Class Tokenizer


  • public class Tokenizer
    extends Object
    A tokenizer can read tokens from text input. It is used by the ExpressionParser. A token is an atomic element of an expression.

    After construction, you can read tokens with readToken(). If you construct the tokenizer with a LineColumnNumberReader, then you can rewind the input after each call of readToken(), regardless of whether it returns a token or null or a parse error. Rewinding can be useful if the tokens are embedded inside other text input.

    • Method Detail

      • getReader

        public LineColumnNumberReader getReader()
        Returns the reader used by this tokenizer.
        Returns:
        the reader
      • close

        public void close()
                   throws IOException
        Closes the tokenizer and the input reader.
        Throws:
        IOException - if the reader can't be closed
      • getLineNum

        public int getLineNum()
        Returns the current line number.
        Returns:
        the current line number
      • getColNum

        public int getColNum()
        Returns the current column number.
        Returns:
        the current column number