Skip to main content

Crate ardent

Crate ardent 

Source
Expand description

Opinionated formatter for NSIS scripts.

Ardent parses NSIS scripts into a concrete syntax tree, then pretty-prints them with canonical casing, consistent indentation, and normalized parameters.

§Examples

use ardent::{Formatter, FormatterOptions, EndOfLine};

let formatter = Formatter::new(FormatterOptions {
    end_of_line: Some(EndOfLine::Lf),
    ..Default::default()
}).unwrap();

let input = "section \"Hello World\"\ndetailprint \"hi\"\nsectionend\n";
let output = formatter.format(input).unwrap();
assert_eq!(output, "Section \"Hello World\"\n\tDetailPrint \"hi\"\nSectionEnd\n");

For CLI usage, see the repository.

Modules§

canonical_casing
Canonical casing lookup table for NSIS instructions.
canonical_includes
Canonical casing lookup table for NSIS bundled include library macros.
canonical_parameters
Canonical parameter lookup tables for NSIS instructions.
parser
PEG-based parser that produces a concrete syntax tree from NSIS source.
printer
Pretty-printer that renders a CST back to formatted NSIS source.
rules
Block-structure rules defining which keywords open, close, or continue blocks.

Structs§

Formatter
An NSIS script formatter.
FormatterOptions
Configuration for the formatter.

Enums§

EndOfLine
Line ending style for formatted output.