Pact grammar for tree-sitter
Project description
tree-sitter-pact
tree-sitter grammar for pact smart contract language
Neovim setup (WIP)
I will create a PR to add this to the official nvim-treesitter repo once it's ready, for now you can use it by following these steps:
Clone the repo
git clone https://github.com/kadena-community/tree-sitter-pact.git
Add those to your init.lua
vim.filetype.add({
extension = {
pact = "pact",
repl = "pact",
},
})
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.pact = {
install_info = {
url = "~/path/to/c/tree-sitter-pact",
files = { "src/parser.c" },
},
filetype = "pact",
}
Then run :TSInstall pact in neovim.
also you need to link the queries folder to your nvim config folder
mkdir -p ~/.config/nvim/after/queries/pact
ln ./queries/highlights.scm ~/.config/nvim/after/queries/pact/highlights.scm
ln ./queries/locals.scm ~/.config/nvim/after/queries/pact/locals.scm
ln ./queries/textobjects.scm ~/.config/nvim/after/queries/pact/textobjects.scm
ln ./queries/folds.scm ~/.config/nvim/after/queries/pact/folds.scm
ln ./queries/indents.scm ~/.config/nvim/after/queries/pact/indents.scm
Testing
To run the tests for the core grammar, you need to have tree-sitter-cli installed. You can install it with npm:
npm install -g tree-sitter-cli
Then, run the following command from the root of the repository:
npx tree-sitter generate && npx tree-sitter build && npx tree-sitter test
Language Bindings
To run the tests for the language bindings, you will need to have the respective toolchains installed (e.g., Python, Go, Swift, Rust).
-
Rust:
cargo test
-
Swift:
swift test
-
Go:
cd bindings/go go get -t go test -v
-
Python: First, create and activate a virtual environment:
python -m venv .venv source .venv/bin/activate
Then, install the package in editable mode with its core dependencies:
pip install -e ".[core]"
Finally, run the tests:
python -m unittest discover -v -s bindings/python/tests
-
Nodejs
node bindings/node/binding_test.js // or npm run test
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tree_sitter_pact-0.0.10.tar.gz.
File metadata
- Download URL: tree_sitter_pact-0.0.10.tar.gz
- Upload date:
- Size: 45.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4944eb5ed09f7a94377d2e200ab14a22ebdcdfe1aa30de457e2d2412f4be3979
|
|
| MD5 |
e83020ca876a7ecf3c60d7f60e8b8901
|
|
| BLAKE2b-256 |
03ebc82e027a97b1ceed990457d840350fb2a7226aff92cb0d73c385b62540f4
|
File details
Details for the file tree_sitter_pact-0.0.10-cp310-abi3-win_arm64.whl.
File metadata
- Download URL: tree_sitter_pact-0.0.10-cp310-abi3-win_arm64.whl
- Upload date:
- Size: 29.1 kB
- Tags: CPython 3.10+, Windows ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c71c08f88d021a570889b48d34537d51aa165f6198adb46075ebc74ce0f96335
|
|
| MD5 |
6efab9c5400fbb7c408fb9a891e69b59
|
|
| BLAKE2b-256 |
5cb6536910fb5b3d8020d11513c961ed4a3dd2639a60fec8a341bce51d9c91cf
|
File details
Details for the file tree_sitter_pact-0.0.10-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: tree_sitter_pact-0.0.10-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 30.7 kB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11ac3e948d392aaab62eb9921283c386b42be0a18b056abf1bf55183ff25a76a
|
|
| MD5 |
5dd9baec2f9caf6afbc53cb36214631f
|
|
| BLAKE2b-256 |
42295fbcd9418f6b0dfaf31dd06084e20913782c3e7bd426f41c596cd380e3bc
|
File details
Details for the file tree_sitter_pact-0.0.10-cp310-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: tree_sitter_pact-0.0.10-cp310-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 48.3 kB
- Tags: CPython 3.10+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29ff4c1dfe9eff02ba440a622171e51471fdd451281cfa226330dcc227786786
|
|
| MD5 |
bc8684332a6a02c798ad0c5a252edefb
|
|
| BLAKE2b-256 |
6a6c05faf9e10cd023a69e19ddb27b253542447fafe2a04219045f88bbfb14f9
|
File details
Details for the file tree_sitter_pact-0.0.10-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: tree_sitter_pact-0.0.10-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 50.8 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9c23f74c8ac5905bdf582b6c5f1e2f70a05d9ba51d8925ed86d59e38e1a5a15
|
|
| MD5 |
e64736a86304061ccc0c051b9c18af3c
|
|
| BLAKE2b-256 |
377d130c0583853fd22f21b285af1b7c37d99e137f4f5f42379fc08fd14ba271
|
File details
Details for the file tree_sitter_pact-0.0.10-cp310-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: tree_sitter_pact-0.0.10-cp310-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 49.6 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68aa546ba3b8b6588da1e0a752c3792cd42c3e5a641ae13d725be84040f9abff
|
|
| MD5 |
f645491499142a32f797512ad94be34b
|
|
| BLAKE2b-256 |
c68d8c1d9e54dbd18fbd9a7742d681c29b4ef5e641d6182a7671fa70863a27bb
|
File details
Details for the file tree_sitter_pact-0.0.10-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: tree_sitter_pact-0.0.10-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 28.2 kB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa177fcc15c6c74014ccc1dbe6fd22f033df905b6e4074682489916689894f9c
|
|
| MD5 |
cc35758ac68faa4fa7adeb929fb54974
|
|
| BLAKE2b-256 |
59d5c1773f16e2a3b35a78bec51a26841b4f1b892837c83a14d36bef7123087a
|
File details
Details for the file tree_sitter_pact-0.0.10-cp310-abi3-macosx_10_9_x86_64.whl.
File metadata
- Download URL: tree_sitter_pact-0.0.10-cp310-abi3-macosx_10_9_x86_64.whl
- Upload date:
- Size: 27.7 kB
- Tags: CPython 3.10+, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad28c6d6d04aec87195bf0299a0e159026b70ca0fb33a86cb79291686dec5089
|
|
| MD5 |
ccc578e503a30ee29d882e3e63b19e95
|
|
| BLAKE2b-256 |
b5d9626192d32392b2a38dae5c6b73cc4fe31eb6eb7008ddd6fc812a624812bd
|