Expand description
Tree diff and comparison for sipha syntax trees.
Compare two syntax trees by their emitted text (round-trip). Useful for tests (assert formatted output) or refactors (compare before/after).
§Grammar tests with S-expressions
Use assert_parse_eq or the assert_parse! macro to compare a parsed
tree against an expected S-expression string (e.g. "(ROOT (EXPR (NUM \"1\")))").
Macros§
- assert_
parse - Assert that parsing
inputwithparse_fnproduces a tree matchingexpected_sexp.
Structs§
- Sexp
Options - Options for S-expression output.
Functions§
- assert_
parse_ eq - Assert that parsing
inputyields a tree whose S-expression equalsexpected_sexp. - format_
diff - Format a short diff message: “expected” vs “got” (full round-trip).
- syntax_
node_ to_ sexp - Serialize a syntax tree to an S-expression string.
- trees_
equal - Returns true if both trees emit the same string (same tokens and trivia).
- trees_
equal_ semantic - Returns true if both trees have the same semantic content (ignoring trivia).