summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--parsing/parser.mly8
-rw-r--r--parsing/parsetree.mli1
-rw-r--r--parsing/printast.ml3
3 files changed, 10 insertions, 2 deletions
diff --git a/parsing/parser.mly b/parsing/parser.mly
index f95e70a13..67a815f4e 100644
--- a/parsing/parser.mly
+++ b/parsing/parser.mly
@@ -595,7 +595,7 @@ class_simple_expr:
| OBJECT class_structure END
{ mkclass(Pcl_structure($2)) }
| OBJECT class_structure error
- { unclosed "class" 1 "end" 3 }
+ { unclosed "object" 1 "end" 3 }
| LPAREN class_expr COLON class_type RPAREN
{ mkclass(Pcl_constraint($2, $4)) }
| LPAREN class_expr COLON class_type error
@@ -689,7 +689,7 @@ class_signature:
| OBJECT class_sig_body END
{ mkcty(Pcty_signature $2) }
| OBJECT class_sig_body error
- { unclosed "sig" 1 "end" 3 }
+ { unclosed "object" 1 "end" 3 }
;
class_sig_body:
class_self_type class_sig_fields
@@ -879,6 +879,10 @@ expr:
{ mkassert $2 }
| LAZY simple_expr %prec below_SHARP
{ mkexp (Pexp_lazy ($2)) }
+ | OBJECT class_structure END
+ { mkexp (Pexp_object($2)) }
+ | OBJECT class_structure error
+ { unclosed "object" 1 "end" 3 }
;
simple_expr:
val_longident
diff --git a/parsing/parsetree.mli b/parsing/parsetree.mli
index f0da277bf..d0db6b848 100644
--- a/parsing/parsetree.mli
+++ b/parsing/parsetree.mli
@@ -110,6 +110,7 @@ and expression_desc =
| Pexp_assertfalse
| Pexp_lazy of expression
| Pexp_poly of expression * core_type option
+ | Pexp_object of class_structure
(* Value descriptions *)
diff --git a/parsing/printast.ml b/parsing/printast.ml
index be819a7d4..340917155 100644
--- a/parsing/printast.ml
+++ b/parsing/printast.ml
@@ -292,6 +292,9 @@ and expression i ppf x =
line i ppf "Pexp_poly\n";
expression i ppf e;
option i core_type ppf cto;
+ | Pexp_object s ->
+ line i ppf "Pexp_object";
+ class_structure i ppf s
and value_description i ppf x =
line i ppf "value_description\n";