Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ember-tooling/tree-sitter-glimmer
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.0
Choose a base ref
...
head repository: ember-tooling/tree-sitter-glimmer
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Loading
Showing with 5,707 additions and 1,566 deletions.
  1. +39 −0 .editorconfig
  2. +11 −0 .gitattributes
  3. +0 −14 .github/workflows/auto-merge.yml
  4. +69 −0 .github/workflows/ci.yml
  5. +0 −37 .github/workflows/docs.yml
  6. +42 −0 .github/workflows/linting.yml
  7. +90 −0 .github/workflows/plan-release.yml
  8. +58 −0 .github/workflows/publish.yml
  9. +19 −0 .github/workflows/regenerate.yml
  10. +0 −71 .github/workflows/verify.yml
  11. +14 −0 .gitignore
  12. +0 −4 .husky/pre-commit
  13. +5 −0 .prettierignore
  14. +25 −0 .release-plan.json
  15. +25 −0 CHANGELOG.md
  16. +10 −12 Cargo.toml
  17. +109 −0 Makefile
  18. +48 −0 Package.swift
  19. +3 −3 README.md
  20. +27 −0 RELEASE.md
  21. +7 −5 binding.gyp
  22. +16 −0 bindings/c/tree-sitter-glimmer.h
  23. +11 −0 bindings/c/tree-sitter-glimmer.pc.in
  24. +13 −0 bindings/go/binding.go
  25. +15 −0 bindings/go/binding_test.go
  26. +5 −0 bindings/go/go.mod
  27. +14 −22 bindings/node/binding.cc
  28. +28 −0 bindings/node/index.d.ts
  29. +3 −15 bindings/node/index.js
  30. +5 −0 bindings/python/tree_sitter_glimmer/__init__.py
  31. +1 −0 bindings/python/tree_sitter_glimmer/__init__.pyi
  32. +27 −0 bindings/python/tree_sitter_glimmer/binding.c
  33. 0 bindings/python/tree_sitter_glimmer/py.typed
  34. +8 −26 bindings/rust/build.rs
  35. +12 −10 bindings/rust/lib.rs
  36. +16 −0 bindings/swift/TreeSitterGlimmer/glimmer.h
  37. +33 −28 grammar.js
  38. +58 −19 package.json
  39. 0 parser/.gitkeep
  40. +2,783 −0 pnpm-lock.yaml
  41. +29 −0 pyproject.toml
  42. +5 −0 queries/glimmer/folds.scm
  43. +117 −0 queries/glimmer/highlights.scm
  44. +34 −0 queries/glimmer/indents.scm
  45. +21 −0 queries/glimmer/injections.scm
  46. +9 −0 queries/glimmer/locals.scm
  47. +0 −88 queries/highlights.scm
  48. +31 −0 scripts/ci-install.sh
  49. +451 −0 scripts/format-queries.lua
  50. +57 −0 setup.py
  51. +1 −2 src/grammar.json
  52. +865 −543 src/parser.c
  53. +0 −3 src/scanner.c
  54. +54 −0 src/tree_sitter/alloc.h
  55. +290 −0 src/tree_sitter/array.h
  56. +55 −13 src/tree_sitter/parser.h
  57. +1 −5 test/corpus/comments.txt
  58. +26 −0 test/corpus/element.txt
  59. +12 −0 test/highlight/highlights.hbs
  60. +0 −646 yarn.lock
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
14 changes: 0 additions & 14 deletions .github/workflows/auto-merge.yml

This file was deleted.

69 changes: 69 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: CI

