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

fix: flat node structure for else if #199

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
fea3dea
feat: support missing gnu-style designated initializers
amaanq Jan 22, 2024
f0f5f1a
fix: allow any position of sized type keywords
ribru17 Dec 20, 2023
14c0568
feat: multi-byte characters
amaanq Jan 22, 2024
3206781
feat: allow preprocessor directives inside enumerator lists
amaanq Jan 22, 2024
d908b47
chore: generate
amaanq Jan 22, 2024
df6ac34
0.20.7
amaanq Jan 22, 2024
34f4c7e
fix: allow preproc calls in enumerator list items
amaanq Jan 22, 2024
ecdd500
fix: properly suffix elifdef
brandonspark Jan 26, 2024
c325574
fix: improve concatenated_string
lewis6991 Feb 13, 2024
c706154
fix: allow function definitions to contain preproc attributes
lewis6991 Feb 13, 2024
25ca271
0.20.8
amaanq Feb 13, 2024
b20f858
docs: update badges
amaanq Feb 14, 2024
bac0e89
fix: asm strings can be concatenated
amaanq Feb 16, 2024
8e6e28c
fix: ternary consequences can have comma expressions
amaanq Feb 16, 2024
579f349
fix: allow ms pointer modifiers in abstract pointer declarators
amaanq Feb 16, 2024
e3f4c95
fix: ms call modifier missing in some spots
amaanq Feb 16, 2024
72a60ea
chore: generate
amaanq Feb 16, 2024
f64a422
ci: use nodejs 20 for appveyor
XVilka Feb 18, 2024
652433f
ci: remove appveyor
amaanq Feb 23, 2024
db11e91
build: update bindings and versions
ObserverOfTime Mar 10, 2024
70c0dde
ci: update workflows
ObserverOfTime Mar 10, 2024
b125bec
build: update makefile for macos installation
amaanq Mar 13, 2024
371fd0b
docs: add pypi badge
amaanq Mar 13, 2024
28cd0a1
fix: flat node structure for else if
ribru17 Mar 20, 2024
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
22 changes: 0 additions & 22 deletions .appveyor.yml

