Source

ocaml-lib / dcg / pa_dcg.ml

Diff from to

File dcg/pa_dcg.ml

   seq:
       [ [ "->"; e = expr ->
 	    <:expr< Dcg.ret $e$ >>
-        | (x1,p1) = atom; "then"; p2 = seq2; "|"; p3 = alt ->
+	| "exception"; e = expr LEVEL "top" ->
+            <:expr< Dcg.raise_exn $e$ >>
+        | (x1,p1) = dcg_atom; "then"; p2 = seq2; "|"; p3 = alt ->
 	    let f = <:expr< fun $pat:x1$ -> $p2$ >> in
 	    <:expr< Dcg.cut $p1$ $f$ $p3$ >>
-        | (x1,p1) = atom; f2 = seq1 ->
+        | (x1,p1) = dcg_atom; f2 = seq1 ->
             f2 (x1,p1)
         ] ];
 
       ] ];
 
   seq2:
-    [ [ (x1, p1) = atom; f2 = seq1 -> f2 (x1,p1) 
+    [ [ (x1, p1) = dcg_atom; f2 = seq1 -> f2 (x1,p1) 
       | "("; OPT "|"; p = alt; ")" -> p
       ] ];
 
-  atom:
+  dcg_atom:
     [ [ "EOF" ->
         <:patt< _ >>, <:expr< Matcher.eof >>
       | "when"; s = str; e = expr LEVEL "top" ->
 	  let name =
 	    match name_opt with
 	    | Some n -> n
-	    | None -> <:expr< ("regexp \"" ^ String.escaped $regexp$ ^ "\"") >> in
+	    | None -> <:expr< "" (*"regexp \"" ^ String.escaped $regexp$ ^ "\""*) >> in
 	  <:expr< Matcher.get $name$ (Str.regexp $regexp$) Matcher.Token.repr >>
       | "try"; e = expr LEVEL "top" ->
 	  let f = <:expr< fun () -> $e$ >> in