From 91b031a8a34a64bbc9f89f543251ea8c1779917d Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 15 May 2006 12:49:55 +0000 Subject: it seems stack is smaller on amd64. function concat_spaces need to be tail-recursive --- perl_checker.src/lexer.mll | 14 +++++++------- 1 file 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 -- cgit v1.2.1