This file was deleted.

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
17 changes: 10 additions & 7 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
/src/** linguist-vendored
/examples/* linguist-vendored
* text eol=lf

src/grammar.json linguist-generated
src/node-types.json linguist-generated
examples/* linguist-vendored

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
50 changes: 31 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,42 @@
name: CI

on:
workflow_dispatch:
pull_request:
push:
branches: [master]
paths:
- grammar.js
- src/**
- test/**
- bindings/**
- binding.gyp
pull_request:
paths:
- grammar.js
- src/**
- test/**
- bindings/**
- binding.gyp

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

jobs:
test:
runs-on: ${{ matrix.os }}
name: Test parser
runs-on: ${{matrix.os}}
strategy:
fail-fast: true
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
- name: Set up the repo
uses: tree-sitter/parser-setup-action@v1.1
with:
node-version: 18
- run: npm install
- run: npm test

test_windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
node-version: ${{vars.NODE_VERSION}}
- name: Run tests
uses: tree-sitter/parser-test-action@v1.2
with:
node-version: 18
- run: npm install
- run: npm run test-windows
lint: ${{runner.os == 'Linux'}}
test-library: ${{runner.os == 'Linux'}}
corpus-files: examples/*.c
19 changes: 0 additions & 19 deletions .github/workflows/lint.yml

This file was deleted.

118 changes: 19 additions & 99 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,103 +1,23 @@
name: Release
name: Publish packages

on:
workflow_run:
workflows: ["CI"]
branches:
- master
types:
- completed
push:
tags: ["*"]

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get previous commit SHA
id: get_previous_commit
run: |
LATEST_TAG=$(git describe --tags --abbrev=0)
if [[ -z "$LATEST_TAG" ]]; then
echo "No tag found. Failing..."
exit 1
fi
echo "latest_tag=${LATEST_TAG#v}" >> "$GITHUB_ENV" # Remove 'v' prefix from the tag

- name: Check if version changed and is greater than the previous
id: version_check
run: |
# Compare the current version with the version from the previous commit
PREVIOUS_NPM_VERSION=${{ env.latest_tag }}
CURRENT_NPM_VERSION=$(jq -r '.version' package.json)
CURRENT_CARGO_VERSION=$(awk -F '"' '/^version/ {print $2}' Cargo.toml)
if [[ "$CURRENT_NPM_VERSION" != "$CURRENT_CARGO_VERSION" ]]; then # Cargo.toml and package.json versions must match
echo "Mismatch: NPM version ($CURRENT_NPM_VERSION) and Cargo.toml version ($CURRENT_CARGO_VERSION)"
echo "version_changed=false" >> "$GITHUB_ENV"
else
if [[ "$PREVIOUS_NPM_VERSION" == "$CURRENT_NPM_VERSION" ]]; then
echo "version_changed=" >> "$GITHUB_ENV"
else
IFS='.' read -ra PREVIOUS_VERSION_PARTS <<< "$PREVIOUS_NPM_VERSION"
IFS='.' read -ra CURRENT_VERSION_PARTS <<< "$CURRENT_NPM_VERSION"
VERSION_CHANGED=false
for i in "${!PREVIOUS_VERSION_PARTS[@]}"; do
if [[ ${CURRENT_VERSION_PARTS[i]} -gt ${PREVIOUS_VERSION_PARTS[i]} ]]; then
VERSION_CHANGED=true
break
elif [[ ${CURRENT_VERSION_PARTS[i]} -lt ${PREVIOUS_VERSION_PARTS[i]} ]]; then
break
fi
done

echo "version_changed=$VERSION_CHANGED" >> "$GITHUB_ENV"
echo "current_version=${CURRENT_NPM_VERSION}" >> "$GITHUB_ENV"
fi
fi

- name: Display result
run: |
echo "Version bump detected: ${{ env.version_changed }}"
concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true

- name: Fail if version is lower
if: env.version_changed == 'false'
run: exit 1

- name: Setup Node
if: env.version_changed == 'true'
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: "https://registry.npmjs.org"
- name: Publish to NPM
if: env.version_changed == 'true'
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
run: npm publish

- name: Setup Rust
if: env.version_changed == 'true'
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Publish to Crates.io
if: env.version_changed == 'true'
uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}

- name: Tag versions
if: env.version_changed == 'true'
run: |
git checkout master
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
git tag -d "v${{ env.current_version }}" || true
git push origin --delete "v${{ env.current_version }}" || true
git tag -a "v${{ env.current_version }}" -m "Version ${{ env.current_version }}"
git push origin "v${{ env.current_version }}"
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}}
36 changes: 31 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
# Rust artifacts
Cargo.lock
node_modules
build
package-lock.json
/target/
.build/
target/

# Node artifacts
build/
prebuilds/
node_modules/

# Swift artifacts
.build/

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

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

# Examples
/examples/*/

# Grammar volatiles
*.wasm
*.obj
*.o
16 changes: 9 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
[package]
name = "tree-sitter-c"
description = "C grammar for the tree-sitter parsing library"
version = "0.20.6"
authors = ["Max Brunsfeld <maxbrunsfeld@gmail.com>"]
description = "C grammar for tree-sitter"
version = "0.21.0"
authors = [
"Max Brunsfeld <maxbrunsfeld@gmail.com>",
"Amaan Qureshi <amaanq12@gmail.com",
]
license = "MIT"
readme = "bindings/rust/README.md"
keywords = ["incremental", "parsing", "c"]
keywords = ["incremental", "parsing", "tree-sitter", "c"]
categories = ["parsing", "text-editors"]
repository = "https://github.com/tree-sitter/tree-sitter-c"
edition = "2021"
Expand All @@ -18,7 +20,7 @@ include = ["bindings/rust/*", "grammar.js", "queries/*", "src/*"]
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
Loading