summaryrefslogtreecommitdiffstats
path: root/perl_checker.src
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-02-05 13:12:04 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-02-05 13:12:04 +0000
commitdc5032ed00875c1cf4f978ddeb07e5967f9488f8 (patch)
treefc1dbda442551ee186d330b66b85f931a5586e9b /perl_checker.src
parent614de482fdec9cf87bf6e8599ae65ac5433e3273 (diff)
downloadperl_checker-dc5032ed00875c1cf4f978ddeb07e5967f9488f8.tar
perl_checker-dc5032ed00875c1cf4f978ddeb07e5967f9488f8.tar.gz
perl_checker-dc5032ed00875c1cf4f978ddeb07e5967f9488f8.tar.bz2
perl_checker-dc5032ed00875c1cf4f978ddeb07e5967f9488f8.tar.xz
perl_checker-dc5032ed00875c1cf4f978ddeb07e5967f9488f8.zip
allow -x with no parameter, but advise not to use it
Diffstat (limited to 'perl_checker.src')
-rw-r--r--perl_checker.src/lexer.mll2
-rw-r--r--perl_checker.src/parser.mly1
-rw-r--r--perl_checker.src/parser_helper.ml7
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