getText abstract method

String getText([
  1. Interval interval
])

Return the text of all tokens within the specified interval. This method behaves like the following code (including potential exceptions for violating preconditions of {@link #get}, but may be optimized by the specific implementation.

TokenStream stream = ...;
String text = "";
for (int i = interval.a; i <= interval.b; i++) {
  text += stream.get(i).getText();
}
TokenStream stream = ...;
String text = stream.getText(new Interval(0, stream.length));
TokenStream stream = ...;
String text = stream.getText(ctx.getSourceInterval());

@param interval The interval of tokens within this stream to get text for. @return The text of all tokens / within the specified interval in this stream.

Implementation

String getText([Interval interval]);