Sign in

    #Syntax trees

    @parser.parse returns a syntax tree with Located nodes. Locations are half-open UTF-16 offsets into the original query, including inside interpolation. Calls retain their names and arguments; @runtime.compile resolves them. Evaluation is provided by Query in the root package.

    BinaryOp

    pub(all) enum BinaryOp {
    Add
    Subtract
    Multiply
    Divide
    Modulo
    Equal
    NotEqual
    LessThan
    LessEq
    GreaterThan
    GreaterEq
    And
    Or
    } derive(Eq, ToJson,
    Debug
    )

    Binary operators in jq
    impl Show for BinaryOp

    BinaryOp::equal

    fn BinaryOp::equal(BinaryOp, BinaryOp) -> Bool

    Preserve method-style access to derived equality operations.

    BinaryOp::not_equal

    fn BinaryOp::not_equal(x : BinaryOp, y : BinaryOp) -> Bool

    Preserve method-style access to derived equality operations.

    BinaryOp::output

    fn BinaryOp::output(self : BinaryOp, logger : &Logger) -> Unit

    Preserve method-style access to display operations.

    BinaryOp::to_json

    fn BinaryOp::to_json(BinaryOp) -> Json

    Preserve method-style access to derived JSON conversion.

    BinaryOp::to_repr

    Preserve method-style access to derived debug representation.

    BinaryOp::to_string

    fn BinaryOp::to_string(self : BinaryOp) -> String

    Preserve method-style access to display operations.

    Expr

    pub(all) enum Expr {
    Located(Span, Expr)
    Identity
    Literal(Literal)
    Pipe(Expr, Expr)
    Comma(Expr, Expr)
    Key(String)
    Access(Expr)
    Subscript(Expr, Expr)
    Index(Array[Int])
    Slice(Int?, Int?)
    Optional(Expr)
    ArrayConstruct(Expr?)
    ObjectConstruct(Array[(Expr, Expr?)])
    Operation(Expr, BinaryOp, Expr)
    IfThenElse(Expr, Expr, Expr)
    TryCatch(Expr, Expr?)
    Variable(String)
    As(Expr, String, Expr)
    Reduce(Expr, String, Expr, Expr)
    Foreach(Expr, String, Expr, Expr, Expr?)
    Update(Expr, Expr)
    Assign(Expr, Expr)
    Alternative(Expr, Expr)
    AddAssign(Expr, Expr)
    SubAssign(Expr, Expr)
    MulAssign(Expr, Expr)
    DivAssign(Expr, Expr)
    ModAssign(Expr, Expr)
    AltAssign(Expr, Expr)
    Format(String)
    StringInterpolation(Array[(String, Expr?)])
    FunctionDef(String, Array[String], Expr)
    Scope(String, Array[String], Expr, Expr)
    FunctionCall(String, Array[Expr])
    } derive(Eq, ToJson,
    Debug
    )

    Syntax only. Calls are resolved and interpolation is expanded by runtime.compile.
    impl Show for Expr

    Expr::equal

    fn Expr::equal(Expr, Expr) -> Bool

    Preserve method-style access to derived equality operations.

    Expr::not_equal

    fn Expr::not_equal(x : Expr, y : Expr) -> Bool

    Preserve method-style access to derived equality operations.

    Expr::output

    fn Expr::output(self : Expr, logger : &Logger) -> Unit

    Preserve method-style access to display operations.

    Expr::to_json

    fn Expr::to_json(Expr) -> Json

    Preserve method-style access to derived JSON conversion.

    Expr::to_repr

    Preserve method-style access to derived debug representation.

    Expr::to_string

    fn Expr::to_string(self : Expr) -> String

    Preserve method-style access to display operations.

    Literal

    pub(all) enum Literal {
    Null
    Bool(Bool)
    Number(Double)
    String(String)
    } derive(Eq, ToJson,
    Debug
    )

    Literal values in jq expressions
    impl Show for Literal

    Literal::equal

    fn Literal::equal(Literal, Literal) -> Bool

    Preserve method-style access to derived equality operations.

    Literal::not_equal

    fn Literal::not_equal(x : Literal, y : Literal) -> Bool

    Preserve method-style access to derived equality operations.

    Literal::output

    fn Literal::output(self : Literal, logger : &Logger) -> Unit

    Preserve method-style access to display operations.

    Literal::to_json

    fn Literal::to_json(Literal) -> Json

    Preserve method-style access to derived JSON conversion.

    Literal::to_repr

    Preserve method-style access to derived debug representation.

    Literal::to_string

    fn Literal::to_string(self : Literal) -> String

    Preserve method-style access to display operations.

    Span

    pub(all) struct Span {
    start : Int
    end : Int
    } derive(Eq, ToJson,
    Debug
    )

    Half-open UTF-16 offsets into the original query.

    Span::equal

    fn Span::equal(Span, Span) -> Bool

    Span::not_equal

    fn Span::not_equal(x : Span, y : Span) -> Bool

    Span::to_json

    fn Span::to_json(Span) -> Json

    Span::to_repr

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io