Class StringAndPos

java.lang.Object
org.apache.calcite.sql.parser.StringAndPos

public class StringAndPos extends Object
Contains a string, the offset of a token within the string, and a parser position containing the beginning and end line number.
  • Field Details

    • sql

      public final String sql
    • cursor

      public final int cursor
    • pos

      public final @Nullable SqlParserPos pos
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • of

      public static StringAndPos of(String sql)
      Looks for one or two carets in a SQL string, and if present, converts them into a parser position.

      Examples:

      • of("xxx^yyy") yields {"xxxyyy", position 3, line 1 column 4}
      • of("xxxyyy") yields {"xxxyyy", null}
      • of("xxx^yy^y") yields {"xxxyyy", position 3, line 4 column 4 through line 1 column 6}
    • addCarets

      public String addCarets()