Class SourceLocation

java.lang.Object
com.maroontress.clione.SourceLocation

public final class SourceLocation extends Object
The location of the source file.

Note that the SourceLocation instance is an immutable object.

  • Constructor Details

    • SourceLocation

      public SourceLocation(int line, int column)
      Creates a new instance.
      Parameters:
      line - The line number.
      column - The column number.
      Throws:
      IllegalArgumentException - If the line or column is less than or equal to zero.
  • Method Details

    • getLine

      public int getLine()
      Returns the line number.
      Returns:
      The line number.
    • getColumn

      public int getColumn()
      Returns the column number.
      Returns:
      The column number.
    • toString

      public String toString()
      Returns a new string representation of this location that is easy for a person to read.

      This method returns a string equal to the value of:

      Lnn:mm

      where mm and nn are positive integers, nn represents the line number, and mm represents the column number.

      Overrides:
      toString in class Object
      Returns:
      The new string representation of this token.