Class SourceText

java.lang.Object
org.ek9lang.compiler.support.SourceText

public final class SourceText extends Object
THE source of a parse rule as the developer wrote it: the characters it spans in the char stream, spaces kept. Use it wherever source text is shown to a person or embedded in a message - ctx.getText() joins the tokens with nothing between them, so name? and age? becomes name?andage?. Falls back to getText() only when the char stream is unavailable.
  • Method Details

    • of

      public static String of(org.antlr.v4.runtime.ParserRuleContext ctx)
      The characters ctx spans, as written.
    • onOneLine

      public static String onOneLine(org.antlr.v4.runtime.ParserRuleContext ctx)
      As of(ParserRuleContext), on one line: every run of whitespace, line breaks and indentation included, is one space.