From 5bca2a0d0597006ed8414429d6619069ca39092d Mon Sep 17 00:00:00 2001
From: Pierre Wilke <pierre.wilke@centralesupelec.fr>
Date: Wed, 11 Mar 2020 16:50:45 +0100
Subject: [PATCH] =?UTF-8?q?Message=20d'erreur=20plus=20pr=C3=A9cis=20pour?=
 =?UTF-8?q?=20les=20caract=C3=A8res=20inattendus=20du=20lexer=20d'alpaga?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 alpaga/grammar_lexer.mll | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/alpaga/grammar_lexer.mll b/alpaga/grammar_lexer.mll
index effa0a6..5716c08 100644
--- a/alpaga/grammar_lexer.mll
+++ b/alpaga/grammar_lexer.mll
@@ -21,7 +21,10 @@ rule token = parse
   | "rules" { RULES }
   | id as s { IDENTIFIER s }
   | eof { EOF }
-  | _ as x { failwith (Printf.sprintf "unexpected char '%c'\n" x)}
+  | _ as x { let open Lexing in
+             failwith (Printf.sprintf "unexpected char '%c' at line %d col %d\n" x
+                         (lexbuf.lex_curr_p.pos_lnum)
+                         (lexbuf.lex_curr_p.pos_cnum - lexbuf.lex_curr_p.pos_bol))}
 and action level s = parse
   | '}' { if level = 0 then CODE s else action (level-1) (s ^ "}") lexbuf }
   | '{' { action (level + 1) (s ^ "{") lexbuf }
-- 
GitLab