Token<T> class Null safety

A token represents a parsed part of the input stream.

The token holds the resulting value of the input, the input buffer, and the start and stop position in the input buffer. It provides many convenience methods to access the state of the token.

Annotations

Constructors

Token(T value, String buffer, int start, int stop)
Constructs a token from the parsed value, the input buffer, and the start and stop position in the input buffer.
const

Properties

buffer String
The parsed buffer of the token.
final
column int
The column number of this token (only works for String buffers).
read-only
hashCode int
The hash code for this object. [...]
read-only, override
input String
The consumed input of the token.
read-only
length int
The length of the token.
read-only
line int
The line number of the token (only works for String buffers).
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
start int
The start position of the token in the buffer.
final
stop int
The stop position of the token in the buffer.
final
value → T
The parsed value of the token.
final

Methods

map<R>(R mapper(T value)) Token<R>
Converts the value of the token.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
A string representation of this object. [...]
override

Operators

operator ==(Object other) bool
The equality operator. [...]
override

Static Methods

join<T>(Iterable<Token<T>> token) Token<List<T>>
Combines multiple token into a single token with the list of its values.
lineAndColumnOf(String buffer, int position) List<int>
Converts the position index in a buffer to a line and column tuple.
newlineParser() Parser
Returns a parser for that detects newlines platform independently.
positionString(String buffer, int position) String
Returns a human readable string representing the position index in a buffer.