GenericNumberState

A NumberState object that returns a number from a scanner.

Implements: INumberState

Description

The GenericNumberState class allows you to create a NumberState object that returns a number from a scanner.

Important points

  • 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.

Fields

DOT

Represents a dot (.) character.

DOT: int = ord('.')

MINUS

Represents a minus (-) character.

MINUS: int = ord('-')

Instance methods

next_token

Gets the next token from the stream started from the character linked to this state.

next_token(scanner: IScanner, tokenizer: ITokenizer): Token

  • scanner: IScanner - text string to be tokenized.
  • tokenizer: ITokenizer - tokenizer class that controls the process.
  • returns: Token - next token from the top of the stream.