Collection of data structures and functions for working with exact addresses in (syntax) text files.
typing
rangetypes0
Address0
A Line Number and Column address used to identify a position in a syntax file. Line numbers and columns are 1-based. There is no Line Zero and no column zero with exception to Addresses used in fault.range.types.IRange instances.
Address values must be constructed with one special condition: if the address is being used in a range where the last character of the line is being selected as the stop in the range, the instance must be created to refer to the following line and the zero-column. This special case is used to allow inclusive ranges to properly detect continuity.
Address__slots__0
__slots__ = ()
@classmethod
Addressfrom_string0
from_string(Class, source)
Address__str__0
__str__(self)
Address__add__0
__add__(self, x)
Address__sub__0
__sub__(self, x)
Address__mul__10%
__mul__(self, x)
Address__div__10%
__div__(self, x)
Address__rshift__10%
__rshift__(self, x)
Address__lshift__10%
__lshift__(self, x)
Addressline40%
The line number identified by the address.
When the column number is zero, the internal value is adjusted under the presumption that the address was referring to the end of the previos line.
Addresscolumn30%
The column number identified by the address. None if the address is referring to the end of the line.
Addressnormalize_stop0
normalize_stop(line_length, line_number, column_number)
Adjust a stop Address' pointers for use in an Area so that it can be recognized as reference to the final character in a line.
If the given address points to the final position in the line, the line number will be incremented and its column set to zero. This allows fault.range.types.Set to detect continuity when working with Area instances.
Addressimaginary233%bool
Whether the address refers to an imaginary location. An imaginary line is identified using 0 as addresses use 1 based indexes.
Often, imaginary locations can be considered invalid by a given context, but when employed by AST nodes or stack traces, line zero can be used to refer to injected nodes that do not exist in the original Syntax Document. The column index of imaginary lines should be used to refer to meta data about the injection.
Area0
Inclsuive Range of Address instances. Usable with fault.range.types.Set and fault.range.types.Mapping instances.
Area__slots__0
__slots__ = ()
AreaType0
Type = Address
@property
Areavertical175%
Whether the Area refers to a purely vertically area of the syntax without constraints on the columns.
Zero-column references must be used to identify an Area as purely vertical.
Areahorizontal0
Whether the area refers a purely horizontal area of the syntax within a single line.
Zero-column references to the end of the line are not permitted to be used for pure horizontal Areas. The inherited limitation being that some continuity realizations requires additional contextual knowledge (line length).
Areadelineate0
delineate(Class, lstart, cstart, lstop, cstop, stop_line_length)
Construct an Area from the given indexes normalizing the stop address.
Area__str__340%
__str__(self)
Areafrom_string150%
from_string(Class, string)
Construct an Area from the given string.
Areafrom_line_range20%
from_line_range(Class, pair)
Construct an Area from the inclusive line indexes in pair. The returned instance guarantees vertical.
AreaSlice0
Slice = typing.Tuple[typing.Text, typing.Text, typing.Sequence[typing.Text]]
Areaselect0Slice
select(self, lines)
Retrieve the prefix, suffix, and selected lines that are delieanted by the Area, self.