summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Doligez <damien.doligez-inria.fr>1997-04-16 13:19:12 +0000
committerDamien Doligez <damien.doligez-inria.fr>1997-04-16 13:19:12 +0000
commit49c4529bd23d3cc809a76162f7afcd3e5f134ba5 (patch)
tree845118a92857b6f312c5112fc7a62a33103b92b0
parentb5fc93c535764465f2f8384a455e9b4d412d567e (diff)
Fix de EOF dans les lexeurs, suite.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1506 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--byterun/lexing.c6
-rw-r--r--parsing/parse.ml6
2 files changed, 9 insertions, 3 deletions
diff --git a/byterun/lexing.c b/byterun/lexing.c
index 3efd46804..c5155587e 100644
--- a/byterun/lexing.c
+++ b/byterun/lexing.c
@@ -78,7 +78,6 @@ value lex_engine(tbl, start_state, lexbuf) /* ML */
return Val_int(-state - 1);
}else{
c = 256;
- lexbuf->lex_eof_reached = Val_int (0);
}
}else{
/* Read next input char */
@@ -98,6 +97,11 @@ value lex_engine(tbl, start_state, lexbuf) /* ML */
} else {
return lexbuf->lex_last_action;
}
+ }else{
+ /* Erase the EOF condition only if the EOF pseudo-character was
+ consumed by the automaton (i.e. there was no backtrack above)
+ */
+ if (c == 256) lexbuf->lex_eof_reached = Val_int (0);
}
}
}
diff --git a/parsing/parse.ml b/parsing/parse.ml
index 0908b0804..d59fc3da4 100644
--- a/parsing/parse.ml
+++ b/parsing/parse.ml
@@ -21,8 +21,10 @@ let rec skip_phrase lexbuf =
match Lexer.token lexbuf with
Parser.SEMISEMI | Parser.EOF -> ()
| _ -> skip_phrase lexbuf
- with Lexer.Error(_,_,_) ->
- skip_phrase lexbuf
+ with
+ | Lexer.Error (Lexer.Unterminated_comment, _, _) -> ()
+ | Lexer.Error (Lexer.Unterminated_string, _, _) -> ()
+ | Lexer.Error(_,_,_) -> skip_phrase lexbuf
let maybe_skip_phrase lexbuf =
if Parsing.is_current_lookahead Parser.SEMISEMI