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 |
|---|---|
code_pretty_string | Returns a canonical formatted C String for an emitted token List. |
Functions
code_pretty_string
char *code_pretty_string(List code)
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 with escaped quotes normalized. An empty List
returns the empty String.
Raises: <size-limit> or <alloc-fail> while materializing the result.
Source: src/format.x:88
Design notes
Converts emitted token Lists to pretty or compact C text without changing
token order. Parenthesis depth suppresses statement breaks within
expressions, and preprocessor tokens normalize escaped quotes before
Buffer materializes the final String.