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.15.tar.gz (245.4 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.15-cp310-abi3-win_arm64.whl (91.9 kB view details)

Uploaded CPython 3.10+Windows ARM64

tree_sitter_zeek-0.2.15-cp310-abi3-win_amd64.whl (96.3 kB view details)

Uploaded CPython 3.10+Windows x86-64

tree_sitter_zeek-0.2.15-cp310-abi3-musllinux_1_2_x86_64.whl (102.9 kB view details)

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

tree_sitter_zeek-0.2.15-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (146.3 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

tree_sitter_zeek-0.2.15-cp310-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (111.9 kB view details)

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

tree_sitter_zeek-0.2.15-cp310-abi3-macosx_11_0_arm64.whl (98.1 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

tree_sitter_zeek-0.2.15-cp310-abi3-macosx_10_9_x86_64.whl (90.0 kB view details)

Uploaded CPython 3.10+macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: tree_sitter_zeek-0.2.15.tar.gz
  • Upload date:
  • Size: 245.4 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.15.tar.gz
Algorithm Hash digest
SHA256 bf0363253912136d199a9255b30a23105d8e1c5376c54f886821ef417f197090
MD5 bdd32e5cbb94048740cde4f2d3b5bd34
BLAKE2b-256 a3be06e661af32acc3652f55ed5895136793712ba622d9fe20143d63076bbf60

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_zeek-0.2.15-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 de8e9e0310949b7feee6da4f523b168b8260627e4fb72c0fedafbd9aa9488f16
MD5 31cf5cf3db357cc68ee5794523501b3b
BLAKE2b-256 8ba574135d049233fd0de973b6f3e61b30f7e225c40fa050d54deb5e131f36b8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_zeek-0.2.15-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 cf47fb915208658f7c7ea00c2ee3fd3fb9b82bee717ad8cdd9a26e33e563c49b
MD5 69c9ec37dc0fa5ba7fa7c394346974a4
BLAKE2b-256 8ede63cb26b75217c03892041291806b0c04c3407d354d40d1227c5f9a780859

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_zeek-0.2.15-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d91a3680d376bad0f6b7b51f96917a9384ba6f046a15a8e1bde1b05757eef5ed
MD5 bc38876268f2f6bbab94a5a0bc8a748e
BLAKE2b-256 63777d37fb2e9b097dda1848bac98b483e175f6322199f9c7627405be9154971

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_zeek-0.2.15-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 86476681594cfd25c117c99045ce5066c747a3a95621a50b1117fa72bc61eb91
MD5 ffd3fad832f17948850e02d8746bb66d
BLAKE2b-256 783922add28bacd859bf6f05e25e4b1aa02075be2f5b5b412ec60bbb8a3b096a

See more details on using hashes here.

File details

Details for the file tree_sitter_zeek-0.2.15-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.15-cp310-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b3389d8038ea69a7d25bbff42e85ab8e9fe88cafb8298018f316cfbfc84acb82
MD5 055165c24efc3e0f8aa7f68b0a1f293b
BLAKE2b-256 f4ddc2966d71aea92668c1fd9aa78b521a366c7f4998c555a19ea56e0aea7943

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_zeek-0.2.15-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 61139ef87144c76c2e48cb8e7128148b2d05d685f6aa04e83bf76c2021f1d99f
MD5 1f52858e25547efcfa666548a3606cf3
BLAKE2b-256 9f22e9dd2039763cfce3e5b99a7613ca7f5ce7c33475c6792d0f3a5a3d192b26

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_zeek-0.2.15-cp310-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 781566d566617627794ff483d3a613c05b15ece7cffa2a6d2262e8dc09df9e32
MD5 4fb874723e2e6babd82542fd25bb0288
BLAKE2b-256 3a99e2426b0723b1eef0a506c14df0ba3f87f2324a6b35557b865e197730fbf2

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