From dc5032ed00875c1cf4f978ddeb07e5967f9488f8 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 5 Feb 2003 13:12:04 +0000 Subject: allow -x with no parameter, but advise not to use it --- perl_checker.src/lexer.mll | 2 +- perl_checker.src/parser.mly | 1 + perl_checker.src/parser_helper.ml | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) (limited to 'perl_checker.src') 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 -- cgit v1.2.1