moonrockz/rego/compile does not have a README file
pub(all) suberror CompileError {
DuplicateImportAlias(alias_name~ : String, span~ : SourceSpan)
InvalidImport(path~ : String, span~ : SourceSpan)
ConflictingRuleKind(path~ : String, span~ : SourceSpan)
UnsafeVar(name~ : String, span~ : SourceSpan)
CyclicRule(cycle~ : ReadOnlyArray[String], span~ : SourceSpan)
UnstratifiedNegation(cycle~ : ReadOnlyArray[String], span~ : SourceSpan)
DuplicateDefault(path~ : String, span~ : SourceSpan)
InvalidDefault(message~ : String, span~ : SourceSpan)
InvalidRuleHead(message~ : String, span~ : SourceSpan)
UndefinedFunction(name~ : String, span~ : SourceSpan)
WrongArity(name~ : String, expected~ : Int, actual~ : Int, span~ : SourceSpan)
InvalidNumber(text~ : String, span~ : SourceSpan)
DuplicateLocalVar(name~ : String, span~ : SourceSpan)
InvalidWithTarget(target~ : String, span~ : SourceSpan)
} derive(Eq, Debug)impl Show for CompileErrorpub struct CompiledClause {
num_slots : Int
param_patterns : ReadOnlyArray[Pattern]
key_operands : ReadOnlyArray[Operand]
leaf_kind : DynamicLeafKind
value_operand : Operand
body : ReadOnlyArray[Stmt]
else_branches : ReadOnlyArray[CompiledBranch]
rule_metadata : Value?
chain_metadata : Value?
} derive(Eq, Debug)type CompiledPolicyfn CompiledPolicy::lookup_node(self : CompiledPolicy, path : ArrayView[String]) -> CompiledRuleNode?pub enum CompiledRuleNode {
Package(children~ : ReadOnlyArray[(String, CompiledRuleNode)])
Complete(clauses~ : ReadOnlyArray[CompiledClause], default_value~ : Value?, default_branch~ : CompiledBranch?)
PartialSet(clauses~ : ReadOnlyArray[CompiledClause])
VirtualObject(static_children~ : ReadOnlyArray[(String, CompiledRuleNode)], dynamic_clauses~ : ReadOnlyArray[CompiledClause])
Function(arity~ : Int, clauses~ : ReadOnlyArray[CompiledClause], default_value~ : Value?)
} derive(Eq, Debug)pub enum Stmt {
Block(ReadOnlyArray[Stmt])
Break(Int)
AssertTruthy(Operand)
AssertCollection(Operand)
Assign(dst~ : Int, src~ : Operand)
Equal(lhs~ : Operand, rhs~ : Operand)
Unify(lhs~ : Pattern, rhs~ : Pattern)
EvalRef(dst~ : Int, base~ : Operand, segments~ : ReadOnlyArray[RefKey])
Scan(domain~ : Operand, key_slot~ : Int?, val_slot~ : Int)
WalkScan(target~ : Operand, out~ : Pattern)
Not(ReadOnlyArray[Stmt])
CallBuiltin(name~ : BuiltinName, args~ : ReadOnlyArray[Operand], dst~ : Int?)
CallRule(path~ : ReadOnlyArray[String], dst~ : Int)
CallFunc(path~ : ReadOnlyArray[String], args~ : ReadOnlyArray[Operand], dst~ : Int)
With(overlays~ : ReadOnlyArray[WithOverlay], body~ : ReadOnlyArray[Stmt])
ElseChain(branches~ : ReadOnlyArray[CompiledBranch], dst~ : Int)
MakeArray(dst~ : Int)
ArrayPush(arr~ : Int, elem~ : Operand)
MakeSet(dst~ : Int)
SetAdd(set~ : Int, elem~ : Operand)
MakeObject(dst~ : Int)
ObjectInsert(obj~ : Int, key~ : Operand, val~ : Operand)
BuildArrayComp(dst~ : Int, elem~ : Operand, body~ : ReadOnlyArray[Stmt])
BuildSetComp(dst~ : Int, elem~ : Operand, body~ : ReadOnlyArray[Stmt])
BuildObjectComp(dst~ : Int, key~ : Operand, val~ : Operand, body~ : ReadOnlyArray[Stmt])
FormatTemplate(dst~ : Int, parts~ : ReadOnlyArray[CompiledTemplatePart])
ResultSetAdd(bindings~ : ReadOnlyArray[(String, Int)])
} derive(Eq, Debug)pub enum WithTarget {
WithInput(ReadOnlyArray[String])
WithData(ReadOnlyArray[String])
WithBuiltin(BuiltinName)
} derive(Eq, Debug)pub enum WithValue {
WithOperand(Operand)
WithFuncPath(ReadOnlyArray[String])
WithBuiltinName(BuiltinName)
} derive(Eq, Debug)fn compile_modules(modules : ArrayView[Module], builtins : BuiltinRegistry) -> CompiledPolicy raise CompileErrorInstall
Download zipPure MoonBit Open Policy Agent (OPA) Rego v1 syntax, AST and policy engine