pub struct NodesAggregator { /* private fields */ }
Expand description
A tool to aggregate/gather nodes in various forms and eventually emit them as a vector.
Implementations§
source§impl NodesAggregator
impl NodesAggregator
sourcepub fn add_struct(self, builder: StructBuilder) -> Self
pub fn add_struct(self, builder: StructBuilder) -> Self
Adds a struct node.
sourcepub fn add_enum(self, builder: EnumBuilder) -> Self
pub fn add_enum(self, builder: EnumBuilder) -> Self
Adds an enum node.
sourcepub fn add_list(self, name: &str, element_type: &str) -> Self
pub fn add_list(self, name: &str, element_type: &str) -> Self
Adds a node for a list of syntax elements.
sourcepub fn add_separated_list(
self,
name: &str,
element_type: &str,
separator_type: &str,
) -> Self
pub fn add_separated_list( self, name: &str, element_type: &str, separator_type: &str, ) -> Self
Adds a node for a list of syntax elements separated by a terminal.
sourcepub fn add_token(self, pure_name: &str) -> Self
pub fn add_token(self, pure_name: &str) -> Self
Adds a non-keyword node for a token node (similar to an empty struct).
sourcepub fn add_keyword_token(self, pure_name: &str) -> Self
pub fn add_keyword_token(self, pure_name: &str) -> Self
Adds a keyword node for a token node (similar to an empty struct).
sourcepub fn add_terminal(self, pure_name: &str, is_keyword: bool) -> Self
pub fn add_terminal(self, pure_name: &str, is_keyword: bool) -> Self
Adds a node for a token node (similar to an empty struct).
sourcepub fn add_keyword_token_and_terminal(self, pure_name: &str) -> Self
pub fn add_keyword_token_and_terminal(self, pure_name: &str) -> Self
Adds a keyword token node and a keyword terminal node of the relevant names. e.g. for pure_name=“Identifier” it creates TokenIdentifier and TerminalIdentifier.
sourcepub fn add_token_and_terminal(self, pure_name: &str) -> Self
pub fn add_token_and_terminal(self, pure_name: &str) -> Self
Adds a non-keyword token node and a non-keyword terminal node of the relevant names. e.g. for pure_name=“Identifier” it creates TokenIdentifier and TerminalIdentifier.
sourcepub fn add_option(self, name: &str) -> Self
pub fn add_option(self, name: &str) -> Self
Adds an enum node for an option with 2 variants: empty and non-empty. Creates the empty
struct to be used for the empty variant. The Type for the non-empty variant is name
and it should exist independently of this call.
For example, for name=TypeClause, creates an enum OptionTypeClause with variants Empty(OptionTypeClauseEmpty) and TypeClause(TypeClause), where OptionTypeClauseEmpty is created here and TypeClause should exist independently.
sourcepub fn add_all_tokens_enum(self, name: &str) -> Self
pub fn add_all_tokens_enum(self, name: &str) -> Self
Adds an enum containing all the tokens as variants.