Expand description
The printer: a CstDocument → its exact source bytes.
[print] walks the CST in source order and concatenates every token’s
verbatim text. For an unmodified tree this reproduces the input byte-for-byte
(round-trip identity, INV-2 / TR-003). Because [print] reads only token
text — which the lexer captured verbatim and the parser never normalized —
printing is also idempotent: print(parse(print(parse(x)))) == print(parse(x))
(TR-017 / INV-2).
Functions§
- Print a
CstDocumentback to source text by concatenating all token text. - print_
node - Print an arbitrary
SyntaxNodesubtree to text (concatenated token text).