class documentation

Line-based source code access. Attributes: text: The source text. traces: A dictionary from line number to traces. filename: The filename - when using traces.trace(), this value is meaningful only if an options object containing the filename was provided.

Method __init__ Initializer.
Method display_traces Prints the source file with traces for debugging.
Method find_first_text Gets first location, if any, the string appears at in the line range.
Method get_attr_location Returns the location and span of the attribute in an attribute access.
Method get_closest_line_range Gets all valid line numbers in the [start, end) line range.
Method get_offset Gets the utf-8 byte offset of a source.Location from start of source.
Method line Gets the text at a line number.
Method next_non_comment_line Gets the next non-comment line, if any, after the given line.
Instance Variable filename Undocumented
Instance Variable text Undocumented
Instance Variable traces Undocumented
Method _get_multiline_location Gets the start location of text anywhere within n_lines of location.
Method _init_byte_offsets Undocumented
Instance Variable _lines Undocumented
Instance Variable _offsets Undocumented
def __init__(self, src, raw_traces, trace_factory, filename): (source)

Initializer. Args: src: The source text. raw_traces: Raw (opcode, symbol, types) values. trace_factory: A subclass of source.AbstractTrace that will be used to instantiate traces from raw values. filename: The filename.

def display_traces(self): (source)

Prints the source file with traces for debugging.

def find_first_text(self, start, end, text): (source)

Gets first location, if any, the string appears at in the line range.

def get_attr_location(self, name, location): (source)

Returns the location and span of the attribute in an attribute access. Args: name: The attribute name. location: The location of the value the attribute is accessed on.

def get_closest_line_range(self, start, end): (source)

Gets all valid line numbers in the [start, end) line range.

def get_offset(self, location): (source)

Gets the utf-8 byte offset of a source.Location from start of source.

def line(self, n): (source)

Gets the text at a line number.

def next_non_comment_line(self, line): (source)

Gets the next non-comment line, if any, after the given line.

filename = (source)

Undocumented

Undocumented

Undocumented

def _get_multiline_location(self, location, n_lines, text): (source)

Gets the start location of text anywhere within n_lines of location.

def _init_byte_offsets(self): (source)

Undocumented

Undocumented

_offsets: list = (source)

Undocumented