Class Location


  • public class Location
    extends java.lang.Object
    Identifies the range of a code block inside a file or a string. Note that, unlike antlr4 tokens, the line positions start from 0 (to be compatible with Studio).

    Both start and end line/column indices are inclusive.

    • Field Detail

      • startLine

        public int startLine
      • startOffset

        public int startOffset
      • endLine

        public int endLine
      • endOffset

        public int endOffset
      • parentLocation

        public Location parentLocation
    • Constructor Detail

      • Location

        public Location()
      • Location

        public Location​(Location other)
      • Location

        public Location​(org.antlr.v4.runtime.Token start,
                        org.antlr.v4.runtime.Token end)
      • Location

        public Location​(org.antlr.v4.runtime.ParserRuleContext context)
      • Location

        public Location​(int startLine,
                        int startOffset,
                        int endLine,
                        int endOffset)
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • setParentLocation

        public void setParentLocation​(Location parentLocation)
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • isValid

        public boolean isValid()
      • contains

        public boolean contains​(Location other)
      • toAbsoluteLocation

        public Location toAbsoluteLocation()
      • toUserReadableString

        public java.lang.String toUserReadableString()
      • fromUserReadableString

        public static Location fromUserReadableString​(java.lang.String str)