tree-sitter-tql
v1.2.0
Published
Tree-sitter grammar for the Tenzir Query Language (TQL)
Readme
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, andmatch - 📦 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 installRegenerate 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 generateafter touching the grammar or related constants.
Playground
To interactively test the grammar:
npm run start
# or
npx tree-sitter playgroundThis 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.
