Class GenericNumberState

  • All Implemented Interfaces:
    INumberState, ITokenizerState
    Direct Known Subclasses:
    ExpressionNumberState

    public class GenericNumberState
    extends Object
    implements INumberState
    A NumberState object returns a number from a scanner. This state's idea of a number allows an optional, initial minus sign, followed by one or more digits. A decimal point and another string of digits may follow these digits.
    • Constructor Detail

      • GenericNumberState

        public GenericNumberState()
    • Method Detail

      • nextToken

        public Token nextToken​(IScanner scanner,
                               ITokenizer tokenizer)
                        throws Exception
        Gets the next token from the stream started from the character linked to this state.
        Specified by:
        nextToken in interface ITokenizerState
        Parameters:
        scanner - A textual string to be tokenized.
        tokenizer - A tokenizer class that controls the process.
        Returns:
        The next token from the top of the stream.
        Throws:
        Exception