correctly after a (** comment *).
open MatitaTypes
exception Ambiguous_input
+(* the integer is an offset to be added to each location *)
exception DisambiguationError of
- (Token.flocation option * string Lazy.t) list list
+ int * (Token.flocation option * string Lazy.t) list list
type choose_uris_callback =
id:string -> UriManager.uri list -> UriManager.uri list
| [ pass ] ->
(try
set_aliases pass (try_pass pass)
- with Disambiguate.NoWellTypedInterpretation newerrors ->
- raise (DisambiguationError (errors @ [newerrors])))
+ with Disambiguate.NoWellTypedInterpretation (offset,newerrors) ->
+ raise (DisambiguationError (offset, errors @ [newerrors])))
| hd :: tl ->
(try
set_aliases hd (try_pass hd)
- with Disambiguate.NoWellTypedInterpretation newerrors ->
+ with Disambiguate.NoWellTypedInterpretation (_offset,newerrors) ->
aux (errors @ [newerrors]) tl)
| [] -> assert false
in
(** raised when ambiguous input is found but not expected (e.g. in the batch
* compiler) *)
exception Ambiguous_input
+(* the integer is an offset to be added to each location *)
exception DisambiguationError of
- (Token.flocation option * string Lazy.t) list list
+ int * (Token.flocation option * string Lazy.t) list list
type choose_uris_callback = id:string -> UriManager.uri list -> UriManager.uri list
type choose_interp_callback = (string * string) list list -> int list
with
| Cic.MutInd (uri, tyno, _) ->
(GrafiteAst.Type (uri, tyno) :: types)
- | _ -> raise (MatitaDisambiguator.DisambiguationError [[None,lazy "Decompose works only on inductive types"]]))
+ | _ -> raise (MatitaDisambiguator.DisambiguationError (0,[[None,lazy "Decompose works only on inductive types"]])))
in
let types = List.fold_left disambiguate [] types in
GrafiteAst.Decompose (loc, types, what, names)
None, "Type checking error: " ^ Lazy.force msg
| CicTypeChecker.AssertFailure msg ->
None, "Type checking assertion failed: " ^ Lazy.force msg
- | MatitaDisambiguator.DisambiguationError errorll ->
+ | MatitaDisambiguator.DisambiguationError (offset,errorll) ->
let rec aux n =
function
[] -> ""
None -> ""
| Some floc ->
let (x, y) = HExtlib.loc_of_floc floc in
- sprintf " at %d-%d" x y
+ sprintf " at %d-%d" (x+offset) (y+offset)
in
"*Error" ^ loc_descr ^ ": " ^ Lazy.force msg) phase) ^
"\n\n\n" in
let loc =
match errorll with
- ((Some _ as loc,_)::_)::_ -> loc
+ ((Some floc,_)::_)::_ ->
+ let (x, y) = HExtlib.loc_of_floc floc in
+ let x = x + offset in
+ let y = y + offset in
+ let flocb,floce = floc in
+ let floc =
+ {flocb with Lexing.pos_cnum = x}, {floce with Lexing.pos_cnum = y}
+ in
+ Some floc
| _ -> None
in
loc,
try
eval_statement buffer guistuff status user_goal script
(`Raw s)
- with HExtlib.Localized (floc, exn) ->
- HExtlib.raise_localized_exception
- ~offset:parsed_text_length floc exn
+ with
+ HExtlib.Localized (floc, exn) ->
+ HExtlib.raise_localized_exception ~offset:parsed_text_length floc exn
+ | MatitaDisambiguator.DisambiguationError (offset,errorll) ->
+ raise
+ (MatitaDisambiguator.DisambiguationError
+ (offset+parsed_text_length, errorll))
in
(match s with
| (status, (text, ast)) :: tl ->
open DisambiguateTypes
open UriManager
+(* the integer is an offset to be added to each location *)
exception NoWellTypedInterpretation of
- (Token.flocation option * string Lazy.t) list
+ int * (Token.flocation option * string Lazy.t) list
exception PathNotWellFormed
(** raised when an environment is not enough informative to decide *)
try
let res =
match aux aliases [] None todo_dom base_univ with
- | [],errors -> raise (NoWellTypedInterpretation errors)
+ | [],errors -> raise (NoWellTypedInterpretation (0,errors))
| [_,diff,metasenv,t,ugraph],_ ->
debug_print (lazy "SINGLE INTERPRETATION");
[diff,metasenv,t,ugraph], false
(** {2 Disambiguation interface} *)
+(* the integer is an offset to be added to each location *)
exception NoWellTypedInterpretation of
- (Token.flocation option * string Lazy.t) list
+ int * (Token.flocation option * string Lazy.t) list
exception PathNotWellFormed
val interpretate_path :