Commits

camlspotter committed 4bc30e8

bind waste reduction 0.565275

Comments (0)

Files changed (1)

ocaml/plparser.ml

 
            return (fun () ->  Ptop_def[ghstrexp v_1] ))
 
-    <!> case "toplevel_phrase_1" (perform
+    <|> case "toplevel_phrase_1" (perform
 
            v_1 <-- self#top_structure ;
            token SEMISEMI;
 
                   return (fun () ->  Ptop_def[ghstrexp v_2] :: v_3 ))
 
-           <!> (perform
+           <|> (perform
 
                   v_2 <-- self#structure_item ;
                   v_3 <-- self#use_file_tail ;
     <|> case "module_expr_nonleftrec_1" (perform
 
            token LPAREN;
-           token VAL;
-           v_3 <-- self#expr ;
-           token COLON;
-           check_close
-             (perform
-                v_5 <-- self#package_type ;
-                token RPAREN;
-                return v_5)
-             (fun v_5 ->  mkmod(Pmod_unpack(v_3, v_5)))
-             (fun () ->  unclosed "(" 1 ")" 5 ))
-
-    <!> case "module_expr_nonleftrec_3" (perform
-
-           token LPAREN;
-           v_2 <-- self#module_expr ;
-           v_4 <-- option (perform
+
+           (perform                                         
+              token VAL;
+              v_3 <-- self#expr ;
+              token COLON;
+              check_close
+                (perform
+                   v_5 <-- self#package_type ;
+                   token RPAREN;
+                   return v_5)
+                (fun v_5 ->  mkmod(Pmod_unpack(v_3, v_5)))
+                (fun () ->  unclosed "(" 1 ")" 5 ))
+
+           <|> (perform
+                v_2 <-- self#module_expr ;
+                v_4 <-- option (perform
                              token COLON;
                              self#module_type) ;
-           check_close
-             (token RPAREN)
-             (fun () ->  
-               match v_4 with
-               | Some v_4 -> mkmod(Pmod_constraint(v_2, v_4))
-               | None -> v_2)
-             (fun () ->  unclosed "(" 1 ")" 5 ))
-
-      )
+                check_close
+                  (token RPAREN)
+                  (fun () ->  
+                    match v_4 with
+                    | Some v_4 -> mkmod(Pmod_constraint(v_2, v_4))
+                    | None -> v_2)
+                  (fun () ->  unclosed "(" 1 ")" 5 )))
+
+  )
 
   method module_expr_leftrec v_1 = (dummy
     <|> case "module_expr_leftrec_0" (perform
   )
 
   method structure = rule "structure" (fun () -> dummy
-    <!> case "structure_0" (perform
+    <|> case "structure_0" (perform
 
            v_1 <-- self#seq_expr ;
            v_2 <-- self#structure_tail ;
 
            return (fun () ->  ghstrexp v_1 :: v_2 ))
 
-    <!> case "structure_1" (perform
+    <|> case "structure_1" (perform
 
            v_1 <-- self#structure_tail ;
 
       )
 
   method structure_tail = rule "structure_tail" (fun () -> dummy
-    <!> case "structure_tail_0" (perform
+    <|> case "structure_tail_0" (perform
 
            token SEMISEMI;
-           v_2 <-- self#seq_expr ;
-           v_3 <-- self#structure_tail ;
-
-           return (fun () ->  ghstrexp v_2 :: v_3 ))
-
-    <!> case "structure_tail_1" (perform
-
-           token SEMISEMI;
-           v_2 <-- self#structure_item ;
-           v_3 <-- self#structure_tail ;
-
-           return (fun () ->  v_2 :: v_3 ))
-
-    <!> case "structure_tail_2" (perform
+
+           (perform                                 
+              v_2 <-- self#seq_expr ;
+              v_3 <-- self#structure_tail ;
+
+              return (fun () ->  ghstrexp v_2 :: v_3 ))
+             
+           <|> (perform
+                  v_2 <-- self#structure_item ;
+                  v_3 <-- self#structure_tail ;
+
+                  return (fun () ->  v_2 :: v_3 ))
+
+           <|> (perform
+                  
+                  return (fun () ->  [] )))
+
+    <|> case "structure_tail_2" (perform
 
            v_1 <-- self#structure_item ;
            v_2 <-- self#structure_tail ;
 
            return (fun () ->  v_1 :: v_2 ))
 
-    <!> case "structure_tail_3" (perform
-
-           token SEMISEMI;
-
-           return (fun () ->  [] ))
-
-    <!> case "structure_tail_4" (perform
+    <|> case "structure_tail_4" (perform
 
            (* empty *)
 
       )
 
   method class_fun_def = rule "class_fun_def" (fun () -> dummy
-    <!> case "class_fun_def_0" (perform
+    <|> case "class_fun_def_0" (perform
 
            v_1 <-- self#labeled_simple_pattern ;
            token MINUSGREATER;
       )
 
   method class_self_pattern = rule "class_self_pattern" (fun () -> dummy
-    <!> case "class_self_pattern_0" (perform
+    <|> case "class_self_pattern_0" (perform
 
            token LPAREN;
            v_2 <-- self#pattern ;
       )
 
   method value = rule "value" (fun () -> dummy
-    <!> case "value_0" (perform
+    <|> case "value_0" (perform
 
            v_1 <-- self#override_flag ;
            v_2 <-- self#mutable_flag ;
            v_3 <-- self#label ;
-           v_4 <-- self#type_constraint ;
+           v_4 <-- option self#type_constraint ;
            token EQUAL;
            v_6 <-- self#seq_expr ;
 
-           return (fun () ->  v_3, v_2, v_1, (let (t, t') = v_4 in ghexp(Pexp_constraint(v_6, t, t'))),
-        symbol_rloc () ))
-
-    <!> case "value_1" (perform
-
-           v_1 <-- self#override_flag ;
-           v_2 <-- self#mutable_flag ;
-           v_3 <-- self#label ;
-           token EQUAL;
-           v_5 <-- self#seq_expr ;
-
-           return (fun () ->  v_3, v_2, v_1, v_5, symbol_rloc () ))
+           return (fun () -> 
+             match v_4 with
+             | Some v_4 -> v_3, v_2, v_1, (let (t, t') = v_4 in ghexp(Pexp_constraint(v_6, t, t'))), symbol_rloc () 
+             | None -> v_3, v_2, v_1, v_6, symbol_rloc () ))
 
       )
 
   method virtual_method = rule "virtual_method" (fun () -> dummy
-    <!> case "virtual_method_0" (perform
+    <|> case "virtual_method_0" (perform
 
            token METHOD;
            v_2 <-- self#override_flag ;
       )
 
   method concrete_method = rule "concrete_method" (fun () -> dummy
-    <!> case "concrete_method_0" (perform
+    <|> case "concrete_method_0" (perform
 
            token METHOD;
            v_2 <-- self#override_flag ;
       )
 
   method virtual_method_type = rule "virtual_method_type" (fun () -> dummy
-    <!> case "virtual_method_type_0" (perform
+    <|> case "virtual_method_type_0" (perform
 
            token METHOD;
            token PRIVATE;