TokenReader mixin
Mixin for handling a token list.
- Mixin applications
Properties
- column ↔ int
-
getter/setter pair
- currrentFileName ↔ String?
-
The file current under processing, used in error message.
getter/setter pair
- curTok ↔ Token
-
Get current token.
getter/setter pair
- endOfFile ↔ Token
-
getter/setter pair
-
errors
↔ List<
HTError> -
getter/setter pair
- firstTok ↔ Token
-
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- line ↔ int
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
advance(
[int distance = 1]) → Token -
Advance till reach
distance, return the token at original position. -
expect(
List< String> lexemes, {bool consume = false}) → bool -
Check current token and some tokens after it to see if the types match,
return a boolean result.
If
consumeis true, will advance. -
match(
String lexeme) → Token -
If the token lexeme the
lexemeprovided, advance 1 and return the original token. If not, generate an error. -
match2(
Set< String> lexemes) → Token - same with match, with plural types provided.
-
matchId(
) → TokenIdentifier - If the current token is an identifier, advance 1 and return the original token. If not, generate an error.
-
matchString(
) → TokenStringLiteral - If the current token is an identifier, advance 1 and return the original token. If not, generate an error. Note this only accept string literal but not string interpolation.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
peek(
int distance) → Token -
Get a token at a relative
distancefrom current position. -
seek(
String type) → Token - Search for a token type, return the token next to it.
-
seekGroupClosing(
Map< String, String> groupClosings) → Token - Search for parentheses end that can close the current one, return the token next to it.
-
setTokens(
{required Token token, int? line, int? column}) → void - Set current tokens.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited