Skip to main content

Crate sipha_diff

Crate sipha_diff 

Source
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 input with parse_fn produces a tree matching expected_sexp.

Structs§

SexpOptions
Options for S-expression output.

Functions§

assert_parse_eq
Assert that parsing input yields a tree whose S-expression equals expected_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).