tree-sitter-pkl

module
v0.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2026 License: Apache-2.0

README

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.pkl

Tests

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 test

If 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.

  1. Run npm update tree-sitter to install the newer version of tree-sitter.
  2. Commit to main, and push.

Resources

Directories

Path Synopsis
bindings
go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL