summaryrefslogtreecommitdiffstats
path: root/camlp4/ocaml_src/meta
diff options
context:
space:
mode:
authorDamien Doligez <damien.doligez-inria.fr>2002-01-20 17:39:10 +0000
committerDamien Doligez <damien.doligez-inria.fr>2002-01-20 17:39:10 +0000
commit0dbce74fc87015b7efa837f7529513075b6d73be (patch)
tree6cc2612b63b8ef95401f0809ed9af0ce26d0255c /camlp4/ocaml_src/meta
parent196b2190204e85ce85140ada0d06cb590bd662e8 (diff)
lazy a la Tolmach
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4291 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'camlp4/ocaml_src/meta')
-rw-r--r--camlp4/ocaml_src/meta/pa_r.ml15
-rw-r--r--camlp4/ocaml_src/meta/q_MLast.ml30
2 files changed, 6 insertions, 39 deletions
diff --git a/camlp4/ocaml_src/meta/pa_r.ml b/camlp4/ocaml_src/meta/pa_r.ml
index 04943cc6c..23608c477 100644
--- a/camlp4/ocaml_src/meta/pa_r.ml
+++ b/camlp4/ocaml_src/meta/pa_r.ml
@@ -148,18 +148,6 @@ let mkassert loc e =
else MLast.ExIfe (loc, e, MLast.ExUid (loc, "()"), raiser)
;;
-let mklazy loc e =
- MLast.ExApp
- (loc,
- MLast.ExAcc
- (loc, MLast.ExUid (loc, "Pervasives"), MLast.ExLid (loc, "ref")),
- MLast.ExApp
- (loc,
- MLast.ExAcc
- (loc, MLast.ExUid (loc, "Lazy"), MLast.ExUid (loc, "Delayed")),
- MLast.ExFun (loc, [MLast.PaUid (loc, "()"), None, e])))
-;;
-
(* ...suppose to flush the input in case of syntax error to avoid multiple
errors in case of cut-and-paste in the xterm, but work bad: for example
the input "for x = 1;" waits for another line before displaying the
@@ -980,7 +968,8 @@ Grammar.extend
Some "apply", Some Gramext.LeftA,
[[Gramext.Stoken ("", "lazy"); Gramext.Sself],
Gramext.action
- (fun (e : 'expr) _ (loc : int * int) -> (mklazy loc e : 'expr));
+ (fun (e : 'expr) _ (loc : int * int) ->
+ (MLast.ExLaz (loc, e) : 'expr));
[Gramext.Stoken ("", "assert"); Gramext.Sself],
Gramext.action
(fun (e : 'expr) _ (loc : int * int) -> (mkassert loc e : 'expr));
diff --git a/camlp4/ocaml_src/meta/q_MLast.ml b/camlp4/ocaml_src/meta/q_MLast.ml
index 116b1ce06..36ca1eb73 100644
--- a/camlp4/ocaml_src/meta/q_MLast.ml
+++ b/camlp4/ocaml_src/meta/q_MLast.ml
@@ -153,29 +153,6 @@ let mkassert loc e =
else Node ("ExIfe", [Loc; e; Node ("ExUid", [Loc; Str "()"]); raiser])
;;
-let mklazy loc e =
- Node
- ("ExApp",
- [Loc;
- Node
- ("ExAcc",
- [Loc; Node ("ExUid", [Loc; Str "Pervasives"]);
- Node ("ExLid", [Loc; Str "ref"])]);
- Node
- ("ExApp",
- [Loc;
- Node
- ("ExAcc",
- [Loc; Node ("ExUid", [Loc; Str "Lazy"]);
- Node ("ExUid", [Loc; Str "Delayed"])]);
- Node
- ("ExFun",
- [Loc;
- List
- [Tuple
- [Node ("PaUid", [Loc; Str "()"]); Option None; e]]])])])
-;;
-
let not_yet_warned = ref true;;
let warning_seq () =
if !not_yet_warned then
@@ -506,7 +483,7 @@ Grammar.extend
Tuple [xx1; xx2; xx3] -> xx1, xx2, xx3
| _ ->
match () with
- _ -> raise (Match_failure ("q_MLast.ml", 6297, 6313))
+ _ -> raise (Match_failure ("q_MLast.ml", 5892, 5908))
in
Node ("StExc", [Loc; c; tl; b]) :
'str_item));
@@ -741,7 +718,7 @@ Grammar.extend
Tuple [xx1; xx2; xx3] -> xx1, xx2, xx3
| _ ->
match () with
- _ -> raise (Match_failure ("q_MLast.ml", 8360, 8376))
+ _ -> raise (Match_failure ("q_MLast.ml", 7955, 7971))
in
Node ("SgExc", [Loc; c; tl]) :
'sig_item));
@@ -1272,7 +1249,8 @@ Grammar.extend
Some "apply", Some Gramext.LeftA,
[[Gramext.Stoken ("", "lazy"); Gramext.Sself],
Gramext.action
- (fun (e : 'expr) _ (loc : int * int) -> (mklazy loc e : 'expr));
+ (fun (e : 'expr) _ (loc : int * int) ->
+ (Node ("ExLaz", [Loc; e]) : 'expr));
[Gramext.Stoken ("", "assert"); Gramext.Sself],
Gramext.action
(fun (e : 'expr) _ (loc : int * int) -> (mkassert loc e : 'expr));