diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2003-02-05 13:12:04 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2003-02-05 13:12:04 +0000 |
commit | 24b0e8d64df95dd066d33b622c07f469e47c102a (patch) | |
tree | 2415cfeac7e6532108ba88a4db01652abe550f18 | |
parent | 2a83a79c244e034ebbb76fc8fe875517377790d0 (diff) | |
download | perl-MDK-Common-24b0e8d64df95dd066d33b622c07f469e47c102a.tar perl-MDK-Common-24b0e8d64df95dd066d33b622c07f469e47c102a.tar.gz perl-MDK-Common-24b0e8d64df95dd066d33b622c07f469e47c102a.tar.bz2 perl-MDK-Common-24b0e8d64df95dd066d33b622c07f469e47c102a.tar.xz perl-MDK-Common-24b0e8d64df95dd066d33b622c07f469e47c102a.zip |
allow -x with no parameter, but advise not to use it
-rw-r--r-- | perl_checker.src/lexer.mll | 2 | ||||
-rw-r--r-- | perl_checker.src/parser.mly | 1 | ||||
-rw-r--r-- | perl_checker.src/parser_helper.ml | 7 |
3 files changed, 9 insertions, 1 deletions
diff --git a/perl_checker.src/lexer.mll b/perl_checker.src/lexer.mll index 424a422..e5d8af5 100644 --- a/perl_checker.src/lexer.mll +++ b/perl_checker.src/lexer.mll @@ -586,7 +586,7 @@ rule token = parse | ident ":" { LABEL(lexeme lexbuf, pos lexbuf) } -| '-' [ 'a'-'z' 'A'-'Z' ] [ ' ' '(' ] { putback lexbuf 1; ONE_SCALAR_PARA(lexeme lexbuf, pos lexbuf) } +| '-' [ 'a'-'z' 'A'-'Z' ] [ ' ' '(' ';' ] { putback lexbuf 1; ONE_SCALAR_PARA(lexeme lexbuf, pos lexbuf) } | ['0'-'9'] ['0'-'9' '_']* ('.' ['0'-'9'] ['0'-'9' '_']*)+ | 'v' ['0'-'9'] ['0'-'9' '_']* ('.' ['0'-'9'] ['0'-'9' '_']*)* diff --git a/perl_checker.src/parser.mly b/perl_checker.src/parser.mly index 47aebfe..080295c 100644 --- a/perl_checker.src/parser.mly +++ b/perl_checker.src/parser.mly @@ -257,6 +257,7 @@ term: | ONE_SCALAR_PARA restricted_subscripted {call_one_scalar_para $1 [fst $2], sp_pos_range $1 $2} | ONE_SCALAR_PARA parenthesized {call_one_scalar_para $1 (sndfst $2), sp_pos_range $1 $2} | ONE_SCALAR_PARA word_paren parenthesized {call_one_scalar_para $1 [call(Deref(I_func, fst $2), sndfst $3)], sp_pos_range $1 $3} +| ONE_SCALAR_PARA {call_one_scalar_para $1 [], snd $1} /* Constructors for anonymous data */ diff --git a/perl_checker.src/parser_helper.ml b/perl_checker.src/parser_helper.ml index e1633fb..9230074 100644 --- a/perl_checker.src/parser_helper.ml +++ b/perl_checker.src/parser_helper.ml @@ -606,6 +606,13 @@ let call(e, para) = call_func false (e, para) let call_one_scalar_para (e, (_, pos)) para = + let para = + match para with + | [] -> + warn_rule (sprintf "please use \"%s $_\" instead of \"%s\"" e e) ; + [var_dollar_ (raw_pos2pos pos)] + | _ -> para + in let pri = match e with | "defined" -> P_expr |