-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
27ea566
commit df1a576
Showing
94 changed files
with
98,354 additions
and
96,151 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
resources/language-metavariables/tree-sitter-php/.eslintrc.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module.exports = { | ||
'env': { | ||
'commonjs': true, | ||
'es2021': true, | ||
}, | ||
'extends': 'google', | ||
'overrides': [ | ||
], | ||
'parserOptions': { | ||
'ecmaVersion': 'latest', | ||
'sourceType': 'module', | ||
}, | ||
'rules': { | ||
'indent': ['error', 2, {'SwitchCase': 1}], | ||
'max-len': [ | ||
'error', | ||
{'code': 120, 'ignoreComments': true, 'ignoreUrls': true, 'ignoreStrings': true}, | ||
], | ||
}, | ||
}; |
12 changes: 12 additions & 0 deletions
12
resources/language-metavariables/tree-sitter-php/.gitattributes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
* text=auto eol=lf | ||
|
||
/src/** linguist-vendored | ||
/examples/* linguist-vendored | ||
|
||
src/grammar.json linguist-generated | ||
src/node-types.json linguist-generated | ||
src/parser.c linguist-generated | ||
|
||
src/grammar.json -diff | ||
src/node-types.json -diff | ||
src/parser.c -diff |
59 changes: 59 additions & 0 deletions
59
resources/language-metavariables/tree-sitter-php/.github/ISSUE_TEMPLATE/bug_report.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Bug Report | ||
description: File a bug or issue | ||
title: "bug: " | ||
labels: [bug] | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: | | ||
**Before** reporting an issue, make sure to search [existing issues](https://github.com/tree-sitter/tree-sitter-php/issues). Usage questions such as ***"How do I...?"*** either belong in [Discussions](https://github.com/tree-sitter/tree-sitter/discussions) upstream or in our [Discord server](https://discord.gg/w7nTvsVJhm) and will be closed. | ||
If your issue is related to a bug in your editor-experience because your editor *leverages* tree-sitter and this parser, then it is likely your issue does *NOT* belong here and belongs in the relevant editor's repository. | ||
- type: checkboxes | ||
attributes: | ||
label: Did you check existing issues? | ||
description: Make sure you've checked all of the below before submitting an issue | ||
options: | ||
- label: I have read all the [tree-sitter docs](https://tree-sitter.github.io/tree-sitter/using-parsers) if it relates to using the parser | ||
required: false | ||
- label: I have searched the existing issues of tree-sitter-php | ||
required: true | ||
- type: input | ||
attributes: | ||
label: "Tree-Sitter CLI Version, if relevant (output of `tree-sitter --version`)" | ||
placeholder: "tree-sitter 0.20.8 (6bbb50bef8249e6460e7d69e42cc8146622fa4fd)" | ||
validations: | ||
required: false | ||
- type: textarea | ||
attributes: | ||
label: Describe the bug | ||
description: A clear and concise description of what the bug is. Please include any related errors you see such as parsing errors or tree-sitter cli errors. | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: Steps To Reproduce/Bad Parse Tree | ||
description: Steps to reproduce the behavior. If you have a bad parse tree, please include it here. You can get this by running `tree-sitter parse <path-to-file>` and copying the output. | ||
placeholder: | | ||
1. | ||
2. | ||
3. | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: Expected Behavior/Parse Tree | ||
description: A concise description of what you expected to happen, or in the case of a bad parse tree, the expected parse tree. | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: Repro | ||
description: Minimal code to reproduce this issue. Ideally this should be reproducible with the C library or the tree-sitter cli, do not suggest an editor or external tool. | ||
value: | | ||
// Example code that causes the issue | ||
function foo() { | ||
// Code that fails to parse, or causes an error | ||
} | ||
render: PHP | ||
validations: | ||
required: false |
1 change: 1 addition & 0 deletions
1
resources/language-metavariables/tree-sitter-php/.github/ISSUE_TEMPLATE/config.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
blank_issues_enabled: false |
36 changes: 36 additions & 0 deletions
36
resources/language-metavariables/tree-sitter-php/.github/ISSUE_TEMPLATE/feature_request.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Feature Request | ||
description: Suggest a new feature | ||
title: "feature: " | ||
labels: [enhancement] | ||
body: | ||
- type: checkboxes | ||
attributes: | ||
label: Did you check the tree-sitter docs? | ||
description: Make sure you read all the docs before submitting a feature request | ||
options: | ||
- label: I have read all the [tree-sitter docs](https://tree-sitter.github.io/tree-sitter/using-parsers) if it relates to using the parser | ||
required: false | ||
- type: textarea | ||
validations: | ||
required: true | ||
attributes: | ||
label: Is your feature request related to a problem? Please describe. | ||
description: A clear and concise description of what the problem is. Ex. I think the grammar models this rule incorrectly and can be improved, or the scanner can be improved by doing [...], or PHP has officially added a new feature that should be added to the grammar. | ||
- type: textarea | ||
validations: | ||
required: true | ||
attributes: | ||
label: Describe the solution you'd like | ||
description: A clear and concise description of what you want to happen. | ||
- type: textarea | ||
validations: | ||
required: true | ||
attributes: | ||
label: Describe alternatives you've considered | ||
description: A clear and concise description of any alternative solutions or features you've considered. | ||
- type: textarea | ||
validations: | ||
required: false | ||
attributes: | ||
label: Additional context | ||
description: Add any other context or screenshots about the feature request here. If your feature request is related to a new PHP feature, please include a link to the relevant **official** PHP documentation. |
8 changes: 8 additions & 0 deletions
8
resources/language-metavariables/tree-sitter-php/.github/pull_request_template.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Checklist | ||
|
||
- [ ] All tests pass in CI | ||
- [ ] There are enough tests for the new fix/feature | ||
- [ ] Grammar rules have not been renamed unless absolutely necessary (x rules renamed) | ||
- [ ] The conflicts section hasn't grown too much (x new conflicts) | ||
- [ ] The parser size hasn't grown too much (master: STATE_COUNT, PR: STATE_COUNT) | ||
(check the value of STATE_COUNT in src/parser.c) |
37 changes: 37 additions & 0 deletions
37
resources/language-metavariables/tree-sitter-php/.github/workflows/ci.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [macos-latest, ubuntu-latest] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
- uses: actions/setup-python@v4 | ||
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 | ||
with: | ||
node-version: 18 | ||
- run: npm install | ||
- run: npm test |
19 changes: 19 additions & 0 deletions
19
resources/language-metavariables/tree-sitter-php/.github/workflows/lint.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Lint | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- "**" | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install modules | ||
run: npm install | ||
- name: Run ESLint | ||
run: npm run lint |
103 changes: 103 additions & 0 deletions
103
resources/language-metavariables/tree-sitter-php/.github/workflows/release.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["CI"] | ||
branches: | ||
- master | ||
types: | ||
- completed | ||
|
||
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 }}" | ||
- 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 }}" |
47 changes: 15 additions & 32 deletions
47
resources/language-metavariables/tree-sitter-php/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,21 @@ | ||
# Rust artifacts | ||
Cargo.lock | ||
target/ | ||
|
||
# Node artifacts | ||
build/ | ||
prebuilds/ | ||
node_modules/ | ||
*.tgz | ||
|
||
# Swift artifacts | ||
node_modules | ||
build | ||
package-lock.json | ||
/target/ | ||
.build/ | ||
|
||
# Go artifacts | ||
go.sum | ||
_obj/ | ||
|
||
# Python artifacts | ||
.venv/ | ||
dist/ | ||
*.egg-info | ||
*.whl | ||
|
||
# C artifacts | ||
bindings/c/*.pc | ||
bindings/c/*.h | ||
*.a | ||
*.o | ||
*.so | ||
*.so.* | ||
*.dylib | ||
*.dll | ||
*.pc | ||
|
||
# Example dirs | ||
/examples/*/ | ||
|
||
# Grammar volatiles | ||
*.wasm | ||
*.obj | ||
*.o | ||
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/test | ||
/examples | ||
/build | ||
/script | ||
/target |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.