Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update bindings and add queries #30

Merged
merged 2 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .editorconfig
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
9 changes: 7 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
* text eol=lf

src/** linguist-generated
src/*.json linguist-generated
src/parser.c linguist-generated
src/tree_sitter/* linguist-generated

bindings/** linguist-generated
binding.gyp linguist-generated
Cargo.toml linguist-generated
setup.py linguist-generated
Makefile linguist-generated
Package.swift linguist-generated
51 changes: 43 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,51 @@ name: CI
on:
push:
branches: [master]
paths:
- grammar.js
- src/**
- test/**
- bindings/**
- binding.gyp
pull_request:
branches: [master]
paths:
- grammar.js
- src/**
- test/**
- bindings/**
- binding.gyp

concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest
name: Test parser
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-14]
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npm test
- run: make clean download-examples parse-examples
env:
TS: node_modules/.bin/tree-sitter
- name: Set up repository
uses: tree-sitter/[email protected]
with:
node-version: ${{vars.NODE_VERSION}}
- name: Clone nvim-treesitter corpus
uses: actions/checkout@v4
with:
repository: nvim-treesitter/nvim-treesitter
path: .tests/nvim-treesitter
sparse-checkout: queries/
- name: Clone nvim-treesitter-textobjects corpus
uses: actions/checkout@v4
with:
repository: nvim-treesitter/nvim-treesitter-textobjects
path: .tests/nvim-treesitter-textobjects
sparse-checkout: queries/
- name: Run tests
uses: tree-sitter/[email protected]
with:
test-library: ${{runner.os == 'Linux'}}
corpus-files: .tests/*/queries/*/*.scm
44 changes: 39 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,40 @@
.local
.tests
node_modules
# Rust artifacts
Cargo.lock
target/

# Node artifacts
build/
/.build/
target
node_modules/
*.tgz

# Swift artifacts
.build/

# Go artifacts
go.sum
_obj/

# Python artifacts
.venv/
dist/
*.egg-info
*.whl

# C artifacts
*.a
*.so
*.so.*
*.dylib
*.dll
*.pc

# Grammar volatiles
dsl.d.ts
*.wasm
*.obj
*.o

# Other dirs
.tests/
.local/
parser/
36 changes: 24 additions & 12 deletions Cargo.lock

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

22 changes: 9 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
[package]
name = "tree-sitter-query"
description = "query grammar for the tree-sitter parsing library"
description = "TS query grammar for tree-sitter"
version = "0.2.0"
keywords = ["incremental", "parsing", "query"]
license = "Apache-2.0"
readme = "README.md"
keywords = ["incremental", "parsing", "tree-sitter", "query"]
categories = ["parsing", "text-editors"]
repository = "https://github.com/tree-sitter-grammars/tree-sitter-query"
homepage = "https://github.com/tree-sitter-grammars/tree-sitter-query"
edition = "2021"
readme = "README.md"
authors = ["Steven Sojka", "Stephan Seitz"]
license = "Apache-2.0"
edition = "2021"
autoexamples = false

build = "bindings/rust/build.rs"
include = [
"bindings/rust/*",
"grammar.js",
"src/*",
]
include = ["bindings/rust/*", "grammar.js", "queries/*", "src/*"]

[lib]
path = "bindings/rust/lib.rs"

[dependencies]
tree-sitter = "~0.20.10"
tree-sitter = ">=0.21.0"

[build-dependencies]
cc = "^1.0"
cc = "^1.0.89"
Loading