MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / print_expression

Function print_expression

graphlite/src/ast/pretty_printer.rs:403–614  ·  view source on GitHub ↗
(expr: &Expression, indent: usize)

Source from the content-addressed store, hash-verified

401}
402
403fn print_expression(expr: &Expression, indent: usize) {
404 match expr {
405 Expression::Binary(binary) => {
406 debug!(
407 "{}BinaryExpression ({:?})",
408 get_indent(indent),
409 binary.operator
410 );
411 debug!("{}Left", get_indent(indent + 1));
412 print_expression(&binary.left, indent + 2);
413 debug!("{}Right", get_indent(indent + 1));
414 print_expression(&binary.right, indent + 2);
415 }
416 Expression::Unary(unary) => {
417 debug!(
418 "{}UnaryExpression ({:?})",
419 get_indent(indent),
420 unary.operator
421 );
422 print_expression(&unary.expression, indent + 1);
423 }
424 Expression::FunctionCall(func) => {
425 debug!("{}FunctionCall: {}", get_indent(indent), func.name);
426 debug!(
427 "{}Arguments ({})",
428 get_indent(indent + 1),
429 func.arguments.len()
430 );
431 for (i, arg) in func.arguments.iter().enumerate() {
432 debug!("{}Arg {}", get_indent(indent + 2), i);
433 print_expression(arg, indent + 3);
434 }
435 }
436 Expression::PropertyAccess(prop) => {
437 debug!(
438 "{}PropertyAccess: {}.{}",
439 get_indent(indent),
440 prop.object,
441 prop.property
442 );
443 }
444 Expression::Variable(var) => {
445 debug!("{}Variable: ${}", get_indent(indent), var.name);
446 }
447 Expression::Literal(literal) => {
448 let literal_str = match literal {
449 Literal::String(s) => format!("Literal: \"{}\"", s),
450 Literal::Integer(i) => format!("Literal: {}", i),
451 Literal::Float(f) => format!("Literal: {}", f),
452 Literal::Boolean(b) => format!("Literal: {}", b),
453 Literal::Null => "Literal: null".to_string(),
454 Literal::DateTime(dt) => format!("Literal: DateTime({})", dt),
455 Literal::Duration(dur) => format!("Literal: Duration({})", dur),
456 Literal::TimeWindow(tw) => format!("Literal: TimeWindow({})", tw),
457 Literal::Vector(vec) => format!("Literal: Vector({:?})", vec),
458 Literal::List(list) => format!("Literal: List({:?})", list),
459 };
460 debug!("{}{}", get_indent(indent), literal_str);

Callers 7

print_call_statementFunction · 0.85
print_property_mapFunction · 0.85
print_where_clauseFunction · 0.85
print_return_itemFunction · 0.85
print_group_clauseFunction · 0.85
print_having_clauseFunction · 0.85
print_order_itemFunction · 0.85

Calls 3

print_queryFunction · 0.85
print_path_patternFunction · 0.85
iterMethod · 0.45

Tested by

no test coverage detected