Expand description
Rendering the Node CST. Spec §5.
Two spaces, the opening brace on the same line, a semicolon on every
statement, // comments — the shape prettier’s defaults and
node --check both accept without complaint. Nothing is decided
here: the tree already carries every choice, down to which operator
is written and whether a value needs parentheses.
The one JavaScript-specific lexical fact this module owns is
string_text’s escaping, which is the same set C, Java and every
other column with a \0 in its string grammar already use — unlike
crate::zig, JavaScript’s string literals do accept \0
(ECMA-262 §12.9.4’s SingleEscapeCharacter), so there is no
Zig-shaped exception here.
Functions§
- char_
text - The same, for a character literal.
- expr
- Render one expression, for a caller that has only one.
- file
- Render a whole file.
- ident
- The identifier a name renders as, for a caller assembling one.
- stat
- Render one statement, for a caller that has only one.
- string_
text - Escape a string for a JavaScript double-quoted string literal.