README

bobzhang/moonjq/ast does not have a README file

#
InterpreterError

pub(all) suberror InterpreterError {
TypeMismatch(String, String)
KeyNotFound(String)
IndexOutOfBounds(Int)
InvalidOperation(String)
DivisionByZero
TypeError(String)
EvalError(String)
}

Interpreter error types

#
BinaryOp

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

Binary operators in jq
impl Eq for BinaryOp
impl Show for BinaryOp
impl ToJson for BinaryOp

#
Expr

pub(all) enum Expr {
Identity
Literal(Literal)
Pipe(Expr, Expr)
Comma(Expr, Expr)
Key(String)
Index(Array[Int])
Slice(Int?, Int?)
Optional(Expr)
ArrayConstruct(Expr?)
ObjectConstruct(Array[(Expr, Expr?)])
Operation(Expr, BinaryOp, Expr)
Length
Keys
Values
Type
Empty
Not
Map(Expr)
Select(Expr)
Sort
SortBy(Expr)
Reverse
Flatten(Int?)
Unique
UniqueBy(Expr)
GroupBy(Expr)
Combinations
Transpose
Add
Floor
Sqrt
Min
MinBy(Expr)
Max
MaxBy(Expr)
Round
Ceil
Abs
Split(String)
Join(String)
StartsWith(String)
EndsWith(String)
Contains(Expr)
Inside(Expr)
Has(String)
In(Expr)
ToEntries
FromEntries
WithEntries(Expr)
MapValues(Expr)
Range(Int)
RangeFromTo(Expr, Expr)
RangeWithStep(Expr, Expr, Expr)
First
FirstGen(Expr)
Last
LastGen(Expr)
Repeat(Expr)
IndicesOf(Expr)
IndexOf(Expr)
Any
AnyGen(Expr, Expr)
All
AllGen(Expr, 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?)
Recurse
RecurseWith(Expr, Expr)
Walk(Expr)
Path(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)
FunctionCall(String, Array[Expr])
LTrimStr(String)
RTrimStr(String)
AsciiUpcase
AsciiDowncase
Explode
Implode
ToJsonString
FromJsonString
Nth(Int)
RIndex(Expr)
Paths
PathsWithFilter(Expr)
LeafPaths
GetPath(Expr)
SetPath(Expr, Expr)
DelPaths(Expr)
Limit(Int, Expr)
Until(Expr, Expr)
While(Expr, Expr)
Pow(Expr)
Log
Exp
Sin
Cos
Tan
Asin
Acos
Atan
Test(String)
Match(String)
Capture(String)
Scan(String)
Splits(String)
Sub(String, String)
GSub(String, String)
}

jq expression AST
impl Eq for Expr
impl Show for Expr
impl ToJson for Expr

#
Literal

pub(all) enum Literal {
Null
Bool(Bool)
Number(Double)
String(String)
}

Literal values in jq expressions
impl Eq for Literal
impl Show for Literal
impl ToJson for Literal

#
eval

fn eval(expr : Expr, input : Json) -> Iterator[Json] raise

Evaluate an expression with input JSON, returns iterator of results

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io