jq_lang

Crates.iojq_lang
lib.rsjq_lang
version0.2.0
sourcesrc
created_at2021-09-10 01:07:32.963535
updated_at2021-09-10 02:18:29.165485
descriptionProvides an AST for the jq query language
homepagehttps://github.com/schultyy/jq_lang
repository
max_upload_size
id449070
size7,859
Jan Schulte (schultyy)

documentation

README

JQ Lang Rust

Implements the jq syntax in Rust, providing an abstract syntax tree.

Usage

Use it like this in your program:

use jq_lang::to_ast;
use jq_lang::node_type::NodeType;

let ast = to_ast(".").unwrap();
assert_eq!(ast.node_type, NodeType::Program);

The root node is always of type Program. It has one or more child elements under it.

Language

Identity

The simplest filter is .. It consumes JSON and produces the same output, unchanged.

. produces the following AST:

    Program
        |
        |
    Identity(value: None)

ObjectIdentifierIndex

The Object Identifier Index is meant to return the value for a property. Given the filter .foo, the implementing program is supposed to return the property foo's value.

    Program
        |
        |
    ObjectIdentifierIndex(value: Some("foo"))

License

MIT

Commit count: 0

cargo fmt