Struct tree_sitter_graph::graph::Graph
source · pub struct Graph<'tree> { /* private fields */ }Expand description
A graph produced by executing a graph DSL file. Graphs include a lifetime parameter to ensure that they don’t outlive the tree-sitter syntax tree that they are generated from.
Implementations§
source§impl<'tree> Graph<'tree>
impl<'tree> Graph<'tree>
sourcepub fn add_syntax_node(&mut self, node: Node<'tree>) -> SyntaxNodeRef
pub fn add_syntax_node(&mut self, node: Node<'tree>) -> SyntaxNodeRef
Adds a syntax node to the graph, returning a graph DSL reference to it.
The graph won’t contain every syntax node in the parsed syntax tree; it will only contain those nodes that are referenced at some point during the execution of the graph DSL file.
sourcepub fn add_graph_node(&mut self) -> GraphNodeRef
pub fn add_graph_node(&mut self) -> GraphNodeRef
Adds a new graph node to the graph, returning a graph DSL reference to it.
sourcepub fn pretty_print<'a>(&'a self) -> impl Display + 'a
pub fn pretty_print<'a>(&'a self) -> impl Display + 'a
Pretty-prints the contents of this graph.