nvmrc grammar for tree-sitter.
Parses .nvmrc files (the node-version files that
nvm and compatible tools read). The grammar is
permissive: it splits each line into an optional key/value on the first =,
keeps # comments and surrounding whitespace as extras, and leaves validation
(e.g. rejecting bad version ranges) to downstream consumers.
See test/corpus/ for the full set of examples that define the
grammar's behavior.
- nvm: The reference implementation.
nvm_process_nvmrcinnvm.shdefines the parse: split intokey/valueon the first=, keeping the remainder of the line verbatim as the value. nvmrc: An alternative npm parser that instead splits the value into parts.
The grammar keeps enough structure to describe both interpretations.
Edit grammar.js, then regenerate and test:
tree-sitter generate
tree-sitter testThe parser under src/ is generated from grammar.js. Regenerate and commit it
alongside any grammar change.
Bundled third-party MIT material is acknowledged in
THIRD-PARTY-NOTICES.txt.
This repository is REUSE-compliant; new files need an
SPDX header or a .license sidecar.