Documentation
¶
Overview ¶
Package formatter produces a canonical, opinionated formatting of an MX Script source file. It walks the token stream (with comments and newlines preserved by the lexer's CollectComments flag) and emits a new source string with consistent indentation and operator spacing.
Conventions:
- 2-space indent, scoped by `{`/`}`/`(`/`)`/`[`/`]` depth.
- One blank line max between statements; blank lines inside blocks are preserved (a single newline stays a single newline; two or more collapse to one blank line).
- Standard operator spacing: a + b, a == b, a && b, ...
- Comma-separated lists: `a, b, c` (no leading space, trailing space).
- Braces: `{` stays on the same line as the keyword, `}` on its own line.
- Comments: preserved in place. A trailing `// ...` keeps its trailing position; a leading `// ...` stays above the next statement.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.