@nsis/parser
v0.1.0
Published
Parser for NSIS scripts
Downloads
159
Readme
@nsis/parser
Parser for NSIS scripts
Installation
npm install @nsis/parser
Usage
import { parse } from "@nsis/parser";
const nodes = parse(`
Name "Demo"
Section
Nop
SectionEnd
`);Returns a flat array of CST nodes, one per logical line:
[
{ type: "blank" },
{ type: "instruction", keyword: "Name", args: ['"Demo"'] },
{ type: "instruction", keyword: "Section", args: [] },
{ type: "instruction", keyword: "Nop", args: [] },
{ type: "instruction", keyword: "SectionEnd", args: [] },
{ type: "blank" },
]API
parse(input)
Parses NSIS source text into a flat list of CST nodes. Handles BOM stripping and line continuations automatically.
Throws SyntaxError if the input cannot be parsed.
Node Types
BlankNode
{ type: "blank" }CommentNode
{ type: "comment", style: "hash" | "semicolon" | "block", value: string }InstructionNode
{ type: "instruction", keyword: string, args: string[], comment?: Comment }LabelNode
{ type: "label", name: string, comment?: Comment }Related
License
This work is licensed under The MIT License.
