Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tree-sitter-cylc

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tree-sitter-cylc

Cylc grammar for tree-sitter

  • 0.2.0
  • PyPI
  • Socket score

Maintainers
1

tree-sitter-cylc

CI pypi License: MIT

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

MIT

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc