From fd1c1502ab59cd8a392af86376be99b0dc6b6b1f Mon Sep 17 00:00:00 2001 From: Kathy Gray Date: Mon, 14 Dec 2015 15:55:50 +0000 Subject: Adding new location constructor for location of generated terms --- src/sail_lib.ml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/sail_lib.ml b/src/sail_lib.ml index d1a5b891..4cfc1331 100644 --- a/src/sail_lib.ml +++ b/src/sail_lib.ml @@ -19,11 +19,12 @@ let parse_exps s = let msg = Printf.sprintf "syntax error on character %d" pos.Lexing.pos_cnum in failwith msg | Parse_ast.Parse_error_locn(l,m) -> - let loc = match l with + let rec format l = match l with | Parse_ast.Unknown -> "???" | Parse_ast.Range(p1,p2) -> Printf.sprintf "%d:%d" p1.Lexing.pos_cnum p2.Lexing.pos_cnum - | Parse_ast.Int(s,_) -> Printf.sprintf "code generated by: %s" s in - let msg = Printf.sprintf "syntax error: %s %s" loc m in + | Parse_ast.Generated l -> Printf.sprintf "code generated near: %s" (format l) + | Parse_ast.Int(s,_) -> Printf.sprintf "code for by: %s" s in + let msg = Printf.sprintf "syntax error: %s %s" (format l) m in failwith msg | Lexer.LexError(s,p) -> let msg = Printf.sprintf "lexing error: %s %d" s p.Lexing.pos_cnum in -- cgit v1.2.3