Struct tree_sitter_graph::ast::File
source · pub struct File {
pub language: Language,
pub globals: Vec<Global>,
pub inherited_variables: HashSet<Identifier>,
pub query: Option<Query>,
pub stanzas: Vec<Stanza>,
pub shorthands: AttributeShorthands,
}
Expand description
A graph DSL file
Fields§
§language: Language
§globals: Vec<Global>
The expected global variables used in this file
inherited_variables: HashSet<Identifier>
The scoped variables that are inherited by child nodes
query: Option<Query>
The combined query of all stanzas in the file
stanzas: Vec<Stanza>
The list of stanzas in the file
shorthands: AttributeShorthands
Attribute shorthands defined in the file
Implementations§
source§impl File
impl File
sourcepub fn execute<'a, 'tree>(
&self,
tree: &'tree Tree,
source: &'tree str,
config: &ExecutionConfig<'_, '_>,
cancellation_flag: &dyn CancellationFlag
) -> Result<Graph<'tree>, ExecutionError>
pub fn execute<'a, 'tree>( &self, tree: &'tree Tree, source: &'tree str, config: &ExecutionConfig<'_, '_>, cancellation_flag: &dyn CancellationFlag ) -> Result<Graph<'tree>, ExecutionError>
Executes this graph DSL file against a source file. You must provide the parsed syntax
tree (tree
) as well as the source text that it was parsed from (source
). You also
provide the set of functions and global variables that are available during execution.
sourcepub fn execute_into<'a, 'tree>(
&self,
graph: &mut Graph<'tree>,
tree: &'tree Tree,
source: &'tree str,
config: &ExecutionConfig<'_, '_>,
cancellation_flag: &dyn CancellationFlag
) -> Result<(), ExecutionError>
pub fn execute_into<'a, 'tree>( &self, graph: &mut Graph<'tree>, tree: &'tree Tree, source: &'tree str, config: &ExecutionConfig<'_, '_>, cancellation_flag: &dyn CancellationFlag ) -> Result<(), ExecutionError>
Executes this graph DSL file against a source file, saving the results into an existing
Graph
instance. You must provide the parsed syntax tree (tree
) as well as the source
text that it was parsed from (source
). You also provide the set of functions and global
variables that are available during execution. This variant is useful when you need to
“pre-seed” the graph with some predefined nodes and/or edges before executing the DSL file.