diff options
author | Damien Doligez <damien.doligez-inria.fr> | 2014-08-22 13:45:02 +0000 |
---|---|---|
committer | Damien Doligez <damien.doligez-inria.fr> | 2014-08-22 13:45:02 +0000 |
commit | cbfe627f925ab2bab93bae7a7bc9f6ee6afb8637 (patch) | |
tree | af5ec283ac3175b1ab95dd745dbd05f2298b9da6 /parsing/syntaxerr.ml | |
parent | 09ad9c1abbe6bee443a55379223280dab3de4749 (diff) |
merge changes from branch 4.02 from branching (rev 14852) to 4.02.0+rc1 (rev 15121)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15125 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'parsing/syntaxerr.ml')
-rw-r--r-- | parsing/syntaxerr.ml | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/parsing/syntaxerr.ml b/parsing/syntaxerr.ml index e239d6fe2..8c2f37b35 100644 --- a/parsing/syntaxerr.ml +++ b/parsing/syntaxerr.ml @@ -19,6 +19,7 @@ type error = | Applicative_path of Location.t | Variable_in_scope of Location.t * string | Other of Location.t + | Ill_formed_ast of Location.t * string exception Error of error exception Escape_error @@ -51,6 +52,8 @@ let prepare_error = function var var | Other loc -> Location.error ~loc "Error: Syntax error" + | Ill_formed_ast (loc, s) -> + Location.errorf ~loc "Error: broken invariant in parsetree: %s" s let () = Location.register_error_of_exn @@ -69,4 +72,9 @@ let location_of_error = function | Variable_in_scope(l,_) | Other l | Not_expecting (l, _) + | Ill_formed_ast (l, _) | Expecting (l, _) -> l + + +let ill_formed_ast loc s = + raise (Error (Ill_formed_ast (loc, s))) |