Skip to main content

Zeek grammar for tree-sitter

Project description

tree-sitter-zeek

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. Generated sources are tracked in the src directory. 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

You can find the tests in test. This contains a separater corpus directory for tests with tree-sitter test. You can update the baselines with tree-sitter test -u.

There is also a script called parse-zeek-tree.sh which runs the parser on every Zeek script in the Zeek distribution, reporting any errors.

Releasing a new version

To release a new version manually 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
  • tree-sitter.json: key metadata.version
  • CMakeLists.txt: VERSION in project call

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.2.14.tar.gz (242.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tree_sitter_zeek-0.2.14-cp310-abi3-win_arm64.whl (91.8 kB view details)

Uploaded CPython 3.10+Windows ARM64

tree_sitter_zeek-0.2.14-cp310-abi3-win_amd64.whl (96.1 kB view details)

Uploaded CPython 3.10+Windows x86-64

tree_sitter_zeek-0.2.14-cp310-abi3-musllinux_1_2_x86_64.whl (102.8 kB view details)

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

tree_sitter_zeek-0.2.14-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (146.0 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

tree_sitter_zeek-0.2.14-cp310-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (111.8 kB view details)

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

tree_sitter_zeek-0.2.14-cp310-abi3-macosx_11_0_arm64.whl (98.0 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

tree_sitter_zeek-0.2.14-cp310-abi3-macosx_10_9_x86_64.whl (89.9 kB view details)

Uploaded CPython 3.10+macOS 10.9+ x86-64

File details

Details for the file tree_sitter_zeek-0.2.14.tar.gz.

File metadata

  • Download URL: tree_sitter_zeek-0.2.14.tar.gz
  • Upload date:
  • Size: 242.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tree_sitter_zeek-0.2.14.tar.gz
Algorithm Hash digest
SHA256 cdb0caf0313909d83d4ccb7b57b3e25485a1fadfe38dce1fc06501866225e6ac
MD5 1e74e31767bc17662b317bb71b1bed8b
BLAKE2b-256 a71cd7c44a80eead0328fc1283422c0b454faf09bc1b386bcd007e39e0ba066d

See more details on using hashes here.

File details

Details for the file tree_sitter_zeek-0.2.14-cp310-abi3-win_arm64.whl.

File metadata

File hashes

Hashes for tree_sitter_zeek-0.2.14-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 373bc5cffaccbbb46693aa0d8df7fdd696ecb283d022c84b40129568109c1aa6
MD5 0bdbac3e900929c83e28bc9d70ff679e
BLAKE2b-256 c8dbfb7ec023a9efb936a75f7228e828b819be0ca50fae88e5e949296b6d1341

See more details on using hashes here.

File details

Details for the file tree_sitter_zeek-0.2.14-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for tree_sitter_zeek-0.2.14-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 9c5ec0939dfcbd76d98412292f6dc42d66df0122222ea2bcd9164e460ae2b74b
MD5 6bc67109afa0aec2a38be51eb4d8adbd
BLAKE2b-256 9279e55024214e7d99fb993997e35a4ddf0ce5d9d2ad34fde43fd8ff2683d3bf

See more details on using hashes here.

File details

Details for the file tree_sitter_zeek-0.2.14-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_zeek-0.2.14-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ae8e45823b7bdd545f2639f69eab3696588cc8624415b1aa6fdf4d253755e10d
MD5 88a1594790b9fa654fb39151741adee8
BLAKE2b-256 22aaf73fd794ddcb7aeb458ee20d2a39fbbd3c77218aa55a6de3041a30ce17c5

See more details on using hashes here.

File details

Details for the file tree_sitter_zeek-0.2.14-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for tree_sitter_zeek-0.2.14-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 391da0fe4b5eb9264cc535e5ba44b3772cca7d725aa0c209f6dfccafedeb1f24
MD5 3ff8511057e84830076e3824f595370f
BLAKE2b-256 0849ca0ffd98b1898a87c23f60c4732025035e67251320ea2622b4af5a156d28

See more details on using hashes here.

File details

Details for the file tree_sitter_zeek-0.2.14-cp310-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_zeek-0.2.14-cp310-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 960a32e383a2e564c25c151e33971dfa97be3e934ee6519178e3826e570ebf33
MD5 0aad5dd1c61fe0f75eab6479389bdb60
BLAKE2b-256 c9851bb16dcb42622d65184ac898a9f64c6a2409ba0b7ca32ed1f82a7de6edad

See more details on using hashes here.

File details

Details for the file tree_sitter_zeek-0.2.14-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tree_sitter_zeek-0.2.14-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 323f9ef5d1a2e9629e98b92a2533bbf600378403bf206a0d3b16304814a3e46a
MD5 2e1eea7f151cfdb0b1112757d672210b
BLAKE2b-256 8a3359ad88d9f52d7036d09120c463efe7a77b0fcbcaa79165bb319774f835b2

See more details on using hashes here.

File details

Details for the file tree_sitter_zeek-0.2.14-cp310-abi3-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_zeek-0.2.14-cp310-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5e3f951d216541563d830e5c9a1ae55b74f2175d404e32c7f130af5a9111a9b8
MD5 94d3b6575b71ff472784b4b8e36f8e3c
BLAKE2b-256 ccd5d5e498997e8d2408095f2f77b08e9ef7208225d8d216d616a49f8438cc23

See more details on using hashes here.

Supported by

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