-
Notifications
You must be signed in to change notification settings - Fork 4
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
add CI workflow, and update tree-sitter #4
Merged
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
5a40dc6
add CI workflow
erik-krogh f4e1a94
use the reference tree-sitter workflow
erik-krogh 6ba05ac
trigger the workflow on workflow changes
erik-krogh b66431c
just trigger the CI all the time
erik-krogh 9f9f216
try to update package.json with build-script etc.
erik-krogh 60945c5
update tree-sitter and generate the new files
erik-krogh d4d11ad
re-generate Rust files
erik-krogh 5d93fa4
get Swift tests to actually work, because the Swift files generated b…
erik-krogh 39e1599
name the grammar ql_dbscheme, and re-generate everything
erik-krogh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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,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 |
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,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 |
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,62 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- "**" | ||
push: | ||
branches: | ||
- "main" | ||
|
||
concurrency: | ||
group: ${{github.workflow}}-${{github.ref}} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test: | ||
name: Test parser | ||
runs-on: ${{matrix.os}} | ||
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 parser and binding tests | ||
uses: tree-sitter/parser-test-action@v2 | ||
with: | ||
test-rust: ${{runner.os == 'Linux'}} | ||
test-swift: ${{runner.os == 'macOS'}} | ||
- name: Parse sample files | ||
uses: tree-sitter/parse-action@v4 | ||
id: parse-files | ||
with: | ||
files: examples/** | ||
- name: Upload failures artifact | ||
uses: actions/upload-artifact@v4 | ||
if: "!cancelled() && steps.parse-files.outcome == 'failure'" | ||
with: | ||
name: failures-${{runner.os}} | ||
path: ${{steps.parse-files.outputs.failures}} | ||
fuzz: | ||
name: Fuzz scanner | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 | ||
- name: Check for scanner changes | ||
id: scanner-check | ||
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: Run the fuzzer | ||
uses: tree-sitter/fuzz-action@v4 | ||
if: steps.scanner-check.outputs.changed == 'true' |
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,3 @@ | ||
node_modules/ | ||
build/ | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,23 @@ | ||
[package] | ||
name = "tree-sitter-ql-dbscheme" | ||
description = "ql dbscheme grammar for the tree-sitter parsing library" | ||
name = "tree-sitter-dbscheme" | ||
description = "Dbscheme grammar for tree-sitter" | ||
version = "0.0.1" | ||
keywords = ["incremental", "parsing", "ql"] | ||
categories = ["parsing", "text-editors"] | ||
repository = "https://github.com/tausbn/tree-sitter-ql-dbscheme" | ||
edition = "2018" | ||
license = "MIT" | ||
readme = "README.md" | ||
keywords = ["incremental", "parsing", "tree-sitter", "dbscheme"] | ||
categories = ["parsing", "text-editors"] | ||
repository = "https://github.com/tree-sitter/tree-sitter-dbscheme" | ||
tausbn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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, < 0.21" | ||
tree-sitter = ">=0.22.5" | ||
|
||
[build-dependencies] | ||
cc = "1.0" | ||
cc = "1.0.87" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this rename. The repo is still called
tree-sitter-ql-dbscheme
, after all.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the parser is. Having the repo named different from the language is not really intended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is because the name in
gammar.js
is wrong. The generate script is copy-pasting from there.I'm fixing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I follow. The parser is what? (Edit: Ah, @erik-krogh's interim answer cleared this up for me.)
Currently, the name of the parser is
tree-sitter-ql-dbscheme
. This is also how the (to my knowledge) only downstream user refers to it.To be clear, I would be happy to see this renamed to
tree-sitter-dbscheme
. The original name contained-ql-
out of an abundance of caution, in case some other user ofdbscheme
was out there.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently the grammar is named
dbscheme
.I cannot change it to
ql-dbscheme
, because then tree-sitter gives me the following error:Error: Grammar's 'name' property must not start with a digit and cannot contain non-word characters.
.What can we do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try underscore instead?
ql_dbscheme
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(To be clear, I'm not saying you're doing it wrong; I'm just pointing out that the tooling is built with different expectations, so you can't trust it blindly if you deviate. You'll just have to postprocess manually.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Underscore seem to work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, a number of other grammars use that trick.