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. string getText(Interval interval)
  2. string getText()
  3. string getText(RuleContext ctx)
    interface TokenStream
    string
    getText
  4. string getText(Token start, Token stop)

Meta