Skip to content

tree-sitter-logrotate

tree-sitter-logrotate turns Logrotate configuration and state text into stable concrete syntax trees. The configuration grammar recognizes global directives, rotation stanzas, path lists, includes, quoted arguments, comments, and every raw script block supported by Logrotate. The state grammar recognizes versioned headers, quoted paths, and timestamps.

Open the Playground to edit configuration or state text and inspect the live syntax tree in your browser.

/var/log/application.log {
daily
rotate 7
compress
postrotate
systemctl reload application
endscript
}

The repository publishes both generated parsers through C, Node.js, Python, Rust, Go, Java, Swift, Zig, and WebAssembly. Each package uses ABI 15 parser sources generated from the same release.

Portable Tree-sitter queries provide highlighting, Bash injection for script bodies, and folding. Host integrations can add indentation, text objects, file detection, and other native behavior without changing the grammar.

Parsing is local and deterministic. The grammar accepts supplied text and returns a syntax tree. It does not read included files, expand globs, inspect users or groups, start Logrotate, or execute script bodies.

Unknown and vendor-specific directives remain valid directive nodes. This keeps the parser useful with newer Logrotate releases and downstream builds while semantic tools handle version-specific validation.

Environment Package
Node.js tree-sitter-logrotate on npm
Python tree-sitter-logrotate on PyPI
Rust tree-sitter-logrotate on crates.io
Java jtreesitter-logrotate on Maven Central
Go Go package documentation
Swift, Zig, C, and WASM Tagged source and release assets

Start with Getting started for a complete parse, or open Bindings to find the package for a particular runtime.

Editors describes the supported Neovim, Helix, and Zed integration surfaces, including parser loading, query placement, and file recognition.