summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Doligez <damien.doligez-inria.fr>2002-11-12 17:47:54 +0000
committerDamien Doligez <damien.doligez-inria.fr>2002-11-12 17:47:54 +0000
commit51233b6e8323e7a8dcc1b82b140490466465b6a3 (patch)
tree97018152010d5ce8e6173e8a4e63f9c9990cbcac
parent14041887440e0f20c78e4aff66a9dc223fa41c90 (diff)
changement des locations, bug trouve par DDR
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5258 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--stdlib/lexing.ml16
1 files changed, 10 insertions, 6 deletions
diff --git a/stdlib/lexing.ml b/stdlib/lexing.ml
index 4d2abeae7..d7d73e505 100644
--- a/stdlib/lexing.ml
+++ b/stdlib/lexing.ml
@@ -61,18 +61,22 @@ external c_engine: lex_tables -> int -> lexbuf -> int = "lex_engine"
external c_new_engine: lex_tables -> int -> lexbuf -> int = "new_lex_engine"
let engine tbl state buf =
- buf.lex_start_p <- buf.lex_curr_p;
let result = c_engine tbl state buf in
- buf.lex_curr_p <- {buf.lex_curr_p
- with pos_cnum = buf.lex_abs_pos + buf.lex_curr_pos};
+ if result >= 0 then begin
+ buf.lex_start_p <- buf.lex_curr_p;
+ buf.lex_curr_p <- {buf.lex_curr_p
+ with pos_cnum = buf.lex_abs_pos + buf.lex_curr_pos};
+ end;
result
;;
let new_engine tbl state buf =
- buf.lex_start_p <- buf.lex_curr_p;
let result = c_new_engine tbl state buf in
- buf.lex_curr_p <- {buf.lex_curr_p
- with pos_cnum = buf.lex_abs_pos + buf.lex_curr_pos};
+ if result >= 0 then begin
+ buf.lex_start_p <- buf.lex_curr_p;
+ buf.lex_curr_p <- {buf.lex_curr_p
+ with pos_cnum = buf.lex_abs_pos + buf.lex_curr_pos};
+ end;
result
;;