summaryrefslogtreecommitdiffstats
path: root/perl_checker.src/perl_checker.ml
blob: 79b3ac9404c3d256860d57358bcc3ba70fac789c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
open Types

let _ = 
  let args = List.tl (Array.to_list Sys.argv) in
  let args = if args = [] then ["/tmp/t.pl"] else args in
  List.iter (fun file ->
    try
      let lexbuf = Lexing.from_channel (Unix.open_process_in (Printf.sprintf "expand \"%s\"" file)) in
      try
	Info.start_a_new_file file ;
	if false then
	  let t = Lexer.lexbuf2list (Lexer.concat_bareword_paren (Lexer.concat_spaces Lexer.token)) lexbuf in
	  let _,_ = t, t in ()
	else
	  let t = Parser.prog (Lexer.concat_bareword_paren (Lexer.concat_spaces Lexer.token)) lexbuf in
	  let _,_ = t, t in ()
      with Failure s -> (
	prerr_endline s ;
	exit 1
     )
    with _ -> prerr_endline ("bad file " ^ file)
  ) args