Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
itsaky committed Mar 16, 2024
2 parents 9745a9c + 260afd9 commit 6590e9b
Show file tree
Hide file tree
Showing 15 changed files with 30,019 additions and 29,661 deletions.
23 changes: 4 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,12 @@ on:
jobs:
build:
runs-on: ubuntu-latest
env:
EMSCRIPTEN_VERSION: '2.0.17'
steps:
- uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install Emscripten
uses: mymindstorm/setup-emsdk@v12
with:
version: ${{ env.EMSCRIPTEN_VERSION }}
- name: Install dependencies
run: npm install
- name: Generate parser
Expand All @@ -31,20 +25,11 @@ jobs:
diff=`git diff HEAD -- src`
echo "$diff"
test -z "$diff"
- name: Output parser size
run: du -sh src/* | sort -h
- name: Run tests
run: npm test
- name: Build WASM binary
run: npm run build-wasm
- name: Upload WASM binary
uses: actions/upload-artifact@v3
with:
name: tree-sitter-kotlin.wasm
path: ./tree-sitter-kotlin.wasm
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
uses: dtolnay/rust-toolchain@stable
- name: Build and test crate
uses: actions-rs/cargo@v1
with:
command: test
run: cargo test
9 changes: 2 additions & 7 deletions .github/workflows/deploy-to-crates-io.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ jobs:
- name: Compile grammar
run: npm run generate
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
uses: dtolnay/rust-toolchain@stable
- name: Publish to crates.io
uses: actions-rs/cargo@v1
with:
command: publish
args: --token ${{ secrets.CRATES_IO_TOKEN }}
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}
61 changes: 43 additions & 18 deletions .github/workflows/deploy-to-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,62 @@ jobs:
deploy:
runs-on: ubuntu-latest
env:
EMSCRIPTEN_VERSION: '2.0.17'
EMSCRIPTEN_VERSION: '3.1.55'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Clone gh-pages branch into nested directory
uses: actions/checkout@v4
with:
ref: gh-pages
path: gh-pages
- name: Configure Git user
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Get tag name
id: tag
run: |
tag=$(basename "${{ github.ref }}")
echo "tag=$tag" >> $GITHUB_OUTPUT
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install Emscripten
uses: mymindstorm/setup-emsdk@v12
uses: mymindstorm/setup-emsdk@v14
with:
version: ${{ env.EMSCRIPTEN_VERSION }}
- name: Install dependencies
run: npm install
- name: Compile grammar
run: npm run generate
- name: Build WASM binary
- name: Build Wasm binary
run: npm run build-wasm
- name: Deploy to GitHub Releases
uses: ncipollo/release-action@v1
with:
artifacts: tree-sitter-kotlin.wasm
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up folder for GitHub Pages deployment
run: |
mkdir public
cp tree-sitter-kotlin.wasm public/tree-sitter-parser.wasm
tag="${{ steps.tag.outputs.tag }}"
gh release create "$tag" --title "$tag"
gh release upload "$tag" tree-sitter-kotlin.wasm
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
keep_files: true
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
run: |
sha="$(git rev-parse --short HEAD)"
tag="${{ steps.tag.outputs.tag }}"
echo "==> Replacing Wasm binary..."
rm -rf gh-pages/assets/tree-sitter-kotlin*
mkdir -p "gh-pages/assets/tree-sitter-kotlin-$tag"
cp tree-sitter-kotlin.wasm "gh-pages/assets/tree-sitter-kotlin-$tag"
tree gh-pages/assets
echo "==> Updating version on website..."
sed -i "s|\(LANGUAGE_BASE_URL = \"\)[^\"]*\(\"\)|\1assets/tree-sitter-kotlin-$tag\2|g" gh-pages/index.html
sed -i "s|\(<span class=\"version\">\)[^<]*\(</span>\)|\1$tag\2|g" gh-pages/index.html
echo "==> Committing and pushing gh-pages branch..."
cd gh-pages
git add .
git commit -m "Deploy tree-sitter-kotlin $tag ($sha)"
git push
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ node_modules
*.lib
*.obj

# WASM
# Wasm
*.asm.js
*.wasm
*.wasm.mem
Expand Down
38 changes: 25 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "tree-sitter-kotlin"
description = "Kotlin grammar for the tree-sitter parsing library"
version = "0.3.2"
version = "0.3.6"
keywords = ["incremental", "parsing", "kotlin"]
categories = ["parsing", "text-editors"]
repository = "https://github.com/fwcd/tree-sitter-kotlin"
Expand All @@ -21,7 +21,7 @@ include = [
path = "bindings/rust/lib.rs"

[dependencies]
tree-sitter = "0.20"
tree-sitter = "0.22"

[build-dependencies]
cc = "1.0"
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION := 0.3.2
VERSION := 0.3.6

# Repository
SRC_DIR := src
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Kotlin Grammar for Tree-Sitter
# Kotlin Grammar for Tree-sitter

[![Build](https://github.com/fwcd/tree-sitter-kotlin/actions/workflows/build.yml/badge.svg)](https://github.com/fwcd/tree-sitter-kotlin/actions/workflows/build.yml)
[![NPM](https://img.shields.io/npm/v/tree-sitter-kotlin)](https://www.npmjs.com/package/tree-sitter-kotlin)
[![crates.io](https://img.shields.io/crates/v/tree-sitter-kotlin)](https://crates.io/crates/tree-sitter-kotlin)

[Kotlin](https://kotlinlang.org) language grammar for [Tree-Sitter](http://tree-sitter.github.io/tree-sitter/). You can try it out directly [on the web](https://fwcd.github.io/tree-sitter-kotlin).
[Kotlin](https://kotlinlang.org) language grammar for [Tree-sitter](http://tree-sitter.github.io/tree-sitter/). You can try it out directly [on the web](https://fwcd.github.io/tree-sitter-kotlin).

![Icon](Icon128.png)

Expand All @@ -14,8 +14,8 @@ The grammar is based on the [official language grammar](https://kotlinlang.org/d

| 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 |
| 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
Expand Down Expand Up @@ -58,7 +58,7 @@ to launch an interactive editing environment that displays the parsed syntax tre

## Documentation

More documentation on how to create Tree-Sitter grammars [can be found here](https://tree-sitter.github.io/tree-sitter/creating-parsers).
More documentation on how to create Tree-sitter grammars [can be found here](https://tree-sitter.github.io/tree-sitter/creating-parsers).

## See also

Expand Down
6 changes: 3 additions & 3 deletions bindings/rust/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Kotlin Grammar for Tree-Sitter
# Kotlin Grammar for Tree-sitter

This crate provides a Kotlin grammar for the [tree-sitter](https://tree-sitter.github.io/tree-sitter/) parsing library. To use this crate, add it to the `[dependencies]` section of your `Cargo.toml` file:

```toml
tree-sitter = "0.20"
tree-sitter-kotlin = "0.3.2"
tree-sitter = "0.22"
tree-sitter-kotlin = "0.3.6"
```

Typically, you will use the `language` function to add this grammar to a tree-sitter [`Parser`](https://docs.rs/tree-sitter/*/tree_sitter/struct.Parser.html), and then use the parser to parse some code:
Expand Down
2 changes: 1 addition & 1 deletion grammar-reference.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ module.exports = grammar({

// Note how the following rules directly encode
// predence and associativity rather than using
// Tree-Sitters prec function. This might be
// Tree-sitters prec function. This might be
// changed in the future (though it reflects how
// the Kotlin compiler generates its syntax tree).

Expand Down
32 changes: 16 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tree-sitter-kotlin",
"version": "0.3.2",
"description": "Tree-Sitter grammar for Kotlin",
"version": "0.3.6",
"description": "Tree-sitter grammar for Kotlin",
"main": "bindings/node",
"scripts": {
"test": "tree-sitter test",
Expand All @@ -28,10 +28,10 @@
},
"homepage": "https://github.com/fwcd/tree-sitter-kotlin#readme",
"dependencies": {
"nan": "^2.17.0"
"nan": "^2.19.0"
},
"devDependencies": {
"tree-sitter-cli": "^0.20.8"
"tree-sitter-cli": "^0.22.1"
},
"tree-sitter": [
{
Expand Down
Loading

0 comments on commit 6590e9b

Please sign in to comment.