jq_lang 0.2.0

Provides an AST for the jq query language
Documentation
  • Coverage
  • 5.88%
    1 out of 17 items documented1 out of 7 items with examples
  • Size
  • Source code size: 7.48 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.88 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Homepage
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • schultyy

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