rnix-parser Crates.io

rnix is a parser for the Nix language written in Rust.

This can be used to manipulate the Nix AST and can for example be used for:

and a lot more!

rnix nowadays uses @matklad's rowan crate to ensure:

Demo

Examples can be found in the examples/ directory.

You may also want to see nix-explorer: An example that highlights AST nodes in Nix code. This demonstrates how whitespaces and commands are preserved.