text property

  1. @override
String? text
override

Get the text of the token.

Implementation

@override
String? get text {
  if (_text != null) {
    return _text;
  }

  final input = inputStream;
  if (input == null) return null;
  final n = input.size;

  if (startIndex < n && stopIndex < n) {
    return input.getText(Interval.of(startIndex, stopIndex));
  } else {
    return '<EOF>';
  }
}
  1. @override
void text=(String? text)
override

Explicitly set the text for this token. If {code text} is not null, then {@link #getText} will return this value rather than extracting the text from the input.

@param text The explicit text of the token, or null if the text should be obtained from the input along with the start and stop indexes of the token.

Implementation

@override
set text(String? text) {
  _text = text;
}