diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2004-10-13 07:53:24 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2004-10-13 07:53:24 +0000 |
commit | dbfca0b9ffbacfb1fba06e58e515afd072f925ea (patch) | |
tree | 5e14e7a074a6d287f82a7434119c5bf5695549f1 /perl_checker.src | |
parent | ddab763b2fbca2f1c2104dd33577ea694b6daedb (diff) | |
download | perl-MDK-Common-dbfca0b9ffbacfb1fba06e58e515afd072f925ea.tar perl-MDK-Common-dbfca0b9ffbacfb1fba06e58e515afd072f925ea.tar.gz perl-MDK-Common-dbfca0b9ffbacfb1fba06e58e515afd072f925ea.tar.bz2 perl-MDK-Common-dbfca0b9ffbacfb1fba06e58e515afd072f925ea.tar.xz perl-MDK-Common-dbfca0b9ffbacfb1fba06e58e515afd072f925ea.zip |
handle qx(...) and qx{...} with a warning
Diffstat (limited to 'perl_checker.src')
-rw-r--r-- | perl_checker.src/lexer.mll | 7 | ||||
-rw-r--r-- | perl_checker.src/test/syntax_restrictions.t | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/perl_checker.src/lexer.mll b/perl_checker.src/lexer.mll index f3b56e0..e21dd32 100644 --- a/perl_checker.src/lexer.mll +++ b/perl_checker.src/lexer.mll @@ -413,9 +413,13 @@ let set_delimit_char_open lexbuf op = let char_close = match char_open with | '(' -> ')' - | '{' -> warn lexbuf ("don't use " ^ op ^ "{...}, use " ^ op ^ "(...) instead") ; '}' + | '{' -> '}' | _ -> internal_error "set_delimit_char_open" in + if op = "qx" then + warn lexbuf (Printf.sprintf "don't use qx%c...%c, use `...` instead" char_open char_close) + else if char_open = '{' then + warn lexbuf ("don't use " ^ op ^ "{...}, use " ^ op ^ "(...) instead"); delimit_char_open := char_open; delimit_char_close := char_close } @@ -764,6 +768,7 @@ rule token = parse COMMAND_STRING(s, pos) } | "q" pattern_open { set_delimit_char_open lexbuf "q"; raw_ins_to_string qstring lexbuf } | "qq" pattern_open { set_delimit_char_open lexbuf "qq"; ins_to_string qqstring lexbuf } +| "qx" pattern_open { set_delimit_char_open lexbuf "qx"; ins_to_string qqstring lexbuf } | "qw" pattern_open { set_delimit_char_open lexbuf "qw"; let s, pos = raw_ins qstring lexbuf in QUOTEWORDS(s, pos) } | "\n__END__" [^ '0'-'9' 'A'-'Z' 'a'-'z' '_'] diff --git a/perl_checker.src/test/syntax_restrictions.t b/perl_checker.src/test/syntax_restrictions.t index c1292f7..6641b7b 100644 --- a/perl_checker.src/test/syntax_restrictions.t +++ b/perl_checker.src/test/syntax_restrictions.t @@ -12,7 +12,7 @@ q{xxx} don't use q{...}, use q(...) instead qq{xxx} don't use qq{...}, use qq(...) instead -qx(xxx) don't use qx{...}, use `...` instead +qx(xxx) don't use qx(...), use `...` instead -xxx don't use -xxx, use '-xxx' instead |