Module ast

Source
Expand description

Data information to build the AST And some functions to work with AST

Modules§

flat
Data information to build the Flat AST And some functions to work with it

Structs§

Error
Context information about an error manipulanting the ast You will have an String with the description, and the node wich produced the error It will have the error description and the string of node info

Enums§

Node
Information of a node

Functions§

check_empty_nodes
Consume a node if it’s a Rule kind with a specific value and return the rest of nodes and the sub_nodes for the consumed node
consume_node_get_subnodes_for_rule_name_is
Consume a node if it’s a Rule kind with a specific value and return the rest of nodes and the sub_nodes for the consumed node
consume_this_value
Consume a node if it’s a Val kind and the vaule is equal to the provider one
consume_val
Given a slice of nodes, return the value (&str) of first node if it is a Node::Rule and return the rest of nodes
error
Helper to create an ast::Error
get_node_val
Get the value of the Node If node is not a Node::Val, it will return an error
get_nodename_and_nodes
It will get the node name and a slice to the nodes contained by the node
get_nodes_unique_val
Sometimes, processing the ast, you will exptect to have an unique child, and it will have to be a simple Node::Val This function will return the val, or error in other case
peek_first_node
Return a reference to first node
split_first_nodes
Given a list of nodes, return the first and the rest on a tuple