tree-sitter-logrotate
tree-sitter-logrotate parses logrotate configuration files with Tree-sitter. It recognizes global
directives, rotation stanzas, path lists, comments, includes, quoted arguments, and all five raw
script blocks. Unknown and vendor-specific directives remain valid syntax. Script text is preserved
as script_body and is never executed.
The committed parser uses Tree-sitter language ABI 15. The reviewed syntax baseline is logrotate
revision 3be1e9ccffe0c2245ed596183c74913d553f9f18, which includes the logrotate 3.22 syntax reviewed
for the first release.
Consumers
The repository publishes the same generated parser through C source, npm, PyPI, crates.io, Maven
Central, Go, Swift Package Manager, Zig, and a standalone WASM artifact. The portable highlight,
shell-injection, and fold queries live in queries/.
Helix, Neovim, and Zed integrations are separate delivery phases. None is claimed as an upstream editor integration until its editor repository accepts and tests the pinned grammar revision. See the design for that work.
Local development
The development container is the reference environment. It pins every toolchain, does not forward host credentials, and keeps platform-specific output in named volumes.
For a native checkout, install the versions in toolchains.json, then run:
nvm use
npm install --global npm@12.0.2
npm ci
npm run verify
npm run test:bindings
npm run test:wasm
npm run test:fixtures
npm run test:sanitizers
npm run test:performance
Run npm run generate after changing grammar.js. Generated parser files are committed and must
pass npm run check:generated. TREE_SITTER_BUILD_DIR relocates native and WASM output; its default
is the ignored build directory.
More native setup details are in docs/native-development.md.
Binding examples
Every example parses supplied text. None reads a configuration from disk or starts logrotate.
C
#include <string.h>
#include <tree_sitter/api.h>
#include <tree_sitter/tree-sitter-logrotate.h>
const char *source = "/var/log/app.log {\n rotate 7\n}\n";
TSParser *parser = ts_parser_new();
ts_parser_set_language(parser, tree_sitter_logrotate());
TSTree *tree = ts_parser_parse_string(parser, NULL, source, strlen(source));
TSNode root = ts_tree_root_node(tree);
ts_tree_delete(tree);
ts_parser_delete(parser);
Node.js
import Parser from "tree-sitter";
import Logrotate from "tree-sitter-logrotate";
const parser = new Parser();
parser.setLanguage(Logrotate);
const tree = parser.parse("/var/log/app.log {\n rotate 7\n}\n");
console.log(tree.rootNode.toString());
Python
from tree_sitter import Language, Parser
from tree_sitter_logrotate import language
parser = Parser(Language(language()))
tree = parser.parse(b"/var/log/app.log {\n rotate 7\n}\n")
print(tree.root_node)
Rust
let mut parser = tree_sitter::Parser::new();
parser
.set_language(&tree_sitter_logrotate::LANGUAGE.into())
.expect("load logrotate grammar");
let tree = parser
.parse("/var/log/app.log {\n rotate 7\n}\n", None)
.expect("parse logrotate configuration");
println!("{}", tree.root_node());
Go
language := sitter.NewLanguage(logrotate.Language())
parser := sitter.NewParser()
defer parser.Close()
if err := parser.SetLanguage(language); err != nil {
panic(err)
}
tree := parser.Parse([]byte("/var/log/app.log {\n rotate 7\n}\n"), nil)
defer tree.Close()
The imports are github.com/tree-sitter/go-tree-sitter as sitter and
github.com/willibrandon/tree-sitter-logrotate/bindings/go as logrotate.
Java
var language = new Language(Objects.requireNonNull(TreeSitterLogrotate.language()));
try (var parser = new Parser(language);
var tree = parser.parse("/var/log/app.log {\n rotate 7\n}\n").orElseThrow()) {
System.out.println(tree.getRootNode().toSexp());
}
The Maven coordinates are io.github.willibrandon:jtreesitter-logrotate. Java applications also
need JTreeSitter 0.26 and its compatible native Tree-sitter runtime. The grammar artifact includes
the platform grammar library; it does not replace the Tree-sitter runtime used by JTreeSitter.
Swift
let parser = Parser()
try parser.setLanguage(Language(language: tree_sitter_logrotate()))
let tree = parser.parse("/var/log/app.log {\n rotate 7\n}\n")
print(tree?.rootNode as Any)
Zig
const parser = Parser.create();
defer parser.destroy();
const language = Language.fromRaw(logrotate.language());
defer language.destroy();
try parser.setLanguage(language);
const tree = parser.parseString("/var/log/app.log {\n rotate 7\n}\n", null).?;
defer tree.destroy();
Browser WASM
import { Language, Parser } from "web-tree-sitter";
await Parser.init({ locateFile: () => "/web-tree-sitter.wasm" });
const language = await Language.load("/tree-sitter-logrotate.wasm");
const parser = new Parser();
parser.setLanguage(language);
const tree = parser.parse("/var/log/app.log {\n rotate 7\n}\n");
console.log(tree.rootNode.toString());
File names
Editor integrations should recognize only high-confidence configuration names:
logrotate.conf- files directly below a
logrotate.ddirectory *.logrotate*.logrotate.conf
Content detection may recognize an extensionless file whose first meaningful line is a complete
absolute or tilde-prefixed path stanza ending in {. The logrotate state -- version 1 and
logrotate state -- version 2 headers are state files and must not select this grammar.
Syntax boundary
This is a syntax grammar. It does not resolve includes or globs, inspect users and groups, apply inherited settings, check filesystem permissions, validate directives against an installed logrotate version, or execute scripts. Those operations require host state and belong in a language server or another semantic tool.
An include path remains an include_directive node even when the referenced file does not exist.
Unknown directives remain ordinary directive nodes so newer logrotate releases and vendor builds
do not become syntax errors.
Compatibility and releases
Tree-sitter CLI 0.26.3 is the tested minimum and 0.26.12 is the pinned generation version. The Node
binding uses tree-sitter 0.25.1 or later in the 0.25 line; the standalone WASM artifact uses
web-tree-sitter 0.26. Releases use Semantic Versioning and treat named nodes, fields, and query
captures as compatibility surfaces even before 1.0.
Each release aligns every package version, builds from committed generated source, and publishes a source archive, WASM parser, checksums, CycloneDX SBOMs, and GitHub provenance attestations. See docs/compatibility.md and docs/release.md.
License
MIT
Release files for tree-sitter-logrotate 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tree_sitter_logrotate-0.1.0.tar.gz | 26.8 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| tree_sitter_logrotate-0.1.0-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details |
| tree_sitter_logrotate-0.1.0-cp310-abi3-musllinux_1_2_x86_64.whl | CPython 3.10 | abi3 | Linux musl 1.2+ x86-64 | Details |
| tree_sitter_logrotate-0.1.0-cp310-abi3-musllinux_1_2_aarch64.whl | CPython 3.10 | abi3 | Linux musl 1.2+ ARM64 | Details |
| tree_sitter_logrotate-0.1.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.17+ ARM64, Linux glibc 2.28+ ARM64 | Details |
| tree_sitter_logrotate-0.1.0-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.5+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| tree_sitter_logrotate-0.1.0-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details |
Total release size: 202.8 kB
Release files / tree_sitter_logrotate-0.1.0.tar.gz
| Download URL | tree_sitter_logrotate-0.1.0.tar.gz |
|---|---|
| Size | 26.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5c8daed86311dd75fe5fdcf4ab050eda796020593d0acb4ae7d5407e8893ca1c
|
|
BLAKE2b-256 checksum How to use checksums |
8461fc9fcb7ab5777e74d65e4f677d55c74cb026d181e4e0a7734582349bdb10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 13, 2026.
Transparency logRelease files / tree_sitter_logrotate-0.1.0-cp310-abi3-win_amd64.whl
| Download URL | tree_sitter_logrotate-0.1.0-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 20.7 kB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
d3f3f5da21335dac411899b2042161800aec3ca3136c2d78583414ef014d3d1c
|
|
BLAKE2b-256 checksum How to use checksums |
0b9c3a079f8cdf6b66037167f0df85016050073d2ebbeafbb3428712340a91d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 13, 2026.
Transparency logRelease files / tree_sitter_logrotate-0.1.0-cp310-abi3-musllinux_1_2_x86_64.whl
| Download URL | tree_sitter_logrotate-0.1.0-cp310-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 33.5 kB |
| Tags | CPython 3.10 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
9e12318730a2431a5958363f6b1b516127a4563ae6703ffd82b935dcf9771a95
|
|
BLAKE2b-256 checksum How to use checksums |
67235a6d4a3f06343abab5da9e916f70c5940f4aa0dc4f069ee7e79932252327
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 13, 2026.
Transparency logRelease files / tree_sitter_logrotate-0.1.0-cp310-abi3-musllinux_1_2_aarch64.whl
| Download URL | tree_sitter_logrotate-0.1.0-cp310-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 33.6 kB |
| Tags | CPython 3.10 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
779b31ba7c0fb0089425e6bb0d7ee8f381d8ef2da6fa4554de7a2e25445e101b
|
|
BLAKE2b-256 checksum How to use checksums |
f76a98ce4852e65a139fa214c315c4666c8a90c6f31eae1e1820d8a23a6b7e82
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 13, 2026.
Transparency logRelease files / tree_sitter_logrotate-0.1.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
| Download URL | tree_sitter_logrotate-0.1.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 34.6 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
a5d3341558f6458e95c41e9056395b57ef29b714b39134a5fbeec033d6342cf0
|
|
BLAKE2b-256 checksum How to use checksums |
bc01838f385f47cc19c1aa68e04db0944535401790783d8b2636d1cbb06fcac2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 13, 2026.
Transparency logRelease files / tree_sitter_logrotate-0.1.0-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | tree_sitter_logrotate-0.1.0-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 33.9 kB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
08ef569e7066dbf6cc62c75c7b7497921e9be2c7c7f513474266d5e5162c5134
|
|
BLAKE2b-256 checksum How to use checksums |
7d05bc97720cfba0995ad3ae9c6bf96ff65d9e36806a29435db05aee05747cdc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 13, 2026.
Transparency logRelease files / tree_sitter_logrotate-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | tree_sitter_logrotate-0.1.0-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 19.6 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
147ca9451ff7364a6a68b3c0caf26a9d088d0d46d6d257fd4cb80aa988ff81b1
|
|
BLAKE2b-256 checksum How to use checksums |
ef0202d0c40c796aaf56cf6f298704b4a3e7f5e13d8f5fc64d9da26e37b66818
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 13, 2026.
Transparency log