module documentation

Python parse tree definitions. This is a very concrete parse tree; we need to keep every token and even the comments and whitespace between tokens. There's also a pattern matching implementation here.

Class Base Abstract base class for Node and Leaf.
Class BasePattern A pattern is a tree matching pattern.
Class Leaf Concrete implementation for leaf nodes.
Class LeafPattern No class docstring; 0/3 instance variable, 3/3 methods documented
Class NegatedPattern No class docstring; 0/1 instance variable, 1/4 method documented
Class Node Concrete implementation for interior nodes.
Class NodePattern No class docstring; 0/4 instance variable, 2/2 methods documented
Class WildcardPattern A wildcard pattern can match zero or more nodes.
Function convert Convert raw node information to a Node or Leaf instance.
Function generate_matches Generator yielding matches for a sequence of patterns and nodes.
Function type_repr Map a type number to its string representation.
Constant HUGE Undocumented
Variable _type_reprs Undocumented
def convert(gr, raw_node): (source)

Convert raw node information to a Node or Leaf instance. This is passed to the parser driver which calls it whenever a reduction of a grammar rule produces a new complete node, so that the tree is built strictly bottom-up.

def generate_matches(patterns, nodes): (source)

Generator yielding matches for a sequence of patterns and nodes. Args: patterns: a sequence of patterns nodes: a sequence of nodes Yields: (count, results) tuples where: count: the entire sequence of patterns matches nodes[:count]; results: dict containing named submatches.

def type_repr(type_num): (source)

Map a type number to its string representation.

Undocumented

Value
2147483647
_type_reprs: dict = (source)

Undocumented