Crates.io | jq_lang |
lib.rs | jq_lang |
version | 0.2.0 |
source | src |
created_at | 2021-09-10 01:07:32.963535 |
updated_at | 2021-09-10 02:18:29.165485 |
description | Provides an AST for the jq query language |
homepage | https://github.com/schultyy/jq_lang |
repository | |
max_upload_size | |
id | 449070 |
size | 7,859 |
Implements the jq syntax in Rust, providing an abstract syntax tree.
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.
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"))
MIT