14 let lexbuf = Lexing.from_string s
in
16 match (try Sql_lexer.ruleStatement
Props.empty
lexbuf with exn
-> None
) with
17 | Some x
-> loop (x
::l
)
22 let parse_one (stmt
,props
) =
24 (* print_endline stmt; *)
25 Some
((Parser.parse_stmt stmt
), Props.set props
"sql" stmt
)
29 prerr_endline
(Printexc.to_string exn
);
33 let show_one ((s
,p
),props
) =
35 print_endline
(Stmt.params_to_string p
)
37 let catch f x
= try Some
(f x
) with _
-> None
42 s
>> statements >> L.map
parse_one
44 (* >> tee (L.iter show_one) *)
47 let with_file filename f
=
48 match catch Std.input_file filename
with
49 | None
-> Error.log
"cannot open file : %s" filename