0.18.1 • Published 7 months ago
@apple/tree-sitter-pkl v0.18.1
A tree-sitter grammar for Pkl.
# install dependencies
$ npm install
# build parser
$ npm run build
# parse some code
$ ./node_modules/.bin/tree-sitter parse test.pklTests
Tree sitter comes with its own test framework. Files in test/corpus/
describe one test each. All tests in test/corpus/ are performed by the
command
$ tree-sitter testIf the grammar has changed, run tree-sitter test --update to update the corpus.
Snippet Tests
The tests within test/corpus/snippetTests are generated from the core Pkl parser, and are not updated by tree-sitter test --update.
These tests are generated by running ./gradlew createLanguageSnippetsCorpus.
This task grabs all language snippet tests, and renders them into a format that can be processed by tree-sitter.
To fix any rendering issues, change SExprRenderer.
Upgrading tree-sitter
Upgrading tree-sitter involves upgrading the NPM package.
- Run
npm update tree-sitterto install the newer version of tree-sitter. - Commit to main, and push.