Commits

camlspotter committed a993568

opt_semi is introduced after { of records

Comments (0)

Files changed (1)

parsing/parser.mly

       { bigarray_get $1 $4 }
   | simple_expr DOT LBRACE expr_comma_list error
       { unclosed "{" 3 "}" 5 }
-  | LBRACE record_expr RBRACE
-      { let (exten, fields) = $2 in mkexp(Pexp_record(fields, exten)) }
-  | LBRACE record_expr error
-      { unclosed "{" 1 "}" 3 }
+  | LBRACE opt_semi record_expr RBRACE
+      { let (exten, fields) = $3 in mkexp(Pexp_record(fields, exten)) }
+  | LBRACE opt_semi record_expr error
+      { unclosed "{" 1 "}" 4 }
   | LBRACKETBAR expr_semi_list opt_semi BARRBRACKET
       { mkexp(Pexp_array(List.rev $2)) }
   | LBRACKETBAR expr_semi_list opt_semi error
       { mkexp(Pexp_apply(mkoperator "!" 1, ["",$2])) }
   | NEW class_longident
       { mkexp(Pexp_new($2)) }
-  | LBRACELESS field_expr_list opt_semi GREATERRBRACE
-      { mkexp(Pexp_override(List.rev $2)) }
-  | LBRACELESS field_expr_list opt_semi error
-      { unclosed "{<" 1 ">}" 4 }
+  | LBRACELESS opt_semi field_expr_list opt_semi GREATERRBRACE
+      { mkexp(Pexp_override(List.rev $3)) }
+  | LBRACELESS opt_semi field_expr_list opt_semi error
+      { unclosed "{<" 1 ">}" 5 }
   | LBRACELESS GREATERRBRACE
       { mkexp(Pexp_override []) }
   | simple_expr SHARP label
   | expr COMMA expr                             { [$3; $1] }
 ;
 record_expr:
-    simple_expr WITH lbl_expr_list opt_semi     { (Some $1, List.rev $3) }
+    simple_expr WITH opt_semi lbl_expr_list opt_semi     { (Some $1, List.rev $4) }
   | lbl_expr_list opt_semi                      { (None, List.rev $1) }
 ;
 lbl_expr_list:
       { mkpat(Ppat_variant($1, None)) }
   | SHARP type_longident
       { mkpat(Ppat_type $2) }
-  | LBRACE lbl_pattern_list record_pattern_end RBRACE
-      { mkpat(Ppat_record(List.rev $2, $3)) }
-  | LBRACE lbl_pattern_list opt_semi error
+  | LBRACE opt_semi lbl_pattern_list record_pattern_end RBRACE
+      { mkpat(Ppat_record(List.rev $3, $4)) }
+  | LBRACE opt_semi lbl_pattern_list opt_semi error
       { unclosed "{" 1 "}" 4 }
   | LBRACKET pattern_semi_list opt_semi RBRACKET
       { reloc_pat (mktailpat (List.rev $2)) }
       { (Ptype_variant(List.rev $3), Private, None) }
   | EQUAL private_flag BAR constructor_declarations
       { (Ptype_variant(List.rev $4), $2, None) }
-  | EQUAL private_flag LBRACE label_declarations opt_semi RBRACE
-      { (Ptype_record(List.rev $4), $2, None) }
+  | EQUAL private_flag LBRACE opt_semi label_declarations opt_semi RBRACE
+      { (Ptype_record(List.rev $5), $2, None) }
   | EQUAL core_type EQUAL private_flag opt_bar constructor_declarations
       { (Ptype_variant(List.rev $6), $4, Some $2) }
-  | EQUAL core_type EQUAL private_flag LBRACE label_declarations opt_semi RBRACE
-      { (Ptype_record(List.rev $6), $4, Some $2) }
+  | EQUAL core_type EQUAL private_flag LBRACE opt_semi label_declarations opt_semi RBRACE
+      { (Ptype_record(List.rev $7), $4, Some $2) }
 ;
 type_parameters:
     /*empty*/                                   { [] }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.