- Notifications
You must be signed in to change notification settings - Fork3
A tree-sitter grammar for the Zeek scripting language
License
zeek/tree-sitter-zeek
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
AZeek grammar fortree-sitter.
This grammar parses scripts written in theZeek scriptinglanguage.
The goal of this grammar is to facilitate tooling around Zeekscripts. For that reason, its structure resembles Zeek's grammar but differs ina number of ways. For example, it tracks newlines explicitly and relies morestrongly on precedence and associativity to resolve ambiguities. Like Zeek'sparser, this one currently doesn't name symbols deeply: for example, the grammarfeatures anexpr
rule that covers any kind of expression, but the choicesaren't currently broken down into, say,addition_expr
,or_expr
, andsimilars.
To use the generated parser directly (e.g. via any of tree-sitter'slanguage bindings),clone this repository recursively. We maintain a separategit repositoryto track generated sources. You do not need the tree-sitter CLIto use those sources in your tooling, but you'll likely want itanyway to explore the parser. For example,tree-sitter parse <script>
produces the script's syntax tree, andtree-sitter highlight <script>
shows syntax-highlighted sources.
- Installtree-sitter on your machine.
- Generate the parser: run
tree-sitter generate
.
There's currently notree-sitter test
testsuite. Instead, a test driver runsthe parser on every Zeek script in the Zeek distribution, reporting anyerrors. For CI, a Github Action workflow additionally clones the Zeek tree priorto running this test, to ensure that those Zeek scripts are available.
To release a new version manually update the version number in the followingecosystem-specific files:
package.json
: keyversion
package-lock.json
: updatepackage.json
and runnpm install
to update the lock file.
pyproject.toml
: keyproject.version
Cargo.toml
: keypackage.version
tree-sitter.json
: keymetadata.version
CMakeLists.txt
:VERSION
inproject
call
Once all versions are consistently updated create a version tagvX.Y.Z
andpush it. We trigger automatic publishing of releases for all tags.
About
A tree-sitter grammar for the Zeek scripting language