Skip to content

apple/tree-sitter-pkl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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