Skip to content
Snippets Groups Projects
Commit 47ca7fe2 authored by Augustin Jaujay's avatar Augustin Jaujay
Browse files

Question 7 pour de vrai

parent c5312543
No related branches found
No related tags found
No related merge requests found
......@@ -19,9 +19,9 @@
| DIV -> print_string "DIV"
| REM -> print_string "REM"
let mk_int nb =
let mk_int nb lexbuf =
try INT (int_of_string nb)
with Failure _ -> failwith (Printf.sprintf "Illegal integer '%s': " nb)
with Failure _ -> failwith (Location.string_of (Location.curr lexbuf))
}
let newline = (['\n' '\r'] | "\r\n")
......@@ -39,7 +39,7 @@ rule token = parse
(* comments *)
| "--" not_newline_char* { token lexbuf }
(* integers *)
| digit+ as nb { mk_int nb }
| digit+ as nb { mk_int nb lexbuf }
(* commands *)
| "push" {PUSH}
| "pop" {POP}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment