aboutsummaryrefslogtreecommitdiff
path: root/discocaml/ast.ml
diff options
context:
space:
mode:
authorNathan Ringo <nathan@remexre.com>2024-01-18 19:02:16 -0600
committerNathan Ringo <nathan@remexre.com>2024-01-18 19:02:16 -0600
commit5588808852a2fd379be0e9c01cf67cfdcbcdd4c3 (patch)
tree0bd001973612cc858ac391ee009d943b15940393 /discocaml/ast.ml
parent81fb055292f49a76732c1966874b8d2ad2cb1807 (diff)
Prepare to output non-single-expr messages.
Diffstat (limited to 'discocaml/ast.ml')
-rw-r--r--discocaml/ast.ml12
1 files changed, 12 insertions, 0 deletions
diff --git a/discocaml/ast.ml b/discocaml/ast.ml
index 009ea87..22f3790 100644
--- a/discocaml/ast.ml
+++ b/discocaml/ast.ml
@@ -1,3 +1,15 @@
type expr = Foo [@@deriving show { with_path = false }]
let expr_of_parsetree : Parsetree.expression -> expr = function _ -> Foo
+
+let parsetree_of_expr : expr -> Parsetree.expression =
+ let expression (pexp_desc : Parsetree.expression_desc) : Parsetree.expression
+ =
+ {
+ pexp_desc;
+ pexp_loc = Location.none;
+ pexp_loc_stack = [];
+ pexp_attributes = [];
+ }
+ in
+ function Foo -> expression (Pexp_constant (Pconst_char '!'))