Token<R> class

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
  • @immutable

Constructors

Token(R 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.
no setter
hashCode int
The hash code for this object.
no setteroverride
input String
The consumed input of the token.
no setter
length int
The length of the token.
no setter
line int
The line number of the token.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
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 → R
The parsed value of the token.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent 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<String>
Returns a parser that detects newlines platform independently.
positionString(String buffer, int position) String
Returns a human readable string representing the position index in a buffer.