on:
push:
branches:
- master
- main
paths:
- grammar.js
- src/**
- test/**
- bindings/**
- binding.gyp
- .github/workflows/ci.yml
pull_request:
paths:
- grammar.js
- src/**
- test/**
- bindings/**
- binding.gyp
- .github/workflows/ci.yml

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

jobs:
test:
name: Test parser
runs-on: ${{matrix.os}}
if: >-
!github.event.repository.is_template &&
github.event.head_commit.message != 'Initial commit'
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-14]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up tree-sitter
uses: tree-sitter/setup-action/cli@v1
- name: Run tests
uses: tree-sitter/parser-test-action@v2
with:
# We don't support rust bundling for now
test-rust: false
# test-rust: ${{runner.os == 'Linux'}}
fuzz:
name: Fuzz scanner
runs-on: ubuntu-latest
if: >-
!github.event.repository.is_template &&
github.event.head_commit.message != 'Initial commit'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check for scanner changes
id: scanner-check
shell: sh
run: |-
{
test -f src/scanner.c && ! git diff --quiet HEAD^ -- "$_" &&
printf 'changed=true\n' || printf 'changed=false\n'
} >> "$GITHUB_OUTPUT"
- name: Run fuzzer
uses: tree-sitter/fuzz-action@v4
if: steps.scanner-check.outputs.changed == 'true'
37 changes: 0 additions & 37 deletions .github/workflows/docs.yml

This file was deleted.

42 changes: 42 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Linting

on:
pull_request:
push:
branches:
- master
- main

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

jobs:
js:
name: "JavaScript"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm install
- run: npm exec prettier --check .

format-queries:
name: Queries
runs-on: ubuntu-latest
env:
NVIM_TAG: nightly
# NVIM_TAG: stable
steps:
- uses: actions/checkout@v4
- name: Prepare
run: |
bash ./scripts/ci-install.sh
- name: Lint
run: |
nvim --version
nvim --headless -c "TSInstallSync query" -c "q"
nvim -l scripts/format-queries.lua
git diff --exit-code
90 changes: 90 additions & 0 deletions .github/workflows/plan-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Release Plan Review
on:
push:
branches:
- main
- master
pull_request_target: # This workflow has permissions on the repo, do NOT run code from PRs in this workflow. See https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
types:
- labeled
- unlabeled

concurrency:
group: plan-release # only the latest one of these should ever be running
cancel-in-progress: true

jobs:
check-plan:
name: "Check Release Plan"
runs-on: ubuntu-latest
outputs:
command: ${{ steps.check-release.outputs.command }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: 'main'
# This will only cause the `check-plan` job to have a "command" of `release`
# when the .release-plan.json file was changed on the last commit.
- id: check-release
run: if git diff --name-only HEAD HEAD~1 | grep -w -q ".release-plan.json"; then echo "command=release"; fi >> $GITHUB_OUTPUT

prepare_release_notes:
name: Prepare Release Notes
runs-on: ubuntu-latest
timeout-minutes: 5
needs: check-plan
permissions:
contents: write
issues: read
pull-requests: write
outputs:
explanation: ${{ steps.explanation.outputs.text }}
# only run on push event if plan wasn't updated (don't create a release plan when we're releasing)
# only run on labeled event if the PR has already been merged
if: (github.event_name == 'push' && needs.check-plan.outputs.command != 'release') || (github.event_name == 'pull_request_target' && github.event.pull_request.merged == true)

steps:
- uses: actions/checkout@v4
# We need to download lots of history so that
# github-changelog can discover what's changed since the last release
with:
fetch-depth: 0
ref: 'main'
- uses: actions/setup-node@v4
with:
node-version: 18
- uses: pnpm/action-setup@v4
- run: pnpm install --frozen-lockfile
- name: "Generate Explanation and Prep Changelogs"
id: explanation
run: |
set +e
pnpm release-plan prepare 2> >(tee -a release-plan-stderr.txt >&2)
if [ $? -ne 0 ]; then
echo 'text<<EOF' >> $GITHUB_OUTPUT
cat release-plan-stderr.txt >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
else
echo 'text<<EOF' >> $GITHUB_OUTPUT
jq .description .release-plan.json -r >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
rm release-plan-stderr.txt
fi
env:
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}

- uses: peter-evans/create-pull-request@v6
with:
commit-message: "Prepare Release using 'release-plan'"
labels: "internal"
branch: release-preview
title: Prepare Release
body: |
This PR is a preview of the release that [release-plan](https://github.com/embroider-build/release-plan) has prepared. To release you should just merge this PR 👍
-----------------------------------------
${{ steps.explanation.outputs.text }}
58 changes: 58 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# For every push to the master branch, this checks if the release-plan was
# updated and if it was it will publish stable npm packages based on the
# release plan

name: Publish Stable

on:
workflow_dispatch:
push:
branches:
- main
- master

concurrency:
group: publish-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
check-plan:
name: "Check Release Plan"
runs-on: ubuntu-latest
outputs:
command: ${{ steps.check-release.outputs.command }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: 'main'
# This will only cause the `check-plan` job to have a result of `success`
# when the .release-plan.json file was changed on the last commit. This
# plus the fact that this action only runs on main will be enough of a guard
- id: check-release
run: if git diff --name-only HEAD HEAD~1 | grep -w -q ".release-plan.json"; then echo "command=release"; fi >> $GITHUB_OUTPUT

publish:
name: "NPM Publish"
runs-on: ubuntu-latest
needs: check-plan
if: needs.check-plan.outputs.command == 'release'
permissions:
contents: write
pull-requests: write

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
# This creates an .npmrc that reads the NODE_AUTH_TOKEN environment variable
registry-url: 'https://registry.npmjs.org'
- uses: pnpm/action-setup@v4
- run: pnpm install --frozen-lockfile
- name: npm publish
run: pnpm release-plan publish
env:
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
19 changes: 19 additions & 0 deletions .github/workflows/regenerate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Regenerate parser

on:
pull_request:

permissions:
contents: write
pull-requests: write

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

jobs:
regenerate:
uses: tree-sitter/workflows/.github/workflows/regenerate.yml@main
if: >-
!github.event.repository.is_template &&
github.actor == 'dependabot[bot]'
Loading