summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-03 00:27:04 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-03 00:27:04 +0000
commita3ee54f8a653f2e7c8ea88ef5ee9f3a49a248447 (patch)
treebf8b7f1fc3fd56c92fd4e2418c3d8cd2d50bfe6b /parse.y
parentb907c6e925d82ad2903acd77edcf97635a7c6515 (diff)
downloadruby-a3ee54f8a653f2e7c8ea88ef5ee9f3a49a248447.tar.gz
parse.y: revert lbracket
* parse.y (lbracket): remove .? before aref. [Feature #11537] revert r52422 and r52424 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y33
1 files changed, 8 insertions, 25 deletions
diff --git a/parse.y b/parse.y
index 966690ba28..bbfcad7bb9 100644
--- a/parse.y
+++ b/parse.y
@@ -373,9 +373,6 @@ static int parser_yyerror(struct parser_params*, const char*);
#define NODE_CALL_Q(q) (((q) == tDOTQ) ? NODE_QCALL : NODE_CALL)
#define NEW_QCALL(q,r,m,a) NEW_NODE(NODE_CALL_Q(q),r,m,a)
-#define NO_QCALL(q, here) \
- ((q) != tDOTQ ? (void)0 : \
- (void)yyerror(".? in "here" is not supported yet"))
static int yylex(YYSTYPE*, struct parser_params*);
@@ -850,7 +847,7 @@ static void token_info_pop(struct parser_params*, const char *token, size_t len)
%type <node> mlhs mlhs_head mlhs_basic mlhs_item mlhs_node mlhs_post mlhs_inner
%type <id> fsym keyword_variable user_variable sym symbol operation operation2 operation3
%type <id> cname fname op f_rest_arg f_block_arg opt_f_block_arg f_norm_arg f_bad_arg
-%type <id> f_kwrest f_label f_arg_asgn call_op call_op2 lbracket
+%type <id> f_kwrest f_label f_arg_asgn call_op call_op2
/*%%%*/
/*%
%type <val> program reswords then do dot_or_colon
@@ -1246,15 +1243,11 @@ stmt : keyword_alias fitem {lex_state = EXPR_FNAME;} fitem
value_expr($3);
$$ = new_op_assign($1, $2, $3);
}
- | primary_value lbracket opt_call_args rbracket tOP_ASGN command_call
+ | primary_value '[' opt_call_args rbracket tOP_ASGN command_call
{
/*%%%*/
NODE *args;
- /*%
- %*/
- NO_QCALL($2, "lhs of op_asgn");
- /*%%%*/
value_expr($6);
if (!$3) $3 = NEW_ZARRAY();
args = arg_concat($3, $6);
@@ -1716,9 +1709,8 @@ mlhs_node : user_variable
{
$$ = assignable($1, 0);
}
- | primary_value lbracket opt_call_args rbracket
+ | primary_value '[' opt_call_args rbracket
{
- NO_QCALL($2, "mlhs");
/*%%%*/
$$ = aryset($1, $3);
/*%
@@ -1808,9 +1800,8 @@ lhs : user_variable
$$ = dispatch1(var_field, $$);
%*/
}
- | primary_value lbracket opt_call_args rbracket
+ | primary_value '[' opt_call_args rbracket
{
- NO_QCALL($2, "lhs");
/*%%%*/
$$ = aryset($1, $3);
/*%
@@ -2051,15 +2042,11 @@ arg : lhs '=' arg
%*/
$$ = new_op_assign($1, $2, $3);
}
- | primary_value lbracket opt_call_args rbracket tOP_ASGN arg
+ | primary_value '[' opt_call_args rbracket tOP_ASGN arg
{
/*%%%*/
NODE *args;
- /*%
- %*/
- NO_QCALL($2, "lhs of op_asgn");
- /*%%%*/
value_expr($6);
if (!$3) $3 = NEW_ZARRAY();
if (nd_type($3) == NODE_BLOCK_PASS) {
@@ -3754,13 +3741,13 @@ method_call : fcall paren_args
$$ = dispatch0(zsuper);
%*/
}
- | primary_value lbracket opt_call_args rbracket
+ | primary_value '[' opt_call_args rbracket
{
/*%%%*/
- if ($2 != tDOTQ && $1 && nd_type($1) == NODE_SELF)
+ if ($1 && nd_type($1) == NODE_SELF)
$$ = NEW_FCALL(tAREF, $3);
else
- $$ = NEW_QCALL($2, $1, tAREF, $3);
+ $$ = NEW_CALL($1, tAREF, $3);
fixpos($$, $1);
/*%
$$ = dispatch2(aref, $1, escape_Qundef($3));
@@ -5171,10 +5158,6 @@ opt_nl : /* none */
rparen : opt_nl ')'
;
-lbracket : '[' {$$ = 0;}
- | tDOTQ '[' {$$ = tDOTQ;}
- ;
-
rbracket : opt_nl ']'
;