Skip to main content

pretty_print

Function pretty_print 

Source
pub fn pretty_print(ast: &ASTNode) -> String
Expand description

Pretty-prints an AST node according to canonical formatting rules.

Rules:

  • All functions upper-case, no spaces before ‘(’
  • Commas followed by single space; no space before ‘,’
  • Binary operators surrounded by single spaces
  • No superfluous parentheses (keeps semantics)
  • References printed via .normalise()
  • Array literals: {1, 2; 3, 4}