Files
tree-sitter-lscript/README.md
T
2026-10-23 02:13:30 -04:00

38 lines
1.3 KiB
Markdown

# tree-sitter-lscript
Tree-sitter grammar and editor queries for LScript.
This package provides a lossless, error-tolerant concrete syntax tree for
LScript editors and source tools. Syntax fixtures and tests are included here.
The public named-node and field contract is documented in
[docs/cst.md](docs/cst.md).
## Development
Tree-sitter 0.27 is required. `tree-sitter generate` evaluates `grammar.js`
with Node.js by default; without Node.js, pass `--js-runtime native` to use the
CLI's bundled QuickJS runtime.
```sh
npm install
npm run generate
npm test
npm run test:fixtures
npm run test:queries
cargo test
```
`test:fixtures` requires every syntax-valid fixture to parse without an `ERROR`
or `MISSING` node. It also checks syntax-invalid fixtures and fails if a new one
is accepted without recovery. Three exceptions are listed explicitly by the
script: the adjacency-only `=-` and `!=` lexer errors, and recovery after a
repeated result operator. These need lexical or recovery handling rather than
a looser grammar rule.
The future-reserved word `context` is a `reserved_word` token with no grammar
production, so it is rejected wherever an identifier is expected.
Generated parser sources under `src/` are committed so consumers do not need
Node.js or the Tree-sitter CLI.