Cylc grammar for tree-sitter
Project description
tree-sitter-cylc
A Tree-Sitter grammar for Cylc's workflow configurations.
References
Syntax Highlighting
As a grammar, tree-sitter-cylc can be used to generate syntax highlighting for Cylc files in text editors that support Tree-Sitter. /queries/highlights.scm
and /queries/injections.scm
can be used as a template to write queries for your target editor.
Supported Editors :
Python Bindings
tree-sitter-cylc is available as a package on PyPi. You can install it through pip:
pip install tree-sitter tree-sitter-cylc
You can then use the tree_sitter_cylc module to parse Cylc files from Python:
import tree_sitter_cylc as tscylc
from tree_sitter import Language, Parser
CYLC_LANGUAGE = Language(tscylc.language())
parser = Parser(CYLC_LANGUAGE)
source_code = str(
"""
[runtime]
[[task_1]]
script = echo "Hello, World!"
"""
)
tree = parser.parse(bytes(source_code, "utf8"))
root_node = tree.root_node
runtime_section = root_node.children[0]
task_section = runtime_section.children[3]
setting = task_section.children[3]
value = setting.child_by_field_name("value")
assert root_node.type == "workflow_configuration"
assert root_node.start_point == (0, 0)
assert root_node.end_point == (4, 0)
assert runtime_section.type == "runtime_section"
assert task_section.type == "task_section"
assert setting.type == "setting"
assert value.type == "unquoted_string"
See Tree-Sitter's Python bindings documentation for more information.
Contributing
Contributions and bug reports are welcome! Please submit a pull request or file an issue on the GitHub repository.
License
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file tree_sitter_cylc-0.2.0.tar.gz
.
File metadata
- Download URL: tree_sitter_cylc-0.2.0.tar.gz
- Upload date:
- Size: 29.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5594d833ea0e78d9e9f06d71a92bb62f33f369d4c94369e962f0b0c95d57b249 |
|
MD5 | 2f7f69576bc3ea7ea8a655a0d4938256 |
|
BLAKE2b-256 | 6fde100b74804d2162c00d6b1122c0591030ce20fc8f509a3daf7fc37829346e |
File details
Details for the file tree_sitter_cylc-0.2.0-cp39-abi3-win_arm64.whl
.
File metadata
- Download URL: tree_sitter_cylc-0.2.0-cp39-abi3-win_arm64.whl
- Upload date:
- Size: 25.5 kB
- Tags: CPython 3.9+, Windows ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79cc41ca16ec59ee50550d72da61ddf1a3fca2387ad2c41115ac5b148864c4a4 |
|
MD5 | ab3906ef5bd740e4f1aaf42ba7a899ef |
|
BLAKE2b-256 | 7da3213b3677c3f37f9348011577cc6edf542ca3a92266fe9a9359e11a69534e |
File details
Details for the file tree_sitter_cylc-0.2.0-cp39-abi3-win_amd64.whl
.
File metadata
- Download URL: tree_sitter_cylc-0.2.0-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 27.1 kB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a66a192015d55b1bdb458be844f5847a15c42d26bdf66e7ae05d73d37db3431e |
|
MD5 | 43bb010fe0d7f61dbdc05f9370b546a5 |
|
BLAKE2b-256 | 584c46a2811b0864b177cef96fbbc6277dab5c53967e151e273ecb780fc2636d |
File details
Details for the file tree_sitter_cylc-0.2.0-cp39-abi3-musllinux_1_2_x86_64.whl
.
File metadata
- Download URL: tree_sitter_cylc-0.2.0-cp39-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 52.6 kB
- Tags: CPython 3.9+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42c7902c24e1cb2d81edcd41c4c4122556123fa29074b97fda7d005d4b3b92a9 |
|
MD5 | c72f890939304666604082e6aa4342e4 |
|
BLAKE2b-256 | 32fa7758a15aa724ef6b9cd0ab008891a2fa9feaff8d762a07c7fce164ec8605 |
File details
Details for the file tree_sitter_cylc-0.2.0-cp39-abi3-musllinux_1_2_aarch64.whl
.
File metadata
- Download URL: tree_sitter_cylc-0.2.0-cp39-abi3-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 55.5 kB
- Tags: CPython 3.9+, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c12126f478820a78643d44a5697cbdc51098be4a41fc6e52a82712b4e2b29d33 |
|
MD5 | cc59be3b0e50203a7928849f0f51fd3e |
|
BLAKE2b-256 | e76aca0dc42810d1ba577bca97cd0847ec4a50692d5148d1ed09940e97191b1b |
File details
Details for the file tree_sitter_cylc-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: tree_sitter_cylc-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 55.2 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74526ec91b02f55409d8869d176cbedaa6b9ac3533ad4b03c0c54efdc02f0d87 |
|
MD5 | 54586ea0a106307fb6adf6f0b5e0b4fa |
|
BLAKE2b-256 | c932859fb738d45b0b477e42f2e3d7d53444d132c34960a204ee9a3774eb7d6b |
File details
Details for the file tree_sitter_cylc-0.2.0-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: tree_sitter_cylc-0.2.0-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 53.1 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19f8faf76a7afb26628541d3de5257f2cb1aa878dcdc581d67900bdfaf1cca19 |
|
MD5 | 96c148e5064f0b2290de14410a45140e |
|
BLAKE2b-256 | 357a1daf75ce01599bd7612304bf891c6badf04be0334310395f3ddae6ca68aa |
File details
Details for the file tree_sitter_cylc-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
.
File metadata
- Download URL: tree_sitter_cylc-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 28.0 kB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 839a44eba8353fce551378773cfc55833bbc02bd956f5ce99aa8cfeff79eccf6 |
|
MD5 | 846ac85032654138f4de87ddbfebc0f7 |
|
BLAKE2b-256 | 8697d961ab06b17c84557ca65d8edd1cd7a8d337d4c7a33e35b7912c9e1d2d59 |
File details
Details for the file tree_sitter_cylc-0.2.0-cp39-abi3-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: tree_sitter_cylc-0.2.0-cp39-abi3-macosx_10_9_x86_64.whl
- Upload date:
- Size: 29.4 kB
- Tags: CPython 3.9+, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8e0b05b16219c737231d600d2d4ad6829fa91a063fdf90495044f0aeb433acd |
|
MD5 | b89cf3ff43c583ed7b4130aee9258b6f |
|
BLAKE2b-256 | 8688e42685b124ae3b5649b2af637fbe5d567ae6ba2938a469d502eccc2b661a |