diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2002-12-11 14:33:22 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2002-12-11 14:33:22 +0000 |
commit | b852ba8ae186c776d03a44e4a63179a633aaeb52 (patch) | |
tree | 62a7fe7a56ddaaf8e4810c1e06d35955f7be76d9 /perl_checker.src | |
parent | 79601cc3e33299a7108ce5aea98147920cc58933 (diff) | |
download | perl_checker-b852ba8ae186c776d03a44e4a63179a633aaeb52.tar perl_checker-b852ba8ae186c776d03a44e4a63179a633aaeb52.tar.gz perl_checker-b852ba8ae186c776d03a44e4a63179a633aaeb52.tar.bz2 perl_checker-b852ba8ae186c776d03a44e4a63179a633aaeb52.tar.xz perl_checker-b852ba8ae186c776d03a44e4a63179a633aaeb52.zip |
add option "-t" enabling titi to precise tab-width=4
fix a bug in getting exported functions (fixes "unknown function gtkshow")
Diffstat (limited to 'perl_checker.src')
-rw-r--r-- | perl_checker.src/common.ml | 6 | ||||
-rw-r--r-- | perl_checker.src/flags.ml | 2 | ||||
-rw-r--r-- | perl_checker.src/flags.mli | 2 | ||||
-rw-r--r-- | perl_checker.src/perl_checker.ml | 9 |
4 files changed, 12 insertions, 7 deletions
diff --git a/perl_checker.src/common.ml b/perl_checker.src/common.ml index f84e027..9d21a48 100644 --- a/perl_checker.src/common.ml +++ b/perl_checker.src/common.ml @@ -760,16 +760,16 @@ let split_at2 c1 c2 s = split_at2_ [] 0 0 let words s = - let rec words_ accu i = + let rec words_ accu i s = try let i2 = non_index_from s i ' ' in try let i3 = String.index_from s i2 ' ' in - words_ (String.sub s i2 (i3 - i2) :: accu) (i3+1) + words_ (String.sub s i2 (i3 - i2) :: accu) (i3+1) s with Not_found -> rev (skip_n_char i2 s :: accu) with Invalid_argument _ -> rev accu in - words_ [] 0 + collect (words_ [] 0) (split_at '\n' s) let to_CamelCase s_ = let l = ref [] in diff --git a/perl_checker.src/flags.ml b/perl_checker.src/flags.ml index 613b58a..8c88b81 100644 --- a/perl_checker.src/flags.ml +++ b/perl_checker.src/flags.ml @@ -3,5 +3,5 @@ open Common let verbose = ref false let quiet = ref false let generate_pot = ref false -let expand_tabs = ref true +let expand_tabs = ref (Some 8) diff --git a/perl_checker.src/flags.mli b/perl_checker.src/flags.mli index 81045b1..d52b5fa 100644 --- a/perl_checker.src/flags.mli +++ b/perl_checker.src/flags.mli @@ -1,4 +1,4 @@ val verbose : bool ref val quiet : bool ref val generate_pot : bool ref -val expand_tabs : bool ref +val expand_tabs : int option ref diff --git a/perl_checker.src/perl_checker.ml b/perl_checker.src/perl_checker.ml index eac011f..6ad9ce2 100644 --- a/perl_checker.src/perl_checker.ml +++ b/perl_checker.src/perl_checker.ml @@ -27,7 +27,11 @@ let findfile dirs f = List.find Sys.file_exists (List.map (fun dir -> dir ^ "/" let rec parse_file state file = try if !Flags.verbose then print_endline_flush ("checking " ^ file) ; - let channel = Unix.open_process_in (Printf.sprintf "%s \"%s\"" (if !Flags.expand_tabs then "expand" else "cat") file) in + let command = + match !Flags.expand_tabs with + | Some width -> "expand -t " ^ string_of_int width + | None -> "cat" in + let channel = Unix.open_process_in (Printf.sprintf "%s \"%s\"" command file) in let lexbuf = Lexing.from_channel channel in try Info.start_a_new_file file ; @@ -77,12 +81,13 @@ let parse_options = let pot_file = ref "" in let generate_pot_chosen file = Flags.generate_pot := true ; - Flags.expand_tabs := false ; + Flags.expand_tabs := None ; pot_file := file in let options = [ "-v", Arg.Set Flags.verbose, " be verbose" ; "-q", Arg.Set Flags.quiet, " be quiet" ; + "-t", Arg.Int (fun i -> Flags.expand_tabs := Some i), " set the tabulation width (default is 8)" ; "--restrict-to-files", Arg.Set restrict_to_files, " only display warnings concerning the file(s) given on command line" ; "--generate-pot", Arg.String generate_pot_chosen, "" ; ] in |