Skip to main content

Crate yqr

Crate yqr 

Source
Expand description

yqr — a jq-style query/transform tool for YAML.

This crate is split into small, independently testable layers:

  • lexer turns a filter string into tokens,
  • parser turns tokens into an ast::Ast,
  • eval applies an Ast to a Value, producing a stream of output values,
  • fidelity provides byte-preserving execution over noyalib’s lossless CST (untouched nodes are emitted as their original source bytes),
  • validate checks inputs for YAML correctness and renders compiler-style diagnostics.

The two convenience entry points most callers want are eval_str (parse a filter and run it over a YAML string, returning values) and render (turn output values back into a YAML/raw string). For byte-preserving output, see fidelity::run.

Re-exports§

pub use error::Result;
pub use error::YqrError;
pub use value::Value;

Modules§

ast
Abstract syntax tree for the yqr filter language.
edit
The typed edit API: compose edits as data, apply them through the fidelity write tier.
error
Error type and exit-code mapping for yqr.
eval
The evaluation engine: applies an Ast to a Value, producing a stream (Vec<Value>) of results, mirroring jq’s model where any filter can yield zero or more outputs.
fidelity
The fidelity engine seam: byte-preserving reads over YAML sources.
lexer
Tokenizer for the yqr filter language.
parser
Recursive-descent parser: Tokens → Program.
validate
YAML correctness checking with compiler-style diagnostics.
value
yqr’s native value model — decoupled from any YAML backend library.

Functions§

eval_ast_str
Like eval_str, but over an already-compiled ast::Ast, so a caller that has already parsed the filter does not lex and parse it again.
eval_str
Parse filter, load the first YAML document from input, and evaluate the filter against it, returning the output stream.
render
Render a stream of output values to a string.