Skip to content
Snippets Groups Projects
Commit 5bca2a0d authored by Wilke Pierre's avatar Wilke Pierre
Browse files

Message d'erreur plus précis pour les caractères inattendus du lexer d'alpaga

parent 350cb09b
No related branches found
No related tags found
No related merge requests found
......@@ -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 }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment