From a111de16c12a9f5efb075b32a108597301c22da7 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 22 Jun 2006 12:07:50 +0000 Subject: don't suggest replacing \Q with Q, warn "don't use \\Q, use quotemeta instead" instead --- perl_checker.src/lexer.mll | 3 +++ 1 file changed, 3 insertions(+) diff --git a/perl_checker.src/lexer.mll b/perl_checker.src/lexer.mll index aca8d03..f416499 100644 --- a/perl_checker.src/lexer.mll +++ b/perl_checker.src/lexer.mll @@ -914,6 +914,9 @@ and string_escape = parse | 'x' [^ '{'] _ { string_escape_useful := Left true; hex_in_string lexbuf next_rule (skip_n_char 1 (lexeme lexbuf)) } | '\n' { die lexbuf "do not use \"\\\" before end-of-line, it's useless and generally bad" } | '\\'{ next_s "\\" (Stack.pop next_rule) lexbuf } +| 'Q' { + warn [Warn_complex_expressions] lexbuf ("don't use \\Q, use quotemeta instead"); + string_escape_useful := Left true; next_s ("\\" ^ lexeme lexbuf) (Stack.pop next_rule) lexbuf } | ['b' 'f' 'a' 'r'] { string_escape_useful := Left true; next_s ("\\" ^ lexeme lexbuf) (Stack.pop next_rule) lexbuf } | ['$' '@' '%' '{' '[' ':'] { if !string_escape_useful = Left false then string_escape_useful := Right (lexeme_char lexbuf 0) ; -- cgit v1.2.1