diff options
author | Luc Maranget <luc.maranget@inria.fr> | 2001-04-30 18:08:22 +0000 |
---|---|---|
committer | Luc Maranget <luc.maranget@inria.fr> | 2001-04-30 18:08:22 +0000 |
commit | 046e095ec2d93ac8d5a60f1a6933bb51cdf1ded0 (patch) | |
tree | 97b788cdfcd27b02069657028f5a64e3954c2d54 | |
parent | 157c4e54c9fd3e5ce83bd67072b74217937e42b2 (diff) | |
download | ocaml-046e095ec2d93ac8d5a60f1a6933bb51cdf1ded0.tar.gz |
stupid bug in offsets (Switch)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3495 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rwxr-xr-x | boot/ocamlc | bin | 771980 -> 771996 bytes | |||
-rwxr-xr-x | boot/ocamllex | bin | 86729 -> 86729 bytes | |||
-rw-r--r-- | bytecomp/switch.ml | 13 | ||||
-rw-r--r-- | test/Moretest/morematch.ml | 20 |
4 files changed, 29 insertions, 4 deletions
diff --git a/boot/ocamlc b/boot/ocamlc Binary files differindex 245f47d29c..ce9f5337d7 100755 --- a/boot/ocamlc +++ b/boot/ocamlc diff --git a/boot/ocamllex b/boot/ocamllex Binary files differindex d52a226a68..d7c786a4c1 100755 --- a/boot/ocamllex +++ b/boot/ocamllex diff --git a/bytecomp/switch.ml b/bytecomp/switch.ml index 94bd585bba..f14d5a64bc 100644 --- a/bytecomp/switch.ml +++ b/bytecomp/switch.ml @@ -483,9 +483,9 @@ let make_if_out konst ctx l d mk_ifso mk_ifno = match l with (konst d) ctx.arg (mk_ifso ctx) (mk_ifno ctx) | _ -> Arg.bind - (Arg.make_offset ctx.arg (-l-ctx.off)) + (Arg.make_offset ctx.arg (-l)) (fun arg -> - let ctx = {off= (-l) ; arg=arg} in + let ctx = {off= (-l+ctx.off) ; arg=arg} in do_make_if_out (konst d) arg (mk_ifso ctx) (mk_ifno ctx)) @@ -498,9 +498,9 @@ let make_if_in konst ctx l d mk_ifso mk_ifno = match l with (konst d) ctx.arg (mk_ifso ctx) (mk_ifno ctx) | _ -> Arg.bind - (Arg.make_offset ctx.arg (-l-ctx.off)) + (Arg.make_offset ctx.arg (-l)) (fun arg -> - let ctx = {off= (-l) ; arg=arg} in + let ctx = {off= (-l+ctx.off) ; arg=arg} in do_make_if_in (konst d) arg (mk_ifso ctx) (mk_ifno ctx)) @@ -513,6 +513,11 @@ let rec c_test konst ctx ({cases=cases ; actions=actions} as s) = else begin let w,c = opt_count false cases in +(* + Printf.fprintf stderr + "off=%d tactic=%a for %a\n" + ctx.off pret w pcases cases ; +*) match w with | No -> actions.(get_act cases 0) ctx | Inter (i,j) -> diff --git a/test/Moretest/morematch.ml b/test/Moretest/morematch.ml index ce857d60d3..e27834aa5f 100644 --- a/test/Moretest/morematch.ml +++ b/test/Moretest/morematch.ml @@ -721,3 +721,23 @@ test "eber" eber {x=1 ; y=0 ; z=false} 0 ; () ;; +(* Enchainement des test d'intervalle *) + +let escaped = function + | '"' | '\\' | '\n' | '\t' -> 2 + | c -> 1 +;; + +test "escaped" escaped '"' 2 ; +test "escaped" escaped '\\' 2 ; +test "escaped" escaped '\n' 2 ; +test "escaped" escaped '\t' 2 ; +test "escaped" escaped '\000' 1 ; +test "escaped" escaped ' ' 1 ; +test "escaped" escaped '\000' 1 ; +test "escaped" escaped '[' 1 ; +test "escaped" escaped ']' 1 ; +test "escaped" escaped '!' 1 ; +test "escaped" escaped '#' 1 ; +() +;; |