pub struct AstTreePrinter { /* private fields */ }Expand description
A visitor that renders programs or individual AST subtrees.
Visit one or more roots, then consume the printer with Self::finish.
Node order is deterministic and follows the visitor’s structural order.
use std::ops::ControlFlow;
use gql_parser::{AstTreePrinter, Expr};
use gql_parser::visit::Visitor;
let mut printer = AstTreePrinter::new();
let ControlFlow::Continue(()) = printer.visit_expr(&Expr::Wildcard);
assert_eq!(printer.finish(), "Expr::Wildcard\n");Implementations§
Trait Implementations§
Source§impl Debug for AstTreePrinter
impl Debug for AstTreePrinter
Source§impl Default for AstTreePrinter
impl Default for AstTreePrinter
Source§impl<'ast> Visitor<'ast> for AstTreePrinter
impl<'ast> Visitor<'ast> for AstTreePrinter
type Break = !
fn enter_node(&mut self, node: AstNode<'ast>) -> ControlFlow<Self::Break>
fn leave_node(&mut self, _node: AstNode<'ast>) -> ControlFlow<Self::Break>
fn enter_field(&mut self, field: Field) -> ControlFlow<Self::Break>
fn leave_field(&mut self, _field: Field) -> ControlFlow<Self::Break>
fn enter_list(&mut self, len: usize) -> ControlFlow<Self::Break>
fn leave_list(&mut self) -> ControlFlow<Self::Break>
fn visit_scalar(&mut self, value: Scalar<'ast>) -> ControlFlow<Self::Break>
fn visit_program(&mut self, node: &'ast Program) -> ControlFlow<Self::Break>
fn visit_graph_variable_definition( &mut self, node: &'ast GraphVariableDefinition, ) -> ControlFlow<Self::Break>
fn visit_binding_table_variable_definition( &mut self, node: &'ast BindingTableVariableDefinition, ) -> ControlFlow<Self::Break>
fn visit_value_variable_definition( &mut self, node: &'ast ValueVariableDefinition, ) -> ControlFlow<Self::Break>
fn visit_next_statement( &mut self, node: &'ast NextStatement, ) -> ControlFlow<Self::Break>
fn visit_query_statement( &mut self, node: &'ast QueryStatement, ) -> ControlFlow<Self::Break>
fn visit_query_body( &mut self, node: &'ast QueryBody, ) -> ControlFlow<Self::Break>
fn visit_query_set_operation( &mut self, node: &'ast QuerySetOperation, ) -> ControlFlow<Self::Break>
fn visit_select_graph_match( &mut self, node: &'ast SelectGraphMatch, ) -> ControlFlow<Self::Break>
fn visit_select_query_specification( &mut self, node: &'ast SelectQuerySpecification, ) -> ControlFlow<Self::Break>
fn visit_match_clause( &mut self, node: &'ast MatchClause, ) -> ControlFlow<Self::Break>
fn visit_filter_clause( &mut self, node: &'ast FilterClause, ) -> ControlFlow<Self::Break>
fn visit_let_clause( &mut self, node: &'ast LetClause, ) -> ControlFlow<Self::Break>
fn visit_let_item(&mut self, node: &'ast LetItem) -> ControlFlow<Self::Break>
fn visit_for_clause( &mut self, node: &'ast ForClause, ) -> ControlFlow<Self::Break>
fn visit_for_ordinality_or_offset( &mut self, node: &'ast ForOrdinalityOrOffset, ) -> ControlFlow<Self::Break>
fn visit_call_clause( &mut self, node: &'ast CallClause, ) -> ControlFlow<Self::Break>
fn visit_inline_procedure_call( &mut self, node: &'ast InlineProcedureCall, ) -> ControlFlow<Self::Break>
fn visit_order_by_page_clause( &mut self, node: &'ast OrderByPageClause, ) -> ControlFlow<Self::Break>
fn visit_call_statement( &mut self, node: &'ast CallStatement, ) -> ControlFlow<Self::Break>
fn visit_yield_clause( &mut self, node: &'ast YieldClause, ) -> ControlFlow<Self::Break>
fn visit_result_clause( &mut self, node: &'ast ResultClause, ) -> ControlFlow<Self::Break>
fn visit_result_item( &mut self, node: &'ast ResultItem, ) -> ControlFlow<Self::Break>
fn visit_order_by_item( &mut self, node: &'ast OrderByItem, ) -> ControlFlow<Self::Break>
fn visit_insert_statement( &mut self, node: &'ast InsertStatement, ) -> ControlFlow<Self::Break>
fn visit_delete_statement( &mut self, node: &'ast DeleteStatement, ) -> ControlFlow<Self::Break>
fn visit_set_statement( &mut self, node: &'ast SetStatement, ) -> ControlFlow<Self::Break>
fn visit_remove_statement( &mut self, node: &'ast RemoveStatement, ) -> ControlFlow<Self::Break>
fn visit_session_set_command( &mut self, node: &'ast SessionSetCommand, ) -> ControlFlow<Self::Break>
fn visit_session_set_graph_parameter( &mut self, node: &'ast SessionSetGraphParameter, ) -> ControlFlow<Self::Break>
fn visit_session_set_binding_table_parameter( &mut self, node: &'ast SessionSetBindingTableParameter, ) -> ControlFlow<Self::Break>
fn visit_session_set_value_parameter( &mut self, node: &'ast SessionSetValueParameter, ) -> ControlFlow<Self::Break>
fn visit_session_reset_command( &mut self, node: &'ast SessionResetCommand, ) -> ControlFlow<Self::Break>
fn visit_session_close_command( &mut self, node: &'ast SessionCloseCommand, ) -> ControlFlow<Self::Break>
fn visit_create_graph_statement( &mut self, node: &'ast CreateGraphStatement, ) -> ControlFlow<Self::Break>
fn visit_drop_graph_statement( &mut self, node: &'ast DropGraphStatement, ) -> ControlFlow<Self::Break>
fn visit_create_graph_type_statement( &mut self, node: &'ast CreateGraphTypeStatement, ) -> ControlFlow<Self::Break>
fn visit_drop_graph_type_statement( &mut self, node: &'ast DropGraphTypeStatement, ) -> ControlFlow<Self::Break>
fn visit_create_schema_statement( &mut self, node: &'ast CreateSchemaStatement, ) -> ControlFlow<Self::Break>
fn visit_drop_schema_statement( &mut self, node: &'ast DropSchemaStatement, ) -> ControlFlow<Self::Break>
fn visit_start_transaction_statement( &mut self, node: &'ast StartTransactionStatement, ) -> ControlFlow<Self::Break>
fn visit_commit_statement( &mut self, node: &'ast CommitStatement, ) -> ControlFlow<Self::Break>
fn visit_rollback_statement( &mut self, node: &'ast RollbackStatement, ) -> ControlFlow<Self::Break>
fn visit_graph_name( &mut self, node: &'ast GraphName, ) -> ControlFlow<Self::Break>
fn visit_binding_table_name( &mut self, node: &'ast BindingTableName, ) -> ControlFlow<Self::Break>
fn visit_graph_type_name( &mut self, node: &'ast GraphTypeName, ) -> ControlFlow<Self::Break>
fn visit_schema_name( &mut self, node: &'ast SchemaName, ) -> ControlFlow<Self::Break>
fn visit_procedure_name( &mut self, node: &'ast ProcedureName, ) -> ControlFlow<Self::Break>
fn visit_path_pattern( &mut self, node: &'ast PathPattern, ) -> ControlFlow<Self::Break>
fn visit_parenthesized_path_pattern_expression( &mut self, node: &'ast ParenthesizedPathPatternExpression, ) -> ControlFlow<Self::Break>
fn visit_path_pattern_term( &mut self, node: &'ast PathPatternTerm, ) -> ControlFlow<Self::Break>
fn visit_path_pattern_chain( &mut self, node: &'ast PathPatternChain, ) -> ControlFlow<Self::Break>
fn visit_node_pattern( &mut self, node: &'ast NodePattern, ) -> ControlFlow<Self::Break>
fn visit_relationship_pattern( &mut self, node: &'ast RelationshipPattern, ) -> ControlFlow<Self::Break>
fn visit_graph_type_body( &mut self, node: &'ast GraphTypeBody, ) -> ControlFlow<Self::Break>
fn visit_node_type_definition( &mut self, node: &'ast NodeTypeDefinition, ) -> ControlFlow<Self::Break>
fn visit_edge_type_definition( &mut self, node: &'ast EdgeTypeDefinition, ) -> ControlFlow<Self::Break>
fn visit_property_type_definition( &mut self, node: &'ast PropertyTypeDefinition, ) -> ControlFlow<Self::Break>
fn visit_field_type( &mut self, node: &'ast FieldType, ) -> ControlFlow<Self::Break>
fn visit_case_when_clause( &mut self, node: &'ast CaseWhenClause, ) -> ControlFlow<Self::Break>
fn visit_map_literal( &mut self, node: &'ast MapLiteral, ) -> ControlFlow<Self::Break>
fn visit_sql_interval_qualifier( &mut self, node: &'ast SqlIntervalQualifier, ) -> ControlFlow<Self::Break>
fn visit_identifier( &mut self, node: &'ast Identifier, ) -> ControlFlow<Self::Break>
fn visit_binding_variable_definition( &mut self, node: &'ast BindingVariableDefinition, ) -> ControlFlow<Self::Break>
fn visit_statement(&mut self, node: &'ast Statement) -> ControlFlow<Self::Break>
fn visit_query_set_operator( &mut self, node: &'ast QuerySetOperator, ) -> ControlFlow<Self::Break>
fn visit_set_quantifier( &mut self, node: &'ast SetQuantifier, ) -> ControlFlow<Self::Break>
fn visit_query_clause( &mut self, node: &'ast QueryClause, ) -> ControlFlow<Self::Break>
fn visit_match_mode( &mut self, node: &'ast MatchMode, ) -> ControlFlow<Self::Break>
fn visit_for_ordinality_or_offset_kind( &mut self, node: &'ast ForOrdinalityOrOffsetKind, ) -> ControlFlow<Self::Break>
fn visit_procedure_call( &mut self, node: &'ast ProcedureCall, ) -> ControlFlow<Self::Break>
fn visit_procedure_reference( &mut self, node: &'ast ProcedureReference, ) -> ControlFlow<Self::Break>
fn visit_yield_item( &mut self, node: &'ast YieldItem, ) -> ControlFlow<Self::Break>
fn visit_result_kind( &mut self, node: &'ast ResultKind, ) -> ControlFlow<Self::Break>
fn visit_sort_direction( &mut self, node: &'ast SortDirection, ) -> ControlFlow<Self::Break>
fn visit_null_ordering( &mut self, node: &'ast NullOrdering, ) -> ControlFlow<Self::Break>
fn visit_set_item(&mut self, node: &'ast SetItem) -> ControlFlow<Self::Break>
fn visit_remove_item( &mut self, node: &'ast RemoveItem, ) -> ControlFlow<Self::Break>
fn visit_session_set_target( &mut self, node: &'ast SessionSetTarget, ) -> ControlFlow<Self::Break>
fn visit_session_reset_target( &mut self, node: &'ast SessionResetTarget, ) -> ControlFlow<Self::Break>
fn visit_create_graph_type( &mut self, node: &'ast CreateGraphType, ) -> ControlFlow<Self::Break>
fn visit_create_graph_type_source( &mut self, node: &'ast CreateGraphTypeSource, ) -> ControlFlow<Self::Break>
fn visit_transaction_access_mode( &mut self, node: &'ast TransactionAccessMode, ) -> ControlFlow<Self::Break>
fn visit_isolation_level( &mut self, node: &'ast IsolationLevel, ) -> ControlFlow<Self::Break>
fn visit_graph_expression( &mut self, node: &'ast GraphExpression, ) -> ControlFlow<Self::Break>
fn visit_binding_table_expression( &mut self, node: &'ast BindingTableExpression, ) -> ControlFlow<Self::Break>
fn visit_graph_type_reference( &mut self, node: &'ast GraphTypeReference, ) -> ControlFlow<Self::Break>
fn visit_schema_reference( &mut self, node: &'ast SchemaReference, ) -> ControlFlow<Self::Break>
fn visit_path_pattern_factor( &mut self, node: &'ast PathPatternFactor, ) -> ControlFlow<Self::Break>
fn visit_path_pattern_alternation( &mut self, node: &'ast PathPatternAlternation, ) -> ControlFlow<Self::Break>
fn visit_path_pattern_prefix( &mut self, node: &'ast PathPatternPrefix, ) -> ControlFlow<Self::Break>
fn visit_path_mode(&mut self, node: &'ast PathMode) -> ControlFlow<Self::Break>
fn visit_path_or_paths( &mut self, node: &'ast PathOrPaths, ) -> ControlFlow<Self::Break>
fn visit_path_search_prefix( &mut self, node: &'ast PathSearchPrefix, ) -> ControlFlow<Self::Break>
fn visit_unsigned_integer_specification( &mut self, node: &'ast UnsignedIntegerSpecification, ) -> ControlFlow<Self::Break>
fn visit_direction(&mut self, node: &'ast Direction) -> ControlFlow<Self::Break>
fn visit_label_expression( &mut self, node: &'ast LabelExpression, ) -> ControlFlow<Self::Break>
fn visit_path_pattern_quantifier( &mut self, node: &'ast PathPatternQuantifier, ) -> ControlFlow<Self::Break>
fn visit_graph_type_element( &mut self, node: &'ast GraphTypeElement, ) -> ControlFlow<Self::Break>
fn visit_value_type( &mut self, node: &'ast ValueType, ) -> ControlFlow<Self::Break>
fn visit_character_string_type_kind( &mut self, node: &'ast CharacterStringTypeKind, ) -> ControlFlow<Self::Break>
fn visit_boolean_type_kind( &mut self, node: &'ast BooleanTypeKind, ) -> ControlFlow<Self::Break>
fn visit_temporal_type_kind( &mut self, node: &'ast TemporalTypeKind, ) -> ControlFlow<Self::Break>
fn visit_byte_string_type_kind( &mut self, node: &'ast ByteStringTypeKind, ) -> ControlFlow<Self::Break>
fn visit_exact_numeric_type_kind( &mut self, node: &'ast ExactNumericTypeKind, ) -> ControlFlow<Self::Break>
fn visit_approximate_numeric_type_kind( &mut self, node: &'ast ApproximateNumericTypeKind, ) -> ControlFlow<Self::Break>
fn visit_expr(&mut self, node: &'ast Expr) -> ControlFlow<Self::Break>
fn visit_trim_spec(&mut self, node: &'ast TrimSpec) -> ControlFlow<Self::Break>
fn visit_string_length_unit( &mut self, node: &'ast StringLengthUnit, ) -> ControlFlow<Self::Break>
fn visit_substring_side( &mut self, node: &'ast SubstringSide, ) -> ControlFlow<Self::Break>
fn visit_numeric_function_kind( &mut self, node: &'ast NumericFunctionKind, ) -> ControlFlow<Self::Break>
fn visit_date_time_function_kind( &mut self, node: &'ast DateTimeFunctionKind, ) -> ControlFlow<Self::Break>
fn visit_list_value_type_name( &mut self, node: &'ast ListValueTypeName, ) -> ControlFlow<Self::Break>
fn visit_source_destination_kind( &mut self, node: &'ast SourceDestinationKind, ) -> ControlFlow<Self::Break>
fn visit_literal(&mut self, node: &'ast Literal) -> ControlFlow<Self::Break>
fn visit_unary_op(&mut self, node: &'ast UnaryOp) -> ControlFlow<Self::Break>
fn visit_binary_op(&mut self, node: &'ast BinaryOp) -> ControlFlow<Self::Break>
Auto Trait Implementations§
impl Freeze for AstTreePrinter
impl RefUnwindSafe for AstTreePrinter
impl Send for AstTreePrinter
impl Sync for AstTreePrinter
impl Unpin for AstTreePrinter
impl UnsafeUnpin for AstTreePrinter
impl UnwindSafe for AstTreePrinter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more