CommonTokenFactory class

This default implementation of TokenFactory creates CommonToken objects.

Implemented types

Constructors

CommonTokenFactory([bool copyText = false])
Constructs a CommonTokenFactory with the specified value for {@link #copyText}.

Properties

copyText bool
Indicates whether {@link CommonToken#setText} should be called after constructing tokens to explicitly set the text. This is useful for cases where the input stream might not be able to provide arbitrary substrings of text from the input after the lexer creates a token (e.g. the implementation of {@link CharStream#getText} in UnbufferedCharStream throws an UnsupportedOperationException). Explicitly setting the token text allows {@link Token#getText} to be called at any time regardless of the input stream implementation.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

create(int type, String? text, Pair<TokenSource?, CharStream?>? source, int channel, int start, int stop, int? line, int charPositionInLine) CommonToken
This is the method used to create tokens in the lexer and in the error handling strategy. If text!=null, than the start and stop positions are wiped to -1 in the text override is set in the CommonToken.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

DEFAULT TokenFactory<CommonToken>
The default CommonTokenFactory instance.
final