Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
36 changes: 36 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
* text=auto eol=lf

# Generated source files
src/*.json linguist-generated
src/parser.c linguist-generated
src/tree_sitter/* linguist-generated

# C bindings
bindings/c/** linguist-generated
Makefile linguist-generated

# Rust bindings
bindings/rust/* linguist-generated
Cargo.toml linguist-generated
Cargo.lock linguist-generated

# Node.js bindings
bindings/node/* linguist-generated
binding.gyp linguist-generated
package.json linguist-generated
package-lock.json linguist-generated

# Python bindings
bindings/python/** linguist-generated
setup.py linguist-generated
pyproject.toml linguist-generated

# Go bindings
bindings/go/* linguist-generated
go.mod linguist-generated
go.sum linguist-generated

# Swift bindings
bindings/swift/** linguist-generated
Package.swift linguist-generated
Package.resolved linguist-generated
9 changes: 4 additions & 5 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,28 @@ name: Rego TreeSitter parser CI

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

permissions:
contents: write

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]
node-version: [24.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache: "yarn"
- run: yarn
- run: yarn test
- run: |
Expand Down
50 changes: 46 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,47 @@
node_modules
tree-sitter-rego.wasm
build
# Node
node_modules/
*.wasm
.npm

# Build artifacts
build/
static_playground/

# Rust
target/
Cargo.lock

# Swift
.build/
.swiftpm/

# Go
*.test
*.out

# Python
__pycache__/
*.py[cod]
*$py.class
*.egg-info/
dist/
venv/
.pytest_cache/

# C/C++
*.o
*.obj
*.so
*.dylib
*.dll
*.a
*.lib

# Development environment
.direnv/
.vscode/
.idea/
*.swp
*.swo
*~
.DS_Store
static_playground
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.17.0
v24.11.1
6 changes: 3 additions & 3 deletions Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 41 additions & 0 deletions Package.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# 🌳 Tree sitter implementation for rego language
# 🌳 Tree sitter implementation for Rego language

This repository tries to cover the tree-sitter implementation for the [OPA Rego language](https://www.openpolicyagent.org/docs/latest/policy-language/)
This repository tries to cover the tree-sitter implementation for
[OPA's Rego language](https://www.openpolicyagent.org/docs/policy-language/)

You can use [NVM](https://github.com/nvm-sh/nvm) in order to load the Node version used to develop the grammar by issuing `nvm use`
Available scripts
Expand All @@ -14,6 +15,7 @@ Please, verify that your editor supports [EditorConfig plugin](https://editorcon
This repository uses Github Actions, which help verify that the changes submitted can be unit-tested, built and deployed to a [Github Pages](https://fallenangel97.github.io/tree-sitter-rego/)

List of TODO items:

- Introduce more unit tests covering the internal functions
- Add locals.scm

Expand All @@ -28,6 +30,7 @@ This will open locally http://127.0.0.1:8000/, where you can check your rules
directly in the browser

## Local testing in NeoVim

To be able to locally verify the changes - you should modify your `init.lua` file
to point to your locally installed tree-sitter grammar

Expand All @@ -50,6 +53,7 @@ parser_config.rego = {
The live playground is available at: https://fallenangel97.github.io/tree-sitter-rego/

---

Powered by

<a href='https://decodeapps.pp.ua/'><img height="20" src="https://decodeapps.pp.ua/_next/static/media/logo-light.3763f5cc.svg" /></a>
10 changes: 10 additions & 0 deletions bindings/c/tree-sitter-rego.pc.in

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions bindings/c/tree_sitter/tree-sitter-rego.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions bindings/go/binding.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions bindings/go/binding_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions bindings/node/binding_test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions bindings/node/index.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions bindings/node/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions bindings/python/tests/test_binding.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions bindings/python/tree_sitter_rego/__init__.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading