diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2004-08-11 02:34:55 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2004-08-11 02:34:55 +0000 |
commit | 52958e76f2c154b20367a509b0d9919231522563 (patch) | |
tree | 570db8092584b6ec0a991ab10ef1f7fb892654b3 | |
parent | 65df1801fe6cc17fb0a8c14d3870261df40bade2 (diff) | |
download | perl-MDK-Common-52958e76f2c154b20367a509b0d9919231522563.tar perl-MDK-Common-52958e76f2c154b20367a509b0d9919231522563.tar.gz perl-MDK-Common-52958e76f2c154b20367a509b0d9919231522563.tar.bz2 perl-MDK-Common-52958e76f2c154b20367a509b0d9919231522563.tar.xz perl-MDK-Common-52958e76f2c154b20367a509b0d9919231522563.zip |
partially fix { xxx() }->{$foo}
-rw-r--r-- | perl_checker.src/parser.mly | 10 | ||||
-rw-r--r-- | perl_checker.src/test/context.t | 4 |
2 files changed, 11 insertions, 3 deletions
diff --git a/perl_checker.src/parser.mly b/perl_checker.src/parser.mly index aa2c1d2..ffc6c40 100644 --- a/perl_checker.src/parser.mly +++ b/perl_checker.src/parser.mly @@ -231,9 +231,9 @@ term: | term ASSIGN term {sp_same $2 $3; let pri = P_assign in to_Call_op_ (mcontext_op_assign $1 $3) pri $2.any [$1.any.expr ; prio_lo_after pri $3] $1 $3} -| term ASSIGN BRACKET expr BRACKET_END {sp_p($2); sp_p($3); sp_p($4); sp_p($5); to_Call_op_ (M_mixed [M_ref M_hash; M_none]) P_assign $2.any [prio_lo P_assign $1; hash_ref $4] $1 $5} -| term AND_TIGHT BRACKET expr BRACKET_END {sp_p($2); sp_p($3); sp_p($4); sp_p($5); to_Call_op_ M_bool P_tight_and "&&" [prio_lo P_assign $1; hash_ref $4] $1 $5} -| term OR_TIGHT BRACKET expr BRACKET_END {sp_p($2); sp_p($3); sp_p($4); sp_p($5); to_Call_op_ M_bool P_tight_or "||" [prio_lo P_assign $1; hash_ref $4] $1 $5} +| term ASSIGN BRACKET expr_bracket_end {sp_p($2); sp_p($3); sp_p($4); to_Call_op_ (M_mixed [M_ref M_hash; M_none]) P_assign $2.any [prio_lo P_assign $1; $4.any] $1 $4} +| term AND_TIGHT BRACKET expr_bracket_end {sp_p($2); sp_p($3); sp_p($4); to_Call_op_ M_bool P_tight_and "&&" [prio_lo P_assign $1; $4.any] $1 $4} +| term OR_TIGHT BRACKET expr_bracket_end {sp_p($2); sp_p($3); sp_p($4); to_Call_op_ M_bool P_tight_or "||" [prio_lo P_assign $1; $4.any] $1 $4} | term PATTERN_MATCH PATTERN {sp_n($2); sp_p($3); check_unneeded_var_dollar_ ($1); mcontext_check M_string $1; to_Call_op_ M_array P_expr "m//" ($1.any.expr :: from_PATTERN $3) $1 $3} @@ -354,6 +354,10 @@ term: | terminal {$1} +expr_bracket_end: +| expr BRACKET_END { sp_p($2); new_esp (M_ref M_hash) (hash_ref $1) $1 $2 } +| expr BRACKET_END ARROW bracket_subscript {sp_p($2); sp_0($3); new_esp M_unknown_scalar (to_Deref_with(I_hash, I_scalar, hash_ref $1, $4.any)) $1 $4} /* { foo }->{Bar} */ + terminal: | word {word_alone $1} | NUM {new_1pesp P_tok (Num($1.any, get_pos $1)) $1} diff --git a/perl_checker.src/test/context.t b/perl_checker.src/test/context.t index 637360e..081abcc 100644 --- a/perl_checker.src/test/context.t +++ b/perl_checker.src/test/context.t @@ -35,3 +35,7 @@ qw(a b) > 2 context tuple(string, string) is not co you should use a number operator, not the string operator "eq" (or replace the number with a string) @l == () + +$xxx = { xxx() }->{xxx}; + +$xxx = { xxx() }->{$xxx}; |