aboutsummaryrefslogtreecommitdiff
path: root/rego-proofs/compiler-rewrite/lib/ast.ml
diff options
context:
space:
mode:
Diffstat (limited to 'rego-proofs/compiler-rewrite/lib/ast.ml')
-rw-r--r--rego-proofs/compiler-rewrite/lib/ast.ml10
1 files changed, 6 insertions, 4 deletions
diff --git a/rego-proofs/compiler-rewrite/lib/ast.ml b/rego-proofs/compiler-rewrite/lib/ast.ml
index 6a43425..98d8375 100644
--- a/rego-proofs/compiler-rewrite/lib/ast.ml
+++ b/rego-proofs/compiler-rewrite/lib/ast.ml
@@ -53,7 +53,7 @@ type rule_head_lhs = reference [@@deriving eq, show]
type rule_head_rhs =
| Assignment of assign_operator * term
- | Function of assign_operator * string list * term
+ | Function of assign_operator * term list * term
| Set of term
[@@deriving eq, show]
@@ -98,6 +98,7 @@ let rec parse_term (tree : Yojson.Basic.t) : term =
match term_type with
| "var" -> Var (tree |> member "value" |> to_string)
| "ref" -> Ref (tree |> member "value" |> to_list |> parse_ref)
+ | "null" -> Scalar Null
| "boolean" -> Scalar (Bool (tree |> member "value" |> to_bool))
| "number" -> Scalar (Number (tree |> member "value" |> to_number))
| "string" -> Scalar (String (tree |> member "value" |> to_string))
@@ -218,8 +219,7 @@ let parse_head tree =
else if not (tree |> member "args" |> is_null) then
Function
( assign_operator,
- tree |> member "args" |> to_list
- |> List.map ~f:(fun x -> x |> member "value" |> to_string),
+ tree |> member "args" |> to_list |> List.map ~f:parse_term,
tree |> member "value" |> parse_term )
else Assignment (assign_operator, tree |> member "value" |> parse_term)
in
@@ -263,7 +263,9 @@ let invoke ?(stdin = "") ?(env = [||]) cmd =
let ic, oc, ec = UnixLabels.open_process_full cmd ~env in
Out_channel.output_string oc stdin;
Out_channel.close oc;
- (In_channel.input_all ic, In_channel.input_all ec)
+ let i = In_channel.input_all ic in
+ let e = In_channel.input_all ec in
+ (i, e)
let ast_of_string policy_code =
let stdout, _ =

© 2015 - 2026 Jakob L. Kreuze