Location

An important aspect of configuration parsers is to locate the place where a value was defined, or where an error occurred. For this reason, every value contains a location instance, that points to the place where the value was defined.

Interface

class Location(source_identifier: ~erbsland.conf.source.SourceIdentifier, position: ~erbsland.conf.location.Position = <factory>)

Represent the location of an element in a document.

to_text(*, compact=False) str

Return a user-friendly representation of the location.

Parameters:

compact – If True, return a compact representation.

with_offset(offset: int) Location

Return a new Location shifted by offset columns.

class Position(line: int = -1, column: int = -1, character_index: int = -1)

Represent a position in a document.

line: int

The line number or -1 if undefined.

column: int

The column number or -1 if undefined.

character_index: int

The character index or -1 if undefined.

is_undefined() bool

Return True if the position is not defined.

with_offset(offset: int) Position

Return a new Position shifted by offset columns.