solidity_parser.ast.nodebase¶
Attributes¶
Classes¶
Built-in mutable sequence. |
|
A weak AST reference to another Node. This is needed when we want to associate a Node with another Node but don't |
|
Base class for all AST nodes. Includes source location information, code comments and a parenting mechanism so that |
Functions¶
|
AST node decorator to add an updatable and cachable element based hash to the dataclass |
Module Contents¶
- class solidity_parser.ast.nodebase.SourceLocation¶
Bases:
NamedTuple
- line: int¶
Line number, beginning at 1
- column: int¶
Column number, beginning at 1. E.g. the first character on the line is at column 1.
- class solidity_parser.ast.nodebase.SourceLocationSpan¶
Bases:
NamedTuple
- start: SourceLocation¶
- end: SourceLocation¶
- does_contain(loc: SourceLocation)¶
Checks whether the given ‘loc’ location is contained within this span. E.g. if this span represents ((5,1), (10, 1)), i.e lines 5 to 10 and loc is (6, 1), the location is contained :param loc: :return:
- solidity_parser.ast.nodebase.__REASON_CHILD__ = '__child__'¶
- solidity_parser.ast.nodebase.__FIELD_PARENT__ = 'parent'¶
- solidity_parser.ast.nodebase.__REASON_INIT__ = '__init__'¶
- solidity_parser.ast.nodebase.NodeDataclass(cls, *args, **kwargs)¶
AST node decorator to add an updatable and cachable element based hash to the dataclass
- solidity_parser.ast.nodebase.T¶
- class solidity_parser.ast.nodebase.NodeList(parent: T, seq=())¶
Bases:
list
[T
]Built-in mutable sequence.
If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.
- parent¶
- __str__()¶
Return str(self).
- __repr__()¶
Return repr(self).
- __setitem__(key, value)¶
Set self[key] to value.
- __delitem__(key)¶
Delete self[key].
- __setslice__(i, j, sequence)¶
- __eq__(other)¶
Return self==value.
- append(__object)¶
Append object to the end of the list.
- clear()¶
Remove all items from list.
- extend(__iterable)¶
Extend list by appending elements from the iterable.
- insert(__index, __object)¶
Insert object before index.
- pop(__index)¶
Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
- remove(__value)¶
Remove first occurrence of value.
Raises ValueError if the value is not present.
- reverse()¶
Reverse IN PLACE.
- sort(*args, **kwargs)¶
Sort the list in ascending order and return None.
The sort is in-place (i.e. the list itself is modified) and stable (i.e. the order of two equal elements is maintained).
If a key function is given, apply it once to each list item and sort them, ascending or descending, according to their function values.
The reverse flag can be set to sort in descending order.
- class solidity_parser.ast.nodebase.Ref¶
Bases:
Generic
[T
]A weak AST reference to another Node. This is needed when we want to associate a Node with another Node but don’t want it to be marked as a child of the other Node. This is useful if we want to create circular or back references to help the client use the AST more naturally, e.g. ResolvedUserTypes have a reference to the actual TopLevelUnit they reference.
- x: T¶
The item being referenced
- __repr__()¶
Return repr(self).
- class solidity_parser.ast.nodebase.Node¶
Base class for all AST nodes. Includes source location information, code comments and a parenting mechanism so that clients can traverse all child and parent nodes.
- id_location: str¶
LineNumber:LinePosition, this is set dynamically in common.make
- start_location: SourceLocation¶
Source start location of this node (column is inclusive)
- end_location: SourceLocation¶
Source end location of this node (column is exclusive)
- start_buffer_index: int¶
Source start (0-based) position in the input text buffer(inclusive)
- end_buffer_index: int¶
Source end (0-based) position in the input text buffer(exclusive)
- comments: list[str] | None¶
- __post_init__()¶
- get_source_span()¶
- linenumber() int ¶
- source_location()¶
- offset() int ¶
- _set_child_parents()¶
- __deepcopy__(memodict)¶
- abstract code_str()¶