diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-07-09 08:40:46 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-07-09 08:40:46 +0000 |
commit | 3c1d5b89c33546028fce534546b8e356369ee231 (patch) | |
tree | fb658b101bf9a045c488663f2cbc6b3a178bbd3e /parse.y | |
parent | 528b1f5237bc4e031228a27c00cdd679319f2472 (diff) |
1.1b9_30
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 50 |
1 files changed, 23 insertions, 27 deletions
@@ -32,12 +32,12 @@ #define ID_ATTRSET 0x04 #define ID_CONST 0x05 -#define is_id_nonop(id) ((id)>LAST_TOKEN) -#define is_local_id(id) (is_id_nonop(id)&&((id)&ID_SCOPE_MASK)==ID_LOCAL) -#define is_global_id(id) (is_id_nonop(id)&&((id)&ID_SCOPE_MASK)==ID_GLOBAL) -#define is_instance_id(id) (is_id_nonop(id)&&((id)&ID_SCOPE_MASK)==ID_INSTANCE) -#define is_attrset_id(id) (is_id_nonop(id)&&((id)&ID_SCOPE_MASK)==ID_ATTRSET) -#define is_const_id(id) (is_id_nonop(id)&&((id)&ID_SCOPE_MASK)==ID_CONST) +#define is_id_notop(id) ((id)>LAST_TOKEN) +#define is_local_id(id) (is_id_notop(id)&&((id)&ID_SCOPE_MASK)==ID_LOCAL) +#define is_global_id(id) (is_id_notop(id)&&((id)&ID_SCOPE_MASK)==ID_GLOBAL) +#define is_instance_id(id) (is_id_notop(id)&&((id)&ID_SCOPE_MASK)==ID_INSTANCE) +#define is_attrset_id(id) (is_id_notop(id)&&((id)&ID_SCOPE_MASK)==ID_ATTRSET) +#define is_const_id(id) (is_id_notop(id)&&((id)&ID_SCOPE_MASK)==ID_CONST) struct op_tbl { ID token; @@ -600,10 +600,12 @@ arg : variable '=' arg } } if ($2 == tOROP) { - $$ = NEW_UNLESS(gettable($1), assignable($1, $3), 0); + $$ = NEW_OP_ASGN_OR(gettable($1), + assignable($1, $3)); } else if ($2 == tANDOP) { - $$ = NEW_IF(gettable($1), assignable($1, $3), 0); + $$ = NEW_OP_ASGN_AND(gettable($1), + assignable($1, $3)); } else { $$ = assignable($1,call_op(gettable($1),$2,1,$3)); @@ -612,45 +614,39 @@ arg : variable '=' arg } | primary '[' aref_args ']' tOP_ASGN arg { + NODE *args = NEW_LIST($6); + + list_append($3, NEW_NIL()); + list_concat(args, $3); if ($5 == tOROP) { - $$ = NEW_UNLESS(NEW_CALL($1, tAREF, $3), aryset($1, $3, $6), 0); + $5 = 0; } else if ($5 == tANDOP) { - $$ = NEW_IF(NEW_CALL($1, tAREF, $3), aryset($1, $3, $6), 0); - } - else { - NODE *args = NEW_LIST($6); - - list_append($3, NEW_NIL()); - list_concat(args, $3); - $$ = NEW_OP_ASGN1($1, $5, args); + $5 = 1; } + $$ = NEW_OP_ASGN1($1, $5, args); fixpos($$, $1); } | primary '.' tIDENTIFIER tOP_ASGN arg { if ($4 == tOROP) { - $$ = NEW_UNLESS(new_call($1, $3, 0), attrset($1, $3, $5), 0); + $4 = 0; } else if ($4 == tANDOP) { - $$ = NEW_IF(new_call($1, $3, 0), attrset($1, $3, $5), 0); - } - else { - $$ = NEW_OP_ASGN2($1, $3, $4, $5); + $4 = 1; } + $$ = NEW_OP_ASGN2($1, $3, $4, $5); fixpos($$, $1); } | primary '.' tCONSTANT tOP_ASGN arg { if ($4 == tOROP) { - $$ = NEW_UNLESS(new_call($1, $3, 0), attrset($1, $3, $5), 0); + $4 = 0; } else if ($4 == tANDOP) { - $$ = NEW_IF(new_call($1, $3, 0), attrset($1, $3, $5), 0); - } - else { - $$ = NEW_OP_ASGN2($1, $3, $4, $5); + $4 = 1; } + $$ = NEW_OP_ASGN2($1, $3, $4, $5); fixpos($$, $1); } | backref tOP_ASGN arg |