diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 1997-08-22 08:55:41 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 1997-08-22 08:55:41 +0000 |
commit | 579e1523e94f7fef3d11346207161beea667b9dc (patch) | |
tree | c41dd7d0041ef03ce58e40772b3a3ac612c9e7f7 /parsing/parse.ml | |
parent | 23686e53207f43ee1b913095acc964063a36281f (diff) |
Meilleures erreurs de syntaxe pour les parentheses mal fermees, etc
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1689 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'parsing/parse.ml')
-rw-r--r-- | parsing/parse.ml | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/parsing/parse.ml b/parsing/parse.ml index 02a9a56fa..a04571f01 100644 --- a/parsing/parse.ml +++ b/parsing/parse.ml @@ -13,7 +13,8 @@ (* Entry points in the parser *) -exception Error of int * int (* Syntax error *) +open Location + (* Skip tokens to the end of the phrase *) let rec skip_phrase lexbuf = @@ -43,12 +44,15 @@ let wrap parsing_fun lexbuf = | Lexer.Error(_, _, _) as err -> if !Location.input_name = "" then skip_phrase lexbuf; raise err + | Syntaxerr.Error _ as err -> + if !Location.input_name = "" then maybe_skip_phrase lexbuf; + raise err | Parsing.Parse_error -> - let start = Lexing.lexeme_start lexbuf - and stop = Lexing.lexeme_end lexbuf in + let loc = { loc_start = Lexing.lexeme_start lexbuf; + loc_end = Lexing.lexeme_end lexbuf } in if !Location.input_name = "" then maybe_skip_phrase lexbuf; - raise(Error(start, stop)) + raise(Syntaxerr.Error(Syntaxerr.Other loc)) let implementation = wrap Parser.implementation and interface = wrap Parser.interface |