use crate::ast::{
AggregateCall, ArchetypePredicate, ClassExprOperand, ColumnExpr, CompareOperand,
ContainsConstraint, ContainsExpr, FunctionCall, IdentifiedExpr, IdentifiedPath, LikeOperand,
Limit, MatchesOperand, NodeNameConstraint, NodePredicate, ObjectPath, OrderByExpr, PathPart,
PathPredicate, PathPredicateOperand, Primitive, SelectClause, SelectExpr, SelectQuery, Span,
StandardPredicate, Terminal, TerminologyFunction, Top, ValueListItem, VersionPredicate,
WhereExpr,
};
pub trait Visit<'ast> {
fn visit_select_query(&mut self, node: &'ast SelectQuery) {
walk_select_query(self, node);
}
fn visit_select_clause(&mut self, node: &'ast SelectClause) {
walk_select_clause(self, node);
}
fn visit_top(&mut self, _node: &'ast Top) {}
fn visit_select_expr(&mut self, node: &'ast SelectExpr) {
walk_select_expr(self, node);
}
fn visit_column_expr(&mut self, node: &'ast ColumnExpr) {
walk_column_expr(self, node);
}
fn visit_contains_expr(&mut self, node: &'ast ContainsExpr) {
walk_contains_expr(self, node);
}
fn visit_contains_constraint(&mut self, node: &'ast ContainsConstraint) {
walk_contains_constraint(self, node);
}
fn visit_class_expr_operand(&mut self, node: &'ast ClassExprOperand) {
walk_class_expr_operand(self, node);
}
fn visit_where_expr(&mut self, node: &'ast WhereExpr) {
walk_where_expr(self, node);
}
fn visit_identified_expr(&mut self, node: &'ast IdentifiedExpr) {
walk_identified_expr(self, node);
}
fn visit_compare_operand(&mut self, node: &'ast CompareOperand) {
walk_compare_operand(self, node);
}
fn visit_terminal(&mut self, node: &'ast Terminal) {
walk_terminal(self, node);
}
fn visit_order_by_expr(&mut self, node: &'ast OrderByExpr) {
walk_order_by_expr(self, node);
}
fn visit_limit(&mut self, _node: &'ast Limit) {}
fn visit_identified_path(&mut self, node: &'ast IdentifiedPath) {
walk_identified_path(self, node);
}
fn visit_object_path(&mut self, node: &'ast ObjectPath) {
walk_object_path(self, node);
}
fn visit_path_part(&mut self, node: &'ast PathPart) {
walk_path_part(self, node);
}
fn visit_path_predicate(&mut self, node: &'ast PathPredicate) {
walk_path_predicate(self, node);
}
fn visit_standard_predicate(&mut self, node: &'ast StandardPredicate) {
walk_standard_predicate(self, node);
}
fn visit_archetype_predicate(&mut self, _node: &'ast ArchetypePredicate) {}
fn visit_node_predicate(&mut self, node: &'ast NodePredicate) {
walk_node_predicate(self, node);
}
fn visit_node_name_constraint(&mut self, _node: &'ast NodeNameConstraint) {}
fn visit_version_predicate(&mut self, node: &'ast VersionPredicate) {
walk_version_predicate(self, node);
}
fn visit_path_predicate_operand(&mut self, node: &'ast PathPredicateOperand) {
walk_path_predicate_operand(self, node);
}
fn visit_like_operand(&mut self, _node: &'ast LikeOperand) {}
fn visit_matches_operand(&mut self, node: &'ast MatchesOperand) {
walk_matches_operand(self, node);
}
fn visit_value_list_item(&mut self, node: &'ast ValueListItem) {
walk_value_list_item(self, node);
}
fn visit_function_call(&mut self, node: &'ast FunctionCall) {
walk_function_call(self, node);
}
fn visit_terminology_function(&mut self, _node: &'ast TerminologyFunction) {}
fn visit_aggregate_call(&mut self, node: &'ast AggregateCall) {
walk_aggregate_call(self, node);
}
fn visit_primitive(&mut self, _node: &'ast Primitive) {}
fn visit_span(&mut self, _node: &'ast Span) {}
}
pub fn walk_select_query<'ast, V: Visit<'ast> + ?Sized>(v: &mut V, node: &'ast SelectQuery) {
let SelectQuery {
select,
from,
where_,
order_by,
limit,
} = node;
v.visit_select_clause(select);
v.visit_contains_expr(from);
if let Some(where_) = where_ {
v.visit_where_expr(where_);
}
for term in order_by {
v.visit_order_by_expr(term);
}
if let Some(limit) = limit {
v.visit_limit(limit);
}
}
pub fn walk_select_clause<'ast, V: Visit<'ast> + ?Sized>(v: &mut V, node: &'ast SelectClause) {
let SelectClause {
distinct: _,
top,
columns,
} = node;
if let Some(top) = top {
v.visit_top(top);
}
for column in columns {
v.visit_select_expr(column);
}
}
pub fn walk_select_expr<'ast, V: Visit<'ast> + ?Sized>(v: &mut V, node: &'ast SelectExpr) {
let SelectExpr { column, alias: _ } = node;
v.visit_column_expr(column);
}
pub fn walk_column_expr<'ast, V: Visit<'ast> + ?Sized>(v: &mut V, node: &'ast ColumnExpr) {
match node {
ColumnExpr::Path(path) => v.visit_identified_path(path),
ColumnExpr::Primitive(primitive) => v.visit_primitive(primitive),
ColumnExpr::Aggregate(aggregate) => v.visit_aggregate_call(aggregate),
ColumnExpr::Function(function) => v.visit_function_call(function),
}
}
pub fn walk_contains_expr<'ast, V: Visit<'ast> + ?Sized>(v: &mut V, node: &'ast ContainsExpr) {
match node {
ContainsExpr::Contained { operand, contains } => {
v.visit_class_expr_operand(operand);
if let Some(constraint) = contains {
v.visit_contains_constraint(constraint);
}
}
ContainsExpr::And(left, right) | ContainsExpr::Or(left, right) => {
v.visit_contains_expr(left);
v.visit_contains_expr(right);
}
}
}
pub fn walk_contains_constraint<'ast, V: Visit<'ast> + ?Sized>(
v: &mut V,
node: &'ast ContainsConstraint,
) {
let ContainsConstraint { negated: _, expr } = node;
v.visit_contains_expr(expr);
}
pub fn walk_class_expr_operand<'ast, V: Visit<'ast> + ?Sized>(
v: &mut V,
node: &'ast ClassExprOperand,
) {
match node {
ClassExprOperand::Class {
rm_type: _,
variable: _,
predicate,
} => {
if let Some(predicate) = predicate {
v.visit_path_predicate(predicate);
}
}
ClassExprOperand::Version {
variable: _,
predicate,
} => {
if let Some(predicate) = predicate {
v.visit_version_predicate(predicate);
}
}
}
}
pub fn walk_where_expr<'ast, V: Visit<'ast> + ?Sized>(v: &mut V, node: &'ast WhereExpr) {
match node {
WhereExpr::Identified(expr, span) => {
v.visit_identified_expr(expr);
v.visit_span(span);
}
WhereExpr::Not(inner) => v.visit_where_expr(inner),
WhereExpr::And(left, right) | WhereExpr::Or(left, right) => {
v.visit_where_expr(left);
v.visit_where_expr(right);
}
}
}
pub fn walk_identified_expr<'ast, V: Visit<'ast> + ?Sized>(v: &mut V, node: &'ast IdentifiedExpr) {
match node {
IdentifiedExpr::Exists(path) => v.visit_identified_path(path),
IdentifiedExpr::Compare { lhs, op: _, rhs } => {
v.visit_compare_operand(lhs);
v.visit_terminal(rhs);
}
IdentifiedExpr::Like { path, operand } => {
v.visit_identified_path(path);
v.visit_like_operand(operand);
}
IdentifiedExpr::Matches { path, operand } => {
v.visit_identified_path(path);
v.visit_matches_operand(operand);
}
IdentifiedExpr::Resolved(_) => {}
}
}
pub fn walk_compare_operand<'ast, V: Visit<'ast> + ?Sized>(v: &mut V, node: &'ast CompareOperand) {
match node {
CompareOperand::Path(path) => v.visit_identified_path(path),
CompareOperand::Function(function) => v.visit_function_call(function),
}
}
pub fn walk_terminal<'ast, V: Visit<'ast> + ?Sized>(v: &mut V, node: &'ast Terminal) {
match node {
Terminal::Primitive(primitive) => v.visit_primitive(primitive),
Terminal::Parameter(_) => {}
Terminal::Path(path) => v.visit_identified_path(path),
Terminal::Function(function) => v.visit_function_call(function),
}
}
pub fn walk_order_by_expr<'ast, V: Visit<'ast> + ?Sized>(v: &mut V, node: &'ast OrderByExpr) {
let OrderByExpr { path, order: _ } = node;
v.visit_identified_path(path);
}
pub fn walk_identified_path<'ast, V: Visit<'ast> + ?Sized>(v: &mut V, node: &'ast IdentifiedPath) {
let IdentifiedPath {
root: _,
predicate,
path,
span,
} = node;
if let Some(predicate) = predicate {
v.visit_path_predicate(predicate);
}
if let Some(path) = path {
v.visit_object_path(path);
}
v.visit_span(span);
}
pub fn walk_object_path<'ast, V: Visit<'ast> + ?Sized>(v: &mut V, node: &'ast ObjectPath) {
let ObjectPath { parts } = node;
for part in parts {
v.visit_path_part(part);
}
}
pub fn walk_path_part<'ast, V: Visit<'ast> + ?Sized>(v: &mut V, node: &'ast PathPart) {
let PathPart { name: _, predicate } = node;
if let Some(predicate) = predicate {
v.visit_path_predicate(predicate);
}
}
pub fn walk_path_predicate<'ast, V: Visit<'ast> + ?Sized>(v: &mut V, node: &'ast PathPredicate) {
match node {
PathPredicate::Standard(standard) => v.visit_standard_predicate(standard),
PathPredicate::Archetype(archetype) => v.visit_archetype_predicate(archetype),
PathPredicate::Node(node) => v.visit_node_predicate(node),
}
}
pub fn walk_standard_predicate<'ast, V: Visit<'ast> + ?Sized>(
v: &mut V,
node: &'ast StandardPredicate,
) {
let StandardPredicate {
path,
op: _,
operand,
} = node;
v.visit_object_path(path);
v.visit_path_predicate_operand(operand);
}
pub fn walk_node_predicate<'ast, V: Visit<'ast> + ?Sized>(v: &mut V, node: &'ast NodePredicate) {
match node {
NodePredicate::Code { code: _, name } | NodePredicate::Archetype { hrid: _, name } => {
if let Some(name) = name {
v.visit_node_name_constraint(name);
}
}
NodePredicate::Parameter(_) => {}
NodePredicate::Standard(standard) => v.visit_standard_predicate(standard),
NodePredicate::MatchesRegex { path, regex: _ } => v.visit_object_path(path),
NodePredicate::And(left, right) | NodePredicate::Or(left, right) => {
v.visit_node_predicate(left);
v.visit_node_predicate(right);
}
}
}
pub fn walk_version_predicate<'ast, V: Visit<'ast> + ?Sized>(
v: &mut V,
node: &'ast VersionPredicate,
) {
match node {
VersionPredicate::Latest | VersionPredicate::All => {}
VersionPredicate::Standard(standard) => v.visit_standard_predicate(standard),
}
}
pub fn walk_path_predicate_operand<'ast, V: Visit<'ast> + ?Sized>(
v: &mut V,
node: &'ast PathPredicateOperand,
) {
match node {
PathPredicateOperand::Primitive(primitive) => v.visit_primitive(primitive),
PathPredicateOperand::Path(path) => v.visit_object_path(path),
PathPredicateOperand::Parameter(_) | PathPredicateOperand::Code(_) => {}
}
}
pub fn walk_matches_operand<'ast, V: Visit<'ast> + ?Sized>(v: &mut V, node: &'ast MatchesOperand) {
match node {
MatchesOperand::ValueList(items) => {
for item in items {
v.visit_value_list_item(item);
}
}
MatchesOperand::Terminology(terminology) => v.visit_terminology_function(terminology),
MatchesOperand::Uri(_) => {}
}
}
pub fn walk_value_list_item<'ast, V: Visit<'ast> + ?Sized>(v: &mut V, node: &'ast ValueListItem) {
match node {
ValueListItem::Primitive(primitive) => v.visit_primitive(primitive),
ValueListItem::Parameter(_) => {}
ValueListItem::Terminology(terminology) => v.visit_terminology_function(terminology),
}
}
pub fn walk_function_call<'ast, V: Visit<'ast> + ?Sized>(v: &mut V, node: &'ast FunctionCall) {
match node {
FunctionCall::Named { name: _, args } => {
for arg in args {
v.visit_terminal(arg);
}
}
FunctionCall::Terminology(terminology) => v.visit_terminology_function(terminology),
}
}
pub fn walk_aggregate_call<'ast, V: Visit<'ast> + ?Sized>(v: &mut V, node: &'ast AggregateCall) {
match node {
AggregateCall::Count { distinct: _, path } => {
if let Some(path) = path {
v.visit_identified_path(path);
}
}
AggregateCall::Stat { func: _, path } => v.visit_identified_path(path),
}
}
pub trait VisitMut {
fn visit_select_query_mut(&mut self, node: &mut SelectQuery) {
walk_select_query_mut(self, node);
}
fn visit_select_clause_mut(&mut self, node: &mut SelectClause) {
walk_select_clause_mut(self, node);
}
fn visit_top_mut(&mut self, _node: &mut Top) {}
fn visit_select_expr_mut(&mut self, node: &mut SelectExpr) {
walk_select_expr_mut(self, node);
}
fn visit_column_expr_mut(&mut self, node: &mut ColumnExpr) {
walk_column_expr_mut(self, node);
}
fn visit_contains_expr_mut(&mut self, node: &mut ContainsExpr) {
walk_contains_expr_mut(self, node);
}
fn visit_contains_constraint_mut(&mut self, node: &mut ContainsConstraint) {
walk_contains_constraint_mut(self, node);
}
fn visit_class_expr_operand_mut(&mut self, node: &mut ClassExprOperand) {
walk_class_expr_operand_mut(self, node);
}
fn visit_where_expr_mut(&mut self, node: &mut WhereExpr) {
walk_where_expr_mut(self, node);
}
fn visit_identified_expr_mut(&mut self, node: &mut IdentifiedExpr) {
walk_identified_expr_mut(self, node);
}
fn visit_compare_operand_mut(&mut self, node: &mut CompareOperand) {
walk_compare_operand_mut(self, node);
}
fn visit_terminal_mut(&mut self, node: &mut Terminal) {
walk_terminal_mut(self, node);
}
fn visit_order_by_expr_mut(&mut self, node: &mut OrderByExpr) {
walk_order_by_expr_mut(self, node);
}
fn visit_limit_mut(&mut self, _node: &mut Limit) {}
fn visit_identified_path_mut(&mut self, node: &mut IdentifiedPath) {
walk_identified_path_mut(self, node);
}
fn visit_object_path_mut(&mut self, node: &mut ObjectPath) {
walk_object_path_mut(self, node);
}
fn visit_path_part_mut(&mut self, node: &mut PathPart) {
walk_path_part_mut(self, node);
}
fn visit_path_predicate_mut(&mut self, node: &mut PathPredicate) {
walk_path_predicate_mut(self, node);
}
fn visit_standard_predicate_mut(&mut self, node: &mut StandardPredicate) {
walk_standard_predicate_mut(self, node);
}
fn visit_archetype_predicate_mut(&mut self, _node: &mut ArchetypePredicate) {}
fn visit_node_predicate_mut(&mut self, node: &mut NodePredicate) {
walk_node_predicate_mut(self, node);
}
fn visit_node_name_constraint_mut(&mut self, _node: &mut NodeNameConstraint) {}
fn visit_version_predicate_mut(&mut self, node: &mut VersionPredicate) {
walk_version_predicate_mut(self, node);
}
fn visit_path_predicate_operand_mut(&mut self, node: &mut PathPredicateOperand) {
walk_path_predicate_operand_mut(self, node);
}
fn visit_like_operand_mut(&mut self, _node: &mut LikeOperand) {}
fn visit_matches_operand_mut(&mut self, node: &mut MatchesOperand) {
walk_matches_operand_mut(self, node);
}
fn visit_value_list_item_mut(&mut self, node: &mut ValueListItem) {
walk_value_list_item_mut(self, node);
}
fn visit_function_call_mut(&mut self, node: &mut FunctionCall) {
walk_function_call_mut(self, node);
}
fn visit_terminology_function_mut(&mut self, _node: &mut TerminologyFunction) {}
fn visit_aggregate_call_mut(&mut self, node: &mut AggregateCall) {
walk_aggregate_call_mut(self, node);
}
fn visit_primitive_mut(&mut self, _node: &mut Primitive) {}
fn visit_span_mut(&mut self, _node: &mut Span) {}
}
pub fn walk_select_query_mut<V: VisitMut + ?Sized>(v: &mut V, node: &mut SelectQuery) {
let SelectQuery {
select,
from,
where_,
order_by,
limit,
} = node;
v.visit_select_clause_mut(select);
v.visit_contains_expr_mut(from);
if let Some(where_) = where_ {
v.visit_where_expr_mut(where_);
}
for term in order_by {
v.visit_order_by_expr_mut(term);
}
if let Some(limit) = limit {
v.visit_limit_mut(limit);
}
}
pub fn walk_select_clause_mut<V: VisitMut + ?Sized>(v: &mut V, node: &mut SelectClause) {
let SelectClause {
distinct: _,
top,
columns,
} = node;
if let Some(top) = top {
v.visit_top_mut(top);
}
for column in columns {
v.visit_select_expr_mut(column);
}
}
pub fn walk_select_expr_mut<V: VisitMut + ?Sized>(v: &mut V, node: &mut SelectExpr) {
let SelectExpr { column, alias: _ } = node;
v.visit_column_expr_mut(column);
}
pub fn walk_column_expr_mut<V: VisitMut + ?Sized>(v: &mut V, node: &mut ColumnExpr) {
match node {
ColumnExpr::Path(path) => v.visit_identified_path_mut(path),
ColumnExpr::Primitive(primitive) => v.visit_primitive_mut(primitive),
ColumnExpr::Aggregate(aggregate) => v.visit_aggregate_call_mut(aggregate),
ColumnExpr::Function(function) => v.visit_function_call_mut(function),
}
}
pub fn walk_contains_expr_mut<V: VisitMut + ?Sized>(v: &mut V, node: &mut ContainsExpr) {
match node {
ContainsExpr::Contained { operand, contains } => {
v.visit_class_expr_operand_mut(operand);
if let Some(constraint) = contains {
v.visit_contains_constraint_mut(constraint);
}
}
ContainsExpr::And(left, right) | ContainsExpr::Or(left, right) => {
v.visit_contains_expr_mut(left);
v.visit_contains_expr_mut(right);
}
}
}
pub fn walk_contains_constraint_mut<V: VisitMut + ?Sized>(
v: &mut V,
node: &mut ContainsConstraint,
) {
let ContainsConstraint { negated: _, expr } = node;
v.visit_contains_expr_mut(expr);
}
pub fn walk_class_expr_operand_mut<V: VisitMut + ?Sized>(v: &mut V, node: &mut ClassExprOperand) {
match node {
ClassExprOperand::Class {
rm_type: _,
variable: _,
predicate,
} => {
if let Some(predicate) = predicate {
v.visit_path_predicate_mut(predicate);
}
}
ClassExprOperand::Version {
variable: _,
predicate,
} => {
if let Some(predicate) = predicate {
v.visit_version_predicate_mut(predicate);
}
}
}
}
pub fn walk_where_expr_mut<V: VisitMut + ?Sized>(v: &mut V, node: &mut WhereExpr) {
match node {
WhereExpr::Identified(expr, span) => {
v.visit_identified_expr_mut(expr);
v.visit_span_mut(span);
}
WhereExpr::Not(inner) => v.visit_where_expr_mut(inner),
WhereExpr::And(left, right) | WhereExpr::Or(left, right) => {
v.visit_where_expr_mut(left);
v.visit_where_expr_mut(right);
}
}
}
pub fn walk_identified_expr_mut<V: VisitMut + ?Sized>(v: &mut V, node: &mut IdentifiedExpr) {
match node {
IdentifiedExpr::Exists(path) => v.visit_identified_path_mut(path),
IdentifiedExpr::Compare { lhs, op: _, rhs } => {
v.visit_compare_operand_mut(lhs);
v.visit_terminal_mut(rhs);
}
IdentifiedExpr::Like { path, operand } => {
v.visit_identified_path_mut(path);
v.visit_like_operand_mut(operand);
}
IdentifiedExpr::Matches { path, operand } => {
v.visit_identified_path_mut(path);
v.visit_matches_operand_mut(operand);
}
IdentifiedExpr::Resolved(_) => {}
}
}
pub fn walk_compare_operand_mut<V: VisitMut + ?Sized>(v: &mut V, node: &mut CompareOperand) {
match node {
CompareOperand::Path(path) => v.visit_identified_path_mut(path),
CompareOperand::Function(function) => v.visit_function_call_mut(function),
}
}
pub fn walk_terminal_mut<V: VisitMut + ?Sized>(v: &mut V, node: &mut Terminal) {
match node {
Terminal::Primitive(primitive) => v.visit_primitive_mut(primitive),
Terminal::Parameter(_) => {}
Terminal::Path(path) => v.visit_identified_path_mut(path),
Terminal::Function(function) => v.visit_function_call_mut(function),
}
}
pub fn walk_order_by_expr_mut<V: VisitMut + ?Sized>(v: &mut V, node: &mut OrderByExpr) {
let OrderByExpr { path, order: _ } = node;
v.visit_identified_path_mut(path);
}
pub fn walk_identified_path_mut<V: VisitMut + ?Sized>(v: &mut V, node: &mut IdentifiedPath) {
let IdentifiedPath {
root: _,
predicate,
path,
span,
} = node;
if let Some(predicate) = predicate {
v.visit_path_predicate_mut(predicate);
}
if let Some(path) = path {
v.visit_object_path_mut(path);
}
v.visit_span_mut(span);
}
pub fn walk_object_path_mut<V: VisitMut + ?Sized>(v: &mut V, node: &mut ObjectPath) {
let ObjectPath { parts } = node;
for part in parts {
v.visit_path_part_mut(part);
}
}
pub fn walk_path_part_mut<V: VisitMut + ?Sized>(v: &mut V, node: &mut PathPart) {
let PathPart { name: _, predicate } = node;
if let Some(predicate) = predicate {
v.visit_path_predicate_mut(predicate);
}
}
pub fn walk_path_predicate_mut<V: VisitMut + ?Sized>(v: &mut V, node: &mut PathPredicate) {
match node {
PathPredicate::Standard(standard) => v.visit_standard_predicate_mut(standard),
PathPredicate::Archetype(archetype) => v.visit_archetype_predicate_mut(archetype),
PathPredicate::Node(node) => v.visit_node_predicate_mut(node),
}
}
pub fn walk_standard_predicate_mut<V: VisitMut + ?Sized>(v: &mut V, node: &mut StandardPredicate) {
let StandardPredicate {
path,
op: _,
operand,
} = node;
v.visit_object_path_mut(path);
v.visit_path_predicate_operand_mut(operand);
}
pub fn walk_node_predicate_mut<V: VisitMut + ?Sized>(v: &mut V, node: &mut NodePredicate) {
match node {
NodePredicate::Code { code: _, name } | NodePredicate::Archetype { hrid: _, name } => {
if let Some(name) = name {
v.visit_node_name_constraint_mut(name);
}
}
NodePredicate::Parameter(_) => {}
NodePredicate::Standard(standard) => v.visit_standard_predicate_mut(standard),
NodePredicate::MatchesRegex { path, regex: _ } => v.visit_object_path_mut(path),
NodePredicate::And(left, right) | NodePredicate::Or(left, right) => {
v.visit_node_predicate_mut(left);
v.visit_node_predicate_mut(right);
}
}
}
pub fn walk_version_predicate_mut<V: VisitMut + ?Sized>(v: &mut V, node: &mut VersionPredicate) {
match node {
VersionPredicate::Latest | VersionPredicate::All => {}
VersionPredicate::Standard(standard) => v.visit_standard_predicate_mut(standard),
}
}
pub fn walk_path_predicate_operand_mut<V: VisitMut + ?Sized>(
v: &mut V,
node: &mut PathPredicateOperand,
) {
match node {
PathPredicateOperand::Primitive(primitive) => v.visit_primitive_mut(primitive),
PathPredicateOperand::Path(path) => v.visit_object_path_mut(path),
PathPredicateOperand::Parameter(_) | PathPredicateOperand::Code(_) => {}
}
}
pub fn walk_matches_operand_mut<V: VisitMut + ?Sized>(v: &mut V, node: &mut MatchesOperand) {
match node {
MatchesOperand::ValueList(items) => {
for item in items {
v.visit_value_list_item_mut(item);
}
}
MatchesOperand::Terminology(terminology) => v.visit_terminology_function_mut(terminology),
MatchesOperand::Uri(_) => {}
}
}
pub fn walk_value_list_item_mut<V: VisitMut + ?Sized>(v: &mut V, node: &mut ValueListItem) {
match node {
ValueListItem::Primitive(primitive) => v.visit_primitive_mut(primitive),
ValueListItem::Parameter(_) => {}
ValueListItem::Terminology(terminology) => v.visit_terminology_function_mut(terminology),
}
}
pub fn walk_function_call_mut<V: VisitMut + ?Sized>(v: &mut V, node: &mut FunctionCall) {
match node {
FunctionCall::Named { name: _, args } => {
for arg in args {
v.visit_terminal_mut(arg);
}
}
FunctionCall::Terminology(terminology) => v.visit_terminology_function_mut(terminology),
}
}
pub fn walk_aggregate_call_mut<V: VisitMut + ?Sized>(v: &mut V, node: &mut AggregateCall) {
match node {
AggregateCall::Count { distinct: _, path } => {
if let Some(path) = path {
v.visit_identified_path_mut(path);
}
}
AggregateCall::Stat { func: _, path } => v.visit_identified_path_mut(path),
}
}