summaryrefslogtreecommitdiffstats
path: root/camlp4/compile
diff options
context:
space:
mode:
authorMichel Mauny <Michel.Mauny@ensta.fr>2004-05-12 15:22:48 +0000
committerMichel Mauny <Michel.Mauny@ensta.fr>2004-05-12 15:22:48 +0000
commit77b491c3bc3a6513dda841da9f92db454b9267ce (patch)
tree7eadc7a93a675c8a2be0ab4b8e35a2717a4d00b6 /camlp4/compile
parentc9840b7dd728b2fbaab8fb7b86f55b0638edd307 (diff)
Introduction of OCaml "new" locations
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@6290 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'camlp4/compile')
-rw-r--r--camlp4/compile/compile.ml16
1 files changed, 11 insertions, 5 deletions
diff --git a/camlp4/compile/compile.ml b/camlp4/compile/compile.ml
index 5fff04b27..af478774f 100644
--- a/camlp4/compile/compile.ml
+++ b/camlp4/compile/compile.ml
@@ -8,7 +8,10 @@ open Gramext;
value strict_parsing = ref False;
value keywords = ref [];
-value loc = (0, 0);
+value loc =
+ let nowhere =
+ {(Lexing.dummy_pos) with Lexing.pos_lnum = 1; Lexing.pos_cnum = 0 } in
+ (nowhere,nowhere);
(* Watch the segmentation faults here! the compiled file must have been
loaded in camlp4 with the option pa_extend.cmo -meta_action. *)
@@ -101,7 +104,7 @@ value nth_patt_of_act (e, n) =
let patt_list =
loop e where rec loop =
fun
- [ <:expr< fun (loc : (int * int)) -> $_$ >> -> []
+ [ <:expr< fun (loc : (Lexing.position * Lexing.position)) -> $_$ >> -> []
| <:expr< fun ($p$ : $_$) -> $e$ >> -> [p :: loop e]
| <:expr< fun $p$ -> $e$ >> -> [p :: loop e]
| _ -> failwith "nth_patt_of_act" ]
@@ -111,14 +114,14 @@ value nth_patt_of_act (e, n) =
value rec last_patt_of_act =
fun
- [ <:expr< fun ($p$ : $_$) (loc : (int * int)) -> $_$ >> -> p
+ [ <:expr< fun ($p$ : $_$) (loc : (Lexing.position * Lexing.position)) -> $_$ >> -> p
| <:expr< fun $_$ -> $e$ >> -> last_patt_of_act e
| _ -> failwith "last_patt_of_act" ]
;
value rec final_action =
fun
- [ <:expr< fun (loc : (int * int)) -> ($e$ : $_$) >> -> e
+ [ <:expr< fun (loc : (Lexing.position * Lexing.position)) -> ($e$ : $_$) >> -> e
| <:expr< fun $_$ -> $e$ >> -> final_action e
| _ -> failwith "final_action" ]
;
@@ -560,7 +563,10 @@ value compile () =
$expr_list list$
>>
in
- let loc = (1, 1) in
+ let loc =
+ let l1 =
+ {(Lexing.dummy_pos) with Lexing.pos_lnum = 1; Lexing.pos_cnum = 1 } in
+ (l1,l1) in
([(si1, loc); (si2, loc)], False)
;