GenericWordState class

A wordState returns a word from a scanner. Like other states, a tokenizer transfers the job of reading to this state, depending on an initial character. Thus, the tokenizer decides which characters may begin a word, and this state determines which characters may appear as a second or later character in a word. These are typically different sets of characters; in particular, it is typical for digits to appear as parts of a word, but not as the initial character of a word.

By default, the following characters may appear in a word. The method setWordChars allows customizing this.

.. list-table:: :header-rows: 1 :widths: 10, 10

* - From
  - To

* - 'a'
  - 'z'
* - 'A'
  - 'Z'
* - '0'
  - '9'

as well as: minus sign, underscore, and apostrophe.

Implemented types
Implementers

Constructors

GenericWordState()
Constructs a word state with a default idea of what characters are admissible inside a word (as described in the class comment).

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clearWordChars() → void
Clears definitions of word chars.
override
nextToken(IScanner scanner, ITokenizer? tokenizer) Token?
Ignore word (such as blanks and tabs), and return the tokenizer's next token.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setWordChars(int fromSymbol, int toSymbol, bool enable) → void
Establish characters in the given range as valid characters for part of a word after the first character.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited