Skip to main content

Crate pine_format

Crate pine_format 

Source
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§

FormatError
Why formatting could not run: the source did not lex or parse.

Functions§

format
Format source, returning canonical Pine text. Returns FormatError when the source does not lex or parse.