TokenStream.getText

Return the text of all tokens in the source interval of the specified context. This method behaves like the following code, including potential exceptions from the call to {@link #getText(Interval)}, but may be optimized by the specific implementation.

<p>If {@code ctx.getSourceInterval()} does not return a valid interval of tokens provided by this stream, the behavior is unspecified.</p>

<pre> TokenStream stream = ...; String text = stream.getText(ctx.getSourceInterval()); </pre>

@param ctx The context providing the source interval of tokens to get text for. @return The text of all tokens within the source interval of {@code ctx}.

  1. Variant getText(Interval interval)
  2. Variant getText()
  3. Variant getText(RuleContext ctx)
    interface TokenStream
    Variant
    getText
  4. Variant getText(Token start, Token stop)

Meta