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

Standardization update #44

Merged
merged 5 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
* text eol=lf

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

bindings/** linguist-generated
binding.gyp linguist-generated
setup.py linguist-generated
Makefile linguist-generated
Package.swift linguist-generated
121 changes: 94 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,105 @@ name: CI
on:
push:
branches: [main]
paths:
- grammar.js
- src/**
- test/**
- bindings/**
- binding.gyp
pull_request:
branches: [main]
paths:
- grammar.js
- src/**
- test/**
- bindings/**
- binding.gyp

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

jobs:
test:
name: 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:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '16.x'
- name: Install Dependencies
run: npm install
- name: Test
run: npm run test
- name: Set up repository
uses: tree-sitter/[email protected]
with:
node-version: ${{vars.NODE_VERSION}}
- name: Clone apisix corpus
uses: actions/checkout@v4
with:
path: examples/apisix
repository: apache/apisix
sparse-checkout: apisix/
- name: Clone kong corpus
uses: actions/checkout@v4
with:
path: examples/kong
repository: Kong/kong
sparse-checkout: kong/
- name: Clone lua corpus
uses: actions/checkout@v4
with:
path: examples/lua
repository: lua/lua
sparse-checkout: testes/
- name: Clone luvit corpus
uses: actions/checkout@v4
with:
path: examples/luvit
repository: luvit/luvit
- name: Clone neovim corpus
uses: actions/checkout@v4
with:
path: examples/neovim
repository: neovim/neovim
sparse-checkout-cone-mode: false
sparse-checkout: |-
/test/**/*.lua
/scripts/**/*.lua
/runtime/**/*.lua
- name: Clone xmake corpus
uses: actions/checkout@v4
if: runner.os != 'Windows'
with:
path: examples/xmake
repository: xmake-io/xmake
- name: Run tests
uses: tree-sitter/[email protected]
with:
test-library: ${{runner.os == 'Linux'}}
corpus-files: |-
examples/apisix/**/*.lua
examples/kong/**/*.lua
examples/lua/**/*.lua
examples/luvit/**/*.lua
examples/neovim/**/*.lua
examples/xmake/**/*.lua
invalid-files: |-
examples/neovim/test/functional/fixtures/lua/syntax_error.lua

bindings-rust:
name: Rust Bindings
fuzz:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Check for scanner changes
id: scanner-changes
run: |-
if git diff --quiet HEAD^ -- src/scanner.c; then
printf 'changed=false\n' >> "$GITHUB_OUTPUT"
else
printf 'changed=true\n' >> "$GITHUB_OUTPUT"
fi
- name: Fuzz parser
uses: tree-sitter/fuzz-action@v4
if: steps.scanner-changes.outputs.changed == 'true'
17 changes: 17 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Publish package

on:
push:
tags: ["*"]

jobs:
npm:
uses: tree-sitter/workflows/.github/workflows/package-npm.yml@main
with:
package-name: "@tree-sitter-grammars/tree-sitter-lua"
secrets:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
crates:
uses: tree-sitter/workflows/.github/workflows/package-crates.yml@main
secrets:
CARGO_REGISTRY_TOKEN: ${{secrets.CARGO_TOKEN}}
48 changes: 37 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,38 @@
*.log
*.tgz
.DS_Store
# Rust artifacts
Cargo.lock
build
node_modules
package-lock.json
yarn.lock
target

examples/**/*
!examples/*.*
target/

# Node artifacts
build/
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

# Example dirs
/examples/*/

# Grammar volatiles
dsl.d.ts
*.wasm
*.obj
*.o
25 changes: 10 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
[package]
name = "tree-sitter-lua"
description = "Lua grammar for the tree-sitter parsing library"
version = "0.0.19"
authors = [
"Munif Tanjim <[email protected]>",
]
description = "Lua grammar for tree-sitter"
version = "0.1.0"
license = "MIT"
keywords = ["incremental", "parsing", "lua"]
readme = "README.md"
keywords = ["incremental", "parsing", "tree-sitter", "lua"]
categories = ["parsing", "text-editors"]
repository = "https://github.com/tree-sitter-grammars/tree-sitter-lua"
edition = "2018"
authors = ["Munif Tanjim <[email protected]>"]
edition = "2021"
autoexamples = false

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

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

[dependencies]
tree-sitter = "0.20"
tree-sitter = ">=0.21.0"

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