3 unstable releases
0.2.0 | Sep 10, 2021 |
---|---|
0.1.1 | Sep 10, 2021 |
0.1.0 | Sep 10, 2021 |
#1715 in Database interfaces
23 downloads per month
7KB
135 lines
JQ Lang
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