aboutsummaryrefslogtreecommitdiffhomepage
path: root/parsing
diff options
context:
space:
mode:
authorGravatar Hugo Herbelin <Hugo.Herbelin@inria.fr>2016-04-12 20:33:51 +0200
committerGravatar Hugo Herbelin <Hugo.Herbelin@inria.fr>2016-04-12 20:39:58 +0200
commit3a54bb00dd2420b2710c2f90e1c0c4cf9c267175 (patch)
tree3e19290394bb9ca36853c452f769f7720ca4f272 /parsing
parent927e88de465e94bf18b970b45faaf97b4c2dff82 (diff)
A fix to #4666 (Exc_located capsule added by camlp5 overwriting
location set by lexer). This improves on abb4e7b0c by recovering the lexer location. AFAICS, it has an effect on lexer's errors Unterminated_comment and Unterminated_string. The other errors were not wrongly located, presumably because the Exc_located location added by camlp5 coincided with the location given by the lexer.
Diffstat (limited to 'parsing')
-rw-r--r--parsing/compat.ml46
1 files changed, 5 insertions, 1 deletions
diff --git a/parsing/compat.ml4 b/parsing/compat.ml4
index d1d55c81f..17038ab5f 100644
--- a/parsing/compat.ml4
+++ b/parsing/compat.ml4
@@ -193,7 +193,11 @@ module GrammarMake (L:LexerSig) : GrammarSig = struct
let entry_create = Entry.create
let entry_parse e p =
try Entry.parse e p
- with Exc_located (loc,e) -> Loc.raise (to_coqloc loc) e
+ with Exc_located (loc,e) ->
+ let loc' = Loc.get_loc (Exninfo.info e) in
+ let loc = match loc' with None -> to_coqloc loc | Some loc -> loc in
+ Loc.raise loc e
+
IFDEF CAMLP5_6_02_1 THEN
let entry_print ft x = Entry.print ft x
ELSE