let arg_spec = [ "-level", Arg.Set_int level, "set the notation level" ] in
let usage = "test_parser -level { 1 | 2 | 3 }" in
Arg.parse arg_spec (fun _ -> raise (Arg.Bad usage)) usage;
- let parse_fun =
+ let parse_fun s =
match !level with
- | 1 -> CicNotationParser.parse_syntax_pattern
- | 2 -> CicNotationParser.parse_ast_pattern
- | 3 -> CicNotationParser.parse_interpretation
+ | 1 -> ignore (CicNotationParser.parse_syntax_pattern s)
+ | 2 -> ignore (CicNotationParser.parse_ast_pattern s)
+ | 3 -> ignore (CicNotationParser.parse_interpretation s)
| _ -> Arg.usage arg_spec usage; exit 1
in
let ic = stdin in
let line = input_line ic in
let istream = Stream.of_string line in
try
- let _ = parse_fun istream in
+ parse_fun istream;
print_endline "ok"
with CicNotationParser.Parse_error (floc, msg) ->
let (x, y) = loc_of_floc floc in