Refactor parse.y to replace tIDENTIFIER and tCONSTANT with ident_or_const inline rules

This commit is contained in:
ydah 2024-10-03 23:02:03 +09:00 committed by Yudai Takada
parent 27e61e2df7
commit 5cc4240dda
Notes: git 2025-01-03 13:13:39 +00:00

15
parse.y
View File

@ -3650,7 +3650,7 @@ mlhs_node : user_or_keyword_variable
$$ = aryset(p, $1, $3, &@$);
/*% ripper: aref_field!($:1, $:3) %*/
}
| primary_value call_op tIDENTIFIER
| primary_value call_op ident_or_const
{
anddot_multiple_assignment_check(p, &@2, $2);
$$ = attrset(p, $1, $2, $3, &@$);
@ -3661,12 +3661,6 @@ mlhs_node : user_or_keyword_variable
$$ = attrset(p, $1, idCOLON2, $3, &@$);
/*% ripper: const_path_field!($:1, $:3) %*/
}
| primary_value call_op tCONSTANT
{
anddot_multiple_assignment_check(p, &@2, $2);
$$ = attrset(p, $1, $2, $3, &@$);
/*% ripper: field!($:1, $:2, $:3) %*/
}
| primary_value tCOLON2 tCONSTANT
{
/*% ripper: const_path_field!($:1, $:3) %*/
@ -3847,12 +3841,7 @@ arg : lhs '=' lex_ctxt arg_rhs
$$ = new_ary_op_assign(p, $1, $3, $5, $7, &@3, &@$, &NULL_LOC, &@2, &@4, &@5);
/*% ripper: opassign!(aref_field!($:1, $:3), $:5, $:7) %*/
}
| primary_value call_op tIDENTIFIER tOP_ASGN lex_ctxt arg_rhs
{
$$ = new_attr_op_assign(p, $1, $2, $3, $4, $6, &@$, &@2, &@3, &@4);
/*% ripper: opassign!(field!($:1, $:2, $:3), $:4, $:6) %*/
}
| primary_value call_op tCONSTANT tOP_ASGN lex_ctxt arg_rhs
| primary_value call_op ident_or_const tOP_ASGN lex_ctxt arg_rhs
{
$$ = new_attr_op_assign(p, $1, $2, $3, $4, $6, &@$, &@2, &@3, &@4);
/*% ripper: opassign!(field!($:1, $:2, $:3), $:4, $:6) %*/