nada_dsl.source_ref

Source reference representation data structure.

class SourceRef(file: str, lineno: int, offset: int, length: int)[source]

Bases: object

Source reference representation, i.e., a specific location in the source code.

file: str
lineno: int
offset: int
length: int
classmethod back_frame() SourceRef[source]

Get the source reference of the calling frame.

static try_get_line_info(backend_frame, lineno) Tuple[int, int][source]

Try to get line information from the source code.

to_index() int[source]

Index Source Reference objects. Adds the current object into a dict as a key as well as an entry in an array, and returns an index to it

to_value()[source]

Convert the SourceRef object to a dictionary.

to_key()[source]

Convert the current object into the key representation used by ‘index_map’

static get_sources()[source]

Get all sources.

static get_refs()[source]

Get all refs.

__eq__(other)

Return self==value.