class documentation
class Code: (source)
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 |
Prints the source file with traces for debugging. |
Method | find |
Gets first location, if any, the string appears at in the line range. |
Method | get |
Returns the location and span of the attribute in an attribute access. |
Method | get |
Gets all valid line numbers in the [start, end) line range. |
Method | get |
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 |
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 |
Gets the start location of text anywhere within n_lines of location. |
Method | _init |
Undocumented |
Instance Variable | _lines |
Undocumented |
Instance Variable | _offsets |
Undocumented |
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.
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.