Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tree-sitter-nvmrc

Checks and Tests REUSE status

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.

References

  • nvm: The reference implementation. nvm_process_nvmrc in nvm.sh defines the parse: split into key/value on 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.

Development

Edit grammar.js, then regenerate and test:

tree-sitter generate
tree-sitter test

The parser under src/ is generated from grammar.js. Regenerate and commit it alongside any grammar change.

License

MIT

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.

About

nvmrc grammar for tree-sitter

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages