a structural diff that understands syntax 🟥🟩
 
 
 
 
 
Go to file
fwcd 7587b4a7f1 Add npm and crates.io badges 2023-10-02 20:33:40 +07:00
.github Disable dependency caching 2023-06-28 17:09:41 +07:00
bindings Bump version to 0.3.1 for development 2023-10-02 20:11:57 +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 Merge pull request #94 from amaanq/fixes 2023-07-27 03:53:13 +07:00
test/corpus feat: support unicode identifier 2023-07-15 12:01:55 +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 version to 0.3.1 for development 2023-10-02 20:11:57 +07:00
Cargo.toml Bump version to 0.3.1 for development 2023-10-02 20:11:57 +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 Bump version to 0.3.1 for development 2023-10-02 20:11:57 +07:00
README.md Add npm and crates.io badges 2023-10-02 20:33:40 +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 feat: support unicode identifier 2023-07-15 12:01:55 +07:00
package-lock.json Bump version to 0.3.1 for development 2023-10-02 20:11:57 +07:00
package.json Bump version to 0.3.1 for development 2023-10-02 20:11:57 +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 NPM crates.io

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