Tree-sitter TQL π³

This repository hosts the tree-sitter grammar for TQL, the Tenzir Query
Language.
Features:
- π Complete syntax support for TQL pipelines, operators, and expressions
- π Proper handling of significant newlines and pipe separators
- π’ Support for all TQL literal types, including strings, numbers, IP addresses,
and durations
- π Control flow structures, including
if, else, and match
- π¦ Module paths and function calls
- π¬ Line and block comments
- π§ Tree-sitter queries for highlights, indentation, folds, injections, and locals
Usage
See the official Tenzir documentation for editor setup instructions:
Set up syntax highlighting.
Development
Contributions are welcome! π
Setup
-
Clone the repository and install dependencies:
git clone https://github.com/tenzir/tree-sitter-tql
cd tree-sitter-tql
npm install
npm exec lefthook -- install
-
Regenerate the parser (and highlights) when needed:
npm run generate
[!NOTE]
Highlights, indentation, folding, and locals queries stay in sync because
they are generated and committed alongside the parser. CI re-runs the
generator and fails if the checked-in files would change, so always execute
npm run generate after touching the grammar or related constants.
Playground
To interactively test the grammar:
npm run start
# or
npx tree-sitter playground
This opens a web interface where you can input TQL code and see the parse tree
in real time.
License
This project is licensed under the MIT License.