Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[fix] compiler, parser: replace tail coerce by opensums

  • Loading branch information...
commit 04ab8e35c42a417b1fd0d3ce2c62ab66e816ca78 1 parent f7ca00f
@BourgerieQuentin BourgerieQuentin authored
View
4 opalang/classic_syntax/parser_utils.ml
@@ -919,6 +919,10 @@ let list_pat_of_pat_list ?tl l label : string pat =
let list_expr_of_expr_list ?tl l label =
let tl = match tl with None -> list_nil label | Some tl -> tl in
List.fold_right list_cons l tl
+let list_expr_of_expr_openlist ?tl l label =
+ let tl = match tl with None -> list_nil label | Some tl -> tl in
+ let e = List.fold_right list_cons l tl in
+ (directive1 `opensums e, snd e)
let list_expr_of_expr_list_no_coerce ?tl l label =
let tl = match tl with None -> list_nil_no_coerce label | Some tl -> tl in
List.fold_right list_cons_no_coerce l tl
View
2  opalang/classic_syntax/parser_utils.mli
@@ -248,6 +248,8 @@ val list_expr_of_expr_list_no_coerce :
?tl:(string,'a) expr -> (string, [> `coerce ] as 'a) expr list -> annot -> (string, 'a) expr
val list_expr_of_expr_list_tail_coerce :
?tl:(string,'a) expr -> (string, [> `coerce ] as 'a) expr list -> annot -> (string, 'a) expr
+val list_expr_of_expr_openlist :
+ ?tl:(string,'a) expr -> (string, [> `coerce | `opensums] as 'a) expr list -> annot -> (string, 'a) expr
val list_expr_of_expr_list_unsafe : (string, [> `coerce ] as 'a) expr list -> (string, 'a) expr(**Fails if the list is empty*)
val list_constructors_of_string_list: (string * annot) list -> annot -> (string, [> `coerce ]) expr
View
2  opalang/js_syntax/opa_parser.trx
@@ -940,7 +940,7 @@ list <-
/ lbracket (=list0(Action.action,comma)):l pos:p comma? (Opa_lexer.BAR expr:e {{e}})?:tl rbracket
{{ undecorate (list_expr_of_expr_list ?tl l p) }}
/ lbracket (=list0(expr, comma)):l pos:p comma? (Opa_lexer.BAR expr:e {{e}})?:tl rbracket
- {{ undecorate (list_expr_of_expr_list_tail_coerce ?tl l p) }}
+ {{ undecorate (list_expr_of_expr_openlist ?tl l p) }}
(* ******************************************************************)
Please sign in to comment.
Something went wrong with that request. Please try again.