Class PositionInfo

java.lang.Object
org.apache.groovy.parser.antlr4.PositionInfo

public class PositionInfo extends Object
Line and column attached to a parser syntax error. toString() renders @ line N, column M, or an empty string when either coordinate is -1.
  • Constructor Details

    • PositionInfo

      public PositionInfo(int line, int column)
      Stores a source location. Coordinates are the caret position used by the syntax error, including any offset the caller already applied.
      Parameters:
      line - 1-based line, or -1 when the location is omitted
      column - 1-based column, or -1 when the location is omitted
  • Method Details

    • getLine

      public int getLine()
      Returns the stored line.
      Returns:
      the 1-based line, or -1 when omitted
    • setLine

      public void setLine(int line)
      Replaces the stored line.
      Parameters:
      line - 1-based line, or -1 to omit the location
    • getColumn

      public int getColumn()
      Returns the stored column.
      Returns:
      the 1-based column, or -1 when omitted
    • setColumn

      public void setColumn(int column)
      Replaces the stored column.
      Parameters:
      column - 1-based column, or -1 to omit the location
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object