Expand description
Math AST. A formula is a Row (horizontal sequence of nodes); every
editable slot in a structure node is itself a Row, so the cursor can
always be described as (path into nested rows, column in that row).
Enums§
Functions§
- normalize
- Canonical form: merge adjacent same-kind scripts (x^{a}^{b} == x^{ab} in
the picture, so the parser can only ever return the merged form).
parse(render(x)) == normalize(x)is the roundtrip invariant, and this must be idempotent — it runs again after every merge, so a rule has to land on the shape the next pass would leave alone. - row_at
- Walk
pathdown fromrootand return the row the cursor lives in. - row_
at_ mut - strip_
spacers - Remove every formatting
Spacerin the subtree — exactly what the parser cannot see (blank columns are structural). The roundtrip contract isparse(render(normalize(x))) == normalize(strip_spacers(normalize(x))).