summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-10-13 03:54:20 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-10-13 03:54:20 +0000
commitc983f1a4ba682583f9e586e686729fe572c2cc64 (patch)
treec72af5da83f4307bc729fa5dcf7954e3b7992586
parent0c86ac32772aa6ae9733f834e639fe1997c24168 (diff)
downloadperl_checker-c983f1a4ba682583f9e586e686729fe572c2cc64.tar
perl_checker-c983f1a4ba682583f9e586e686729fe572c2cc64.tar.gz
perl_checker-c983f1a4ba682583f9e586e686729fe572c2cc64.tar.bz2
perl_checker-c983f1a4ba682583f9e586e686729fe572c2cc64.tar.xz
perl_checker-c983f1a4ba682583f9e586e686729fe572c2cc64.zip
transform m@...@ and m:...: from errors into warnings (since we can handle it quite cleanly)
-rw-r--r--perl_checker.src/lexer.mll13
1 files changed, 8 insertions, 5 deletions
diff --git a/perl_checker.src/lexer.mll b/perl_checker.src/lexer.mll
index 10c3dc7..211238b 100644
--- a/perl_checker.src/lexer.mll
+++ b/perl_checker.src/lexer.mll
@@ -397,10 +397,12 @@ let hex_in_string lexbuf next_rule s =
next_s s (Stack.pop next_rule) lexbuf
let set_delimit_char lexbuf op =
- match lexeme_char lexbuf (String.length op) with
- | '@' -> die lexbuf ("don't use " ^ op ^ "@...@, replace @ with / ! , or |")
- | ':' -> die lexbuf ("don't use " ^ op ^ ":...:, replace : with / ! , or |")
- | c -> delimit_char := c
+ let c = lexeme_char lexbuf (String.length op) in
+ delimit_char := c;
+ match c with
+ | '@' -> warn lexbuf ("don't use " ^ op ^ "@...@, replace @ with / ! , or |")
+ | ':' -> warn lexbuf ("don't use " ^ op ^ ":...:, replace : with / ! , or |")
+ | _ -> ()
}
let stash = [ '$' '@' '%' '&' '*' ]
@@ -778,7 +780,8 @@ and delimited_string = parse
and re_delimited_string = parse
| '\\' { Stack.push re_delimited_string next_rule ; re_string_escape lexbuf }
| '$' { Stack.push re_delimited_string next_rule ; delimited_string_interpolate_scalar lexbuf }
-| '@' { Stack.push re_delimited_string next_rule ; delimited_string_interpolate_array lexbuf }
+| '@' { if lexeme_char lexbuf 0 <> !delimit_char then
+ (Stack.push re_delimited_string next_rule ; delimited_string_interpolate_array lexbuf) }
| '\n' {
add_a_new_line(lexeme_end lexbuf);
next re_delimited_string lexbuf