-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from starkware-libs/lucas/init
Add cairo syntax + queries
- Loading branch information
Showing
41 changed files
with
83,673 additions
and
0 deletions.
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,50 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: ["*"] | ||
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: | ||
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: Set up examples | ||
run: |- | ||
git clone https://github.com/starkware-libs/cairo examples/compiler --single-branch --depth=1 --filter=blob:none | ||
git clone https://github.com/OpenZeppelin/cairo-contracts examples/openzeppelin --single-branch --depth=1 --filter=blob:none | ||
git clone https://github.com/keep-starknet-strange/alexandria examples/alexandria --single-branch --depth=1 --filter=blob:none | ||
- name: Run tests | ||
uses: tree-sitter/parser-test-action@v2 | ||
with: | ||
test-rust: ${{runner.os == 'Linux'}} | ||
- name: Parse examples | ||
uses: tree-sitter/parse-action@v4 | ||
with: | ||
files: examples/**/*.cairo | ||
invalid-files: examples/compiler/crates/cairo-lang-parser/src/parser_test_data/cairo_test_files/*.cairo |
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,21 @@ | ||
name: Fuzz Parser | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
paths: | ||
- src/scanner.c | ||
pull_request: | ||
paths: | ||
- src/scanner.c | ||
|
||
jobs: | ||
fuzz: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Run fuzzer | ||
uses: tree-sitter/fuzz-action@v4 | ||
with: | ||
tree-sitter-version: v0.22.2 |
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,25 @@ | ||
name: Lint | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
paths: | ||
- grammar.js | ||
pull_request: | ||
paths: | ||
- grammar.js | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
cache: npm | ||
- name: Install modules | ||
run: npm ci --legacy-peer-deps | ||
- name: Run ESLint | ||
run: npm run lint |
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,38 @@ | ||
# Rust artifacts | ||
Cargo.lock | ||
target/ | ||
|
||
# Node artifacts | ||
build/ | ||
prebuilds/ | ||
node_modules/ | ||
*.tgz | ||
|
||
# Swift artifacts | ||
.build/ | ||
|
||
# Go artifacts | ||
go.sum | ||
_obj/ | ||
|
||
# Python artifacts | ||
.venv/ | ||
dist/ | ||
*.egg-info | ||
*.whl | ||
|
||
# C artifacts | ||
*.a | ||
*.so | ||
*.so.* | ||
*.dylib | ||
*.dll | ||
*.pc | ||
|
||
# Example dirs | ||
/examples/*/ | ||
|
||
# Grammar volatiles | ||
*.wasm | ||
*.obj | ||
*.o |
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,23 @@ | ||
[package] | ||
name = "tree-sitter-cairo" | ||
description = "Cairo grammar for tree-sitter" | ||
version = "0.0.1" | ||
license = "MIT" | ||
readme = "README.md" | ||
keywords = ["incremental", "parsing", "tree-sitter", "cairo"] | ||
categories = ["parsing", "text-editors"] | ||
repository = "https://github.com/tree-sitter/tree-sitter-cairo" | ||
edition = "2021" | ||
autoexamples = false | ||
|
||
build = "bindings/rust/build.rs" | ||
include = ["bindings/rust/*", "grammar.js", "queries/*", "src/*"] | ||
|
||
[lib] | ||
path = "bindings/rust/lib.rs" | ||
|
||
[dependencies] | ||
tree-sitter = ">=0.22.6" | ||
|
||
[build-dependencies] | ||
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.