Token<T> 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.

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
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
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

toString() String
Returns a string representation of this object.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited

Operators

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

Static Methods

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.