This represents a location in the source.

Attributes
Read

A Source object that is used to determine more information from the given offset and length.

The byte offset from the beginning of the source where this location starts.

Read

The length of this location in bytes.

Class Methods

Create a new location object with the given source, start byte offset, and byte length.

Instance Methods

Returns true if the given other location is equal to this location.

Join this location with the first occurrence of the string in the source that occurs after this location on the same line, and return the new location. This will raise an error if the string does not exist.

Returns a new location that is the result of chopping off the last byte.

Returns all comments that are associated with this location (both leading and trailing comments).

Create a new location object with the given options.

Implement the hash pattern matching interface for Location.

The column number in characters where this location ends from the start of the line.

The character offset from the beginning of the source where this location ends.

The column number in code units of the given encoding where this location ends from the start of the line.

The offset from the start of the file in code units of the given encoding.

The column number in bytes where this location ends from the start of the line.

The line number where this location ends.

The byte offset from the beginning of the source where this location ends.

Returns a string representation of this location.

Returns a new location that stretches from this location to the given other location. Raises an error if this location is not before the other location or if they don’t share the same source.

Attach a comment to the leading comments of this location.

These are the comments that are associated with this location that exist before the start of this location.

Implement the pretty print interface for Location.

The source code that this location represents.

The source code that this location represents starting from the beginning of the line that this location starts on to the end of the line that this location ends on.

Returns all of the lines of the source code associated with this location.

The column number in characters where this location ends from the start of the line.

The character offset from the beginning of the source where this location starts.

The column number in code units of the given encoding where this location starts from the start of the line.

The offset from the start of the file in code units of the given encoding.

The column number in bytes where this location starts from the start of the line.

The line number where this location starts.

The content of the line where this location starts before this location.

Attach a comment to the trailing comments of this location.

These are the comments that are associated with this location that exist after the end of this location.