diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2003-09-30 21:35:05 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2003-09-30 21:35:05 +0000 |
commit | acc88e52f399dbc121170ab7ec3b0d4b99d58a72 (patch) | |
tree | 49f8642ed6944891f5068fe1dd4ee6f4af9ac92b /perl_checker.src/common.ml | |
parent | 0b850271c67750aa15d413152863286a0b949e56 (diff) | |
download | perl-MDK-Common-acc88e52f399dbc121170ab7ec3b0d4b99d58a72.tar perl-MDK-Common-acc88e52f399dbc121170ab7ec3b0d4b99d58a72.tar.gz perl-MDK-Common-acc88e52f399dbc121170ab7ec3b0d4b99d58a72.tar.bz2 perl-MDK-Common-acc88e52f399dbc121170ab7ec3b0d4b99d58a72.tar.xz perl-MDK-Common-acc88e52f399dbc121170ab7ec3b0d4b99d58a72.zip |
disallow s/foo/die "bar \"zzz\"/e
Diffstat (limited to 'perl_checker.src/common.ml')
-rw-r--r-- | perl_checker.src/common.ml | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/perl_checker.src/common.ml b/perl_checker.src/common.ml index ee989dc..e30dc20 100644 --- a/perl_checker.src/common.ml +++ b/perl_checker.src/common.ml @@ -561,6 +561,8 @@ let rec transpose = function let rec range min max = if min >= max then [] else min :: range (min + 1) max +let sum l = List.fold_left (+) 0 l + let rec filter_some_with f = function | [] -> [] | e :: l -> @@ -745,6 +747,15 @@ let char_is_number c = let i = Char.code c in Char.code '0' <= i && i <= Char.code '9' +let count_chars_in_string s c = + let rec rec_count_chars_in_string from = + try + let from' = String.index_from s from c in + 1 + rec_count_chars_in_string (from' + 1) + with + Not_found -> 0 + in rec_count_chars_in_string 0 + let rec string_forall_with f i s = try f s.[i] && string_forall_with f (i+1) s |