Expand description
An opinionated formatter for Pine Script.
[format] lexes and parses the source, then renders the AST back through a
Prettier-style document layout. It preserves // comments (carried as lexer
trivia) and normalizes spacing, indentation, and line wrapping. Formatting
requires the source to parse; a lex or parse error is returned unchanged.
§Example
let src = "x=close+1\n";
assert_eq!(pine_format::format(src).unwrap(), "x = close + 1\n");Enums§
- Format
Error - Why formatting could not run: the source did not lex or parse.
Functions§
- format
- Format
source, returning canonical Pine text. ReturnsFormatErrorwhen the source does not lex or parse.