From 3a54bb00dd2420b2710c2f90e1c0c4cf9c267175 Mon Sep 17 00:00:00 2001 From: Hugo Herbelin Date: Tue, 12 Apr 2016 20:33:51 +0200 Subject: 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. --- parsing/compat.ml4 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'parsing') 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 -- cgit v1.2.3