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

Updates #237

Merged
merged 5 commits into from
May 4, 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
20 changes: 0 additions & 20 deletions .eslintrc.js

This file was deleted.

17 changes: 8 additions & 9 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
* text=auto eol=lf
* text eol=lf

/src/** linguist-vendored
/examples/* linguist-vendored

src/grammar.json linguist-generated
src/node-types.json linguist-generated
src/*.json linguist-generated
src/parser.c linguist-generated
src/tree_sitter/* linguist-generated

src/grammar.json -diff
src/node-types.json -diff
src/parser.c -diff
bindings/** linguist-generated
binding.gyp linguist-generated
setup.py linguist-generated
Makefile linguist-generated
Package.swift linguist-generated
8 changes: 0 additions & 8 deletions .github/pull_request_template.md

This file was deleted.

67 changes: 44 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,57 @@ name: CI

on:
push:
branches:
- master
branches: [master]
paths:
- "scripts.js"
- "common/*"
- "*/grammar.js"
- "*/src/**"
- "bindings/**"
- "binding.gyp"
pull_request:
branches:
- master
paths:
- "scripts.js"
- "common/*"
- "*/grammar.js"
- "*/src/**"
- "bindings/**"
- "binding.gyp"

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

jobs:
test:
runs-on: ${{ matrix.os }}
name: Test parsers
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
os: [ubuntu-latest, windows-latest, macos-14]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- uses: actions/setup-python@v4
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up tree-sitter
uses: tree-sitter/setup-action/cli@v1
- name: Set up examples
run: |-
git clone https://github.com/laravel/laravel examples/laravel --single-branch --depth=1 --filter=blob:none
git clone https://github.com/laravel/framework examples/framework --single-branch --depth=1 --filter=blob:none
git clone https://github.com/phacility/phabricator examples/phabricator --single-branch --depth=1 --filter=blob:none
git clone https://github.com/sebastianbergmann/phpunit examples/phpunit --single-branch --depth=1 --filter=blob:none
git clone https://github.com/WordPress/WordPress examples/WordPress --single-branch --depth=1 --filter=blob:none
git clone https://github.com/wikimedia/mediawiki examples/mediawiki --single-branch --depth=1 --filter=blob:none
- name: Run tests
uses: tree-sitter/parser-test-action@v2
with:
python-version: '3.12'
- run: npm install
- run: npm test
- run: npm run test-examples
test_windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
test-rust: ${{runner.os == 'Linux'}}
- name: Parse examples
id: test
uses: tree-sitter/parse-action@v4
with:
node-version: 18
- run: npm install
- run: npm test
files: |
examples/**/*.php
invalid-files: |
examples/framework/tests/Foundation/fixtures/bad-syntax-strategy.php
30 changes: 30 additions & 0 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Fuzz Parser

on:
push:
branches: [master]
paths:
- php/src/scanner.c
- php_only/src/scanner.c
- common/scanner.h
pull_request:
paths:
- php/src/scanner.c
- php_only/src/scanner.c
- common/scanner.h

jobs:
fuzz:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
language: [php, php_only]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Fuzz ${{matrix.language}} parser
uses: tree-sitter/fuzz-action@v4
with:
directory: ${{matrix.language}}
tree-sitter-version: v0.22.5
23 changes: 23 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish package

on:
push:
tags: ["*"]

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

jobs:
npm:
uses: tree-sitter/workflows/.github/workflows/package-npm.yml@main
secrets:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
crates:
uses: tree-sitter/workflows/.github/workflows/package-crates.yml@main
secrets:
CARGO_REGISTRY_TOKEN: ${{secrets.CARGO_REGISTRY_TOKEN}}
pypi:
uses: tree-sitter/workflows/.github/workflows/package-pypi.yml@main
secrets:
PYPI_API_TOKEN: ${{secrets.PYPI_API_TOKEN}}
103 changes: 0 additions & 103 deletions .github/workflows/release.yml

This file was deleted.

47 changes: 32 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,38 @@
# Rust artifacts
Cargo.lock
node_modules
build
package-lock.json
/target/
target/

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

# Swift artifacts
.build/
bindings/c/*.pc
bindings/c/*.h

# Go artifacts
go.sum
_obj/

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

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

# 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.
php/Cargo.toml
php/binding.gyp
php/bindings
php_only/Cargo.toml
php_only/binding.gyp
php_only/bindings
# Example dirs
/examples/*/

# Grammar volatiles
*.wasm
*.obj
*.o
5 changes: 0 additions & 5 deletions .npmignore

This file was deleted.

Loading