Provisional API: This reference documents current compiler behavior. Compatibility is not yet promised.
src/format.x
Code formatting helpers for the x2c compiler.
Functions
| Function | Summary |
|---|---|
Compiler.code_pretty_string | Returns a canonical formatted C String for an emitted token List. |
Compiler
Compiler.code_pretty_string
char *Compiler.code_pretty_string(Compiler cc, List code, String output_file)
Returns a canonical formatted C String for an emitted token List.
Token order and code are unchanged. Braces indent by two spaces,
semicolons break lines only outside parentheses, and preprocessor tokens
occupy their own lines. An empty List returns the empty String.
Emitted src-at markers carry existing compiler origin IDs; zero restores
output_file at its physical line.
Raises: <size-limit> or <alloc-fail> while materializing the result.
Source: src/format.x:90
Design notes
Converts emitted token Lists to pretty or compact C text without changing
token order. Parenthesis depth suppresses statement breaks within
expressions, and Buffer materializes the final String.