Introduce inline_primary rule

Introduce inline_primary rule to merge the same BNF pattern
This commit is contained in:
S.H. 2024-10-25 22:26:29 +09:00 committed by GitHub
parent 9c8c140d73
commit d278d352f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
Notes: git 2024-10-25 13:26:48 +00:00
Merged: https://github.com/ruby/ruby/pull/11881

Merged-By: nobu <nobu@ruby-lang.org>

15
parse.y
View File

@ -4374,7 +4374,8 @@ mrhs : args ',' arg_value
}
;
primary : literal
%rule %inline inline_primary
: literal
| strings
| xstring
| regexp
@ -4382,6 +4383,9 @@ primary : literal
| qwords
| symbols
| qsymbols
;
primary : inline_primary
| var_ref
| backref
| tFID
@ -5863,14 +5867,7 @@ p_value : p_primitive
}
;
p_primitive : literal
| strings
| xstring
| regexp
| words
| qwords
| symbols
| qsymbols
p_primitive : inline_primary
| keyword_variable
{
if (!($$ = gettable(p, $1, &@$))) $$ = NEW_ERROR(&@$);