summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2006-05-15 12:49:55 +0000
committerPascal Rigaux <pixel@mandriva.com>2006-05-15 12:49:55 +0000
commit91b031a8a34a64bbc9f89f543251ea8c1779917d (patch)
tree9bf5bf8db355411ed1f582dbff60406d8181be64
parentbfe69b02ea6502de4e39e4a54183489cef89c093 (diff)
downloadperl_checker-91b031a8a34a64bbc9f89f543251ea8c1779917d.tar
perl_checker-91b031a8a34a64bbc9f89f543251ea8c1779917d.tar.gz
perl_checker-91b031a8a34a64bbc9f89f543251ea8c1779917d.tar.bz2
perl_checker-91b031a8a34a64bbc9f89f543251ea8c1779917d.tar.xz
perl_checker-91b031a8a34a64bbc9f89f543251ea8c1779917d.zip
it seems stack is smaller on amd64. function concat_spaces need to be tail-recursive
-rw-r--r--perl_checker.src/lexer.mll14
1 files changed, 7 insertions, 7 deletions
diff --git a/perl_checker.src/lexer.mll b/perl_checker.src/lexer.mll
index 389a179..f90ed25 100644
--- a/perl_checker.src/lexer.mll
+++ b/perl_checker.src/lexer.mll
@@ -209,10 +209,10 @@ and raw_token_to_token spaces raw_token =
token
and raw_interpolated_string_to_tokens l =
- List.map (fun (s, rtok) -> s, concat_spaces Space_0 rtok) l
+ List.map (fun (s, rtok) -> s, concat_spaces [] Space_0 rtok) l
-and concat_spaces spaces = function
- | CR :: l -> concat_spaces Space_cr l
+and concat_spaces ret spaces = function
+ | CR :: l -> concat_spaces ret Space_cr l
| SPACE n :: l ->
let spaces' =
match spaces with
@@ -220,9 +220,9 @@ and concat_spaces spaces = function
| Space_0 -> if n = 1 then Space_1 else Space_n
| _ -> Space_n
in
- concat_spaces spaces' l
- | [] -> []
- | token :: l -> raw_token_to_pos_and_token spaces token :: concat_spaces Space_0 l
+ concat_spaces ret spaces' l
+ | [] -> List.rev ret
+ | token :: l -> concat_spaces (raw_token_to_pos_and_token spaces token :: ret) Space_0 l
let rec lexbuf2list accu t lexbuf =
match t lexbuf with
@@ -232,7 +232,7 @@ let rec lexbuf2list accu t lexbuf =
let get_token token lexbuf =
let tokens = lexbuf2list [] token lexbuf in
let tokens = concat_bareword_paren [] tokens in
- let tokens = concat_spaces Space_0 tokens in
+ let tokens = concat_spaces [] Space_0 tokens in
let tokens = bracket_bareword_is_hashref [] tokens in
tokens