15 let lexbuf = Lexing.from_string s
in
17 match (try Sql_lexer.ruleStatement
Props.empty
lexbuf with exn
-> None
) with
18 | Some x
-> loop (x
::l
)
23 let parse_one (stmt
,props
) =
25 (* print_endline stmt; *)
26 Some
((Parser.parse_stmt stmt
), Props.set props
"sql" stmt
)
30 Error.log
"==> %s" stmt
;
34 let show_one ((s
,p
),props
) =
36 print_endline
(Stmt.params_to_string p
)
39 (* Tables.reset (); *)
40 s
>> statements >> L.map
parse_one
42 (* >> tee (L.iter show_one) *)
44 let with_file filename f
=
45 match catch
Std.input_file filename
with
46 | None
-> Error.log
"cannot open file : %s" filename