a structural diff that understands syntax 🟥🟩
 
 
 
 
 
Go to file
Amaan Qureshi 4ca44145dd
fix: mark helper functions static
2023-07-26 20:26:21 +07:00
.github Disable dependency caching 2023-06-28 17:09:41 +07:00
bindings C Bindings 2022-10-02 07:26:51 +07:00
examples Use 2-space-indent everywhere 2021-09-20 14:29:23 +07:00
queries Update highlight queries w.r.t current grammar 2023-06-28 16:19:13 +07:00
src fix: mark helper functions static 2023-07-26 20:26:21 +07:00
test/corpus Merge branch 'main' into not-nullable-types 2023-04-27 08:04:34 +07:00
.editorconfig Use 2-space-indent everywhere 2021-09-20 14:29:23 +07:00
.gitattributes Update repository to focus solely on the Tree-Sitter grammar 2019-07-29 19:00:48 +07:00
.gitignore C Bindings 2022-10-02 07:26:51 +07:00
Cargo.lock Bump Cargo.lock 2023-03-22 18:40:06 +07:00
Cargo.toml Bump version to 0.2.11 2021-10-12 01:01:46 +07:00
Icon128.png Initial commit 2019-07-28 22:49:32 +07:00
LICENSE Update repository to focus solely on the Tree-Sitter grammar 2019-07-29 19:00:48 +07:00
Makefile C Bindings 2022-10-02 07:26:51 +07:00
README.md Link to playground in introductory sentence 2021-10-12 00:44:27 +07:00
binding.gyp New scanner.c to better handle newlines 2021-11-09 15:49:57 +07:00
grammar-reference.js WIP: Add types and modifiers 2019-08-08 17:21:14 +07:00
grammar.js Merge branch 'main' into not-nullable-types 2023-04-27 08:04:34 +07:00
package-lock.json Bump packages 2023-06-28 15:41:23 +07:00
package.json Update package.json 2023-07-06 23:45:49 +07:00
playground-screenshot.png Rename web-ui -> playground 2021-10-12 00:42:48 +07:00

README.md

Kotlin Grammar for Tree-Sitter

Build

Kotlin language grammar for Tree-Sitter. You can try it out directly on the web.

Icon

The grammar is based on the official language grammar.

Project Structure

File Description
grammar.js The Tree-Sitter grammar
grammar-reference.js A direct translation of the Kotlin language grammar that is, however, ambiguous to Tree-Sitter
src The generated parser

Setup

npm install

Development

Compilation

To (re-)compile the grammar, run:

npm run generate

Note that the grammar is written completely in JavaScript (grammar.js), the other source files are generated by tree-sitter.

Testing

To run the unit tests, run:

npm run test

WebAssembly

Compilation

First make sure to have Emscripten installed. If you use Homebrew, you can brew install emscripten. Then run:

npm run build-wasm

Playground

After compiling the grammar to WebAssembly, you can invoke

npm run playground

to launch an interactive editing environment that displays the parsed syntax tree on-the-fly in the browser. You can also view a deployed version of this playground on the web.

Screenshot

Documentation

More documentation on how to create Tree-Sitter grammars can be found here.

See also