-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade to tree-sitter 0.22 and add Python, C and Go bindings (#87)
* Move corpus directories * Update git files * Update node bindings * Update rust bindings * Update swift bindings * Add python bindings * Add C bindings * Add go bindings * Update github actions * Update parse examples
- Loading branch information
Showing
73 changed files
with
1,538 additions
and
275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.{json,toml,yml,gyp}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.js] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.rs] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.{c,cc,h}] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.{py,pyi}] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.swift] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.go] | ||
indent_style = tab | ||
indent_size = 8 | ||
|
||
[Makefile] | ||
indent_style = tab | ||
indent_size = 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,120 @@ | ||
name: CI | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- "**" | ||
on: [push, pull_request] | ||
|
||
concurrency: | ||
group: ${{github.workflow}}-${{github.ref}} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-node: | ||
name: build-node | ||
runs-on: ubuntu-latest | ||
test-parser: | ||
name: Test parser | ||
runs-on: ${{matrix.os}} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
steps: | ||
- name: Checkout code | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up tree-sitter | ||
uses: tree-sitter/setup-action/cli@v1 | ||
- name: Test ocaml | ||
working-directory: grammars/ocaml | ||
run: tree-sitter test | ||
- name: Test interface | ||
working-directory: grammars/interface | ||
run: tree-sitter test | ||
- name: Test highlighting | ||
run: tree-sitter test | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
parse-examples: | ||
name: Parse examples | ||
runs-on: ${{matrix.os}} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- name: Set up tree-sitter | ||
uses: tree-sitter/setup-action/cli@v1 | ||
- name: Parse examples | ||
uses: tree-sitter/parse-action@v4 | ||
with: | ||
node-version: 18 | ||
files-list: test/files.txt | ||
invalid-files-list: test/invalid-files.txt | ||
|
||
- name: Display Node versions | ||
run: | | ||
node --version | ||
npm --version | ||
test-go: | ||
name: Test Go binding | ||
runs-on: ${{matrix.os}} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.22' | ||
cache-dependency-path: bindings/go/go.mod | ||
- name: Get dependencies | ||
working-directory: bindings/go | ||
run: go get -t . | ||
- name: Test | ||
working-directory: bindings/go | ||
run: go test -v | ||
|
||
test-node: | ||
name: Test Node binding | ||
runs-on: ${{matrix.os}} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Node | ||
uses: actions/setup-node@v4 | ||
- name: Install dependencies | ||
run: npm install | ||
- name: Test | ||
run: npm run test-binding | ||
|
||
- name: Cache examples | ||
uses: actions/cache@v4 | ||
with: | ||
path: examples | ||
key: ${{ hashFiles('script/parse-examples') }} | ||
|
||
- name: Test corpus & parse examples | ||
run: npm test | ||
|
||
build-rust: | ||
name: build-rust | ||
runs-on: ubuntu-latest | ||
test-rust: | ||
name: Test Rust binding | ||
runs-on: ${{matrix.os}} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
steps: | ||
- name: Checkout code | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
|
||
- name: Set up Rust | ||
uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
- name: Build | ||
run: cargo build --release | ||
|
||
run: cargo build -v | ||
- name: Test | ||
run: cargo test | ||
run: cargo test -v | ||
|
||
build-swift: | ||
name: build-swift | ||
runs-on: macos-14 | ||
test-swift: | ||
name: Test Swift binding | ||
runs-on: ${{matrix.os}} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
steps: | ||
- name: Checkout code | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build | ||
run: swift build | ||
|
||
- name: Test | ||
run: swift test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,26 @@ | ||
name: publish | ||
name: Publish package | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
tags: ["*"] | ||
|
||
jobs: | ||
crate: | ||
if: github.repository_owner == 'tree-sitter' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
override: true | ||
|
||
- name: Publish crate | ||
uses: katyo/publish-crates@v1 | ||
with: | ||
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
concurrency: | ||
group: ${{github.workflow}}-${{github.ref}} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
npm: | ||
if: github.repository_owner == 'tree-sitter' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '12' | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Publish package | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
uses: tree-sitter/workflows/.github/workflows/package-npm.yml@main | ||
secrets: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | ||
crates: | ||
if: github.repository_owner == 'tree-sitter' | ||
uses: tree-sitter/workflows/.github/workflows/package-crates.yml@main | ||
secrets: | ||
CARGO_REGISTRY_TOKEN: ${{secrets.CARGO_REGISTRY_TOKEN}} | ||
# pypi: | ||
# if: github.repository_owner == 'tree-sitter' | ||
# uses: tree-sitter/workflows/.github/workflows/package-pypi.yml@main | ||
# secrets: | ||
# PYPI_API_TOKEN: ${{secrets.PYPI_API_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,41 @@ | ||
package-lock.json | ||
node_modules | ||
build | ||
examples | ||
*.log | ||
log.html | ||
/test.ml | ||
/test.mli | ||
target | ||
# Rust artifacts | ||
Cargo.lock | ||
.build | ||
target/ | ||
|
||
# Node artifacts | ||
build/ | ||
prebuilds/ | ||
node_modules/ | ||
*.tgz | ||
package-lock.json | ||
|
||
# Swift artifacts | ||
.build/ | ||
Package.resolved | ||
|
||
# These files would be generated by 'tree-sitter generate' with the default | ||
# settings. We don't want them because there's already a copy at the root. | ||
grammars/interface/Cargo.toml | ||
grammars/interface/binding.gyp | ||
grammars/interface/bindings | ||
grammars/ocaml/Cargo.toml | ||
grammars/ocaml/binding.gyp | ||
grammars/ocaml/bindings | ||
# Go artifacts | ||
go.sum | ||
_obj/ | ||
|
||
# Python artifacts | ||
.venv/ | ||
dist/ | ||
*.egg-info | ||
*.whl | ||
|
||
# C artifacts | ||
*.a | ||
*.so | ||
*.so.* | ||
*.dylib | ||
*.dll | ||
*.pc | ||
|
||
# Grammar volatiles | ||
*.wasm | ||
*.obj | ||
*.o | ||
|
||
# Test files | ||
/test.ml | ||
/test.mli |
Oops, something went wrong.