summaryrefslogtreecommitdiffstats
path: root/perl_checker.src/lexer.mll
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-11-28 00:57:32 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-11-28 00:57:32 +0000
commit4dca310579e9ba67f7a06591edabede5bbe13be6 (patch)
tree721e7e0208ae2a5020330e47687855a566cc633d /perl_checker.src/lexer.mll
parent87662a1e8b7376458625666dda3b6b4b7df6172e (diff)
downloadperl_checker-4dca310579e9ba67f7a06591edabede5bbe13be6.tar
perl_checker-4dca310579e9ba67f7a06591edabede5bbe13be6.tar.gz
perl_checker-4dca310579e9ba67f7a06591edabede5bbe13be6.tar.bz2
perl_checker-4dca310579e9ba67f7a06591edabede5bbe13be6.tar.xz
perl_checker-4dca310579e9ba67f7a06591edabede5bbe13be6.zip
*** empty log message ***
Diffstat (limited to 'perl_checker.src/lexer.mll')
-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 1e1c875..b295400 100644
--- a/perl_checker.src/lexer.mll
+++ b/perl_checker.src/lexer.mll
@@ -51,14 +51,14 @@ type raw_token =
and raw_interpolated_string = (string * raw_token list) list
-let rec concat_bareword_paren = function
+let rec concat_bareword_paren accu = function
| PRINT(s, pos1) :: PAREN(pos2) :: l
| BAREWORD(s, pos1) :: PAREN(pos2) :: l ->
- BAREWORD_PAREN(s, pos1) :: PAREN(pos2) :: concat_bareword_paren l
+ concat_bareword_paren (PAREN(pos2) :: BAREWORD_PAREN(s, pos1) :: accu) l
| RAW_IDENT(kind, ident, pos1) :: PAREN(pos2) :: l ->
- RAW_IDENT_PAREN(kind, ident, pos1) :: PAREN(pos2) :: concat_bareword_paren l
- | [] -> []
- | e :: l -> e :: concat_bareword_paren l
+ concat_bareword_paren (PAREN(pos2) :: RAW_IDENT_PAREN(kind, ident, pos1) :: accu) l
+ | [] -> List.rev accu
+ | e :: l -> concat_bareword_paren (e :: accu) l
let rec raw_token_to_pos_and_token spaces = function
| NUM(s, pos) -> pos, Parser.NUM(s, (spaces, pos))
@@ -188,7 +188,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_bareword_paren [] tokens in
let tokens = concat_spaces Space_0 tokens in
tokens
@@ -268,7 +268,7 @@ let string_interpolate token pre lexbuf =
let local_lexbuf = Lexing.from_string (pre ^ s ^ " ") in (* add a space to help tokenizing "xxx$$" *)
local_lexbuf.lex_abs_pos <- lexeme_start lexbuf ;
let l = lexbuf2list [] token local_lexbuf in
- let l = concat_bareword_paren l in
+ let l = concat_bareword_paren [] l in
next_interpolated l;
(Stack.pop next_rule) lexbuf