Skip to main content

Zeek grammar for tree-sitter

Project description

tree-sitter-zeek

Tests

A Zeek grammar for tree-sitter.

Background

This grammar parses scripts written in the Zeek scripting language.

The goal of this grammar is to facilitate tooling around Zeek scripts. For that reason, its structure resembles Zeek's grammar but differs in a number of ways. For example, it tracks newlines explicitly and relies more strongly on precedence and associativity to resolve ambiguities. Like Zeek's parser, this one currently doesn't name symbols deeply: for example, the grammar features an expr rule that covers any kind of expression, but the choices aren't currently broken down into, say, addition_expr, or_expr, and similars.

Usage

To use the generated parser directly (e.g. via any of tree-sitter's language bindings), clone this repository recursively. We maintain a separate git repository to track generated sources. You do not need the tree-sitter CLI to use those sources in your tooling, but you'll likely want it anyway to explore the parser. For example, tree-sitter parse <script> produces the script's syntax tree, and tree-sitter highlight <script> shows syntax-highlighted sources.

Building the parser

  • Install tree-sitter on your machine.
  • Generate the parser: run tree-sitter generate.

Testing

There's currently no tree-sitter test testsuite. Instead, a test driver runs the parser on every Zeek script in the Zeek distribution, reporting any errors. For CI, a Github Action workflow additionally clones the Zeek tree prior to running this test, to ensure that those Zeek scripts are available.

Releasing a new version

To release a new version update the version number in the following ecosystem-specific files:

  • package.json: key version
    • package-lock.json: update package.json and run npm install to update the lock file.
  • pyproject.toml: key project.version
  • Cargo.toml: key package.version

Once all versions are consistently updated create a version tag vX.Y.Z and push it. We trigger automatic publishing of releases for all tags.

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

tree-sitter-zeek-0.1.1.tar.gz (199.7 kB view hashes)

Uploaded Source

Built Distributions

tree_sitter_zeek-0.1.1-cp38-abi3-win_amd64.whl (86.0 kB view hashes)

Uploaded CPython 3.8+ Windows x86-64

tree_sitter_zeek-0.1.1-cp38-abi3-musllinux_1_2_x86_64.whl (91.6 kB view hashes)

Uploaded CPython 3.8+ musllinux: musl 1.2+ x86-64

tree_sitter_zeek-0.1.1-cp38-abi3-musllinux_1_2_aarch64.whl (91.3 kB view hashes)

Uploaded CPython 3.8+ musllinux: musl 1.2+ ARM64

tree_sitter_zeek-0.1.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (132.4 kB view hashes)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ARM64

tree_sitter_zeek-0.1.1-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (97.6 kB view hashes)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

tree_sitter_zeek-0.1.1-cp38-abi3-macosx_11_0_arm64.whl (89.1 kB view hashes)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

tree_sitter_zeek-0.1.1-cp38-abi3-macosx_10_9_x86_64.whl (82.1 kB view hashes)

Uploaded CPython 3.8+ macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page