Skip to content

Add warning for rules mixing positional and named references - #776

Open
ydah wants to merge 1 commit into
ruby:masterfrom
ydah:add-new-warning
Open

Add warning for rules mixing positional and named references#776
ydah wants to merge 1 commit into
ruby:masterfrom
ydah:add-new-warning

Conversation

@ydah

@ydahydah commented Feb 27, 2026

Copy link
Copy Markdown
Member

Add a new MixedReferences warning that detects rules where positional references and named references are used together in the same rule's semantic actions.

No warning (positional references only)

expr: NUM NUM
{
$$ = $1 + $2;
}
;

Warnings

expr[result]: NUM[left] NUM[right]
{
$result = $1 + $right;
}
;

also warning:

expr[result]: NUM
{
$1;
}
NUM[right]
{
$result = $right;
}
;

@ydah
ydahforce-pushed the add-new-warning branch 2 times, most recently from 964477b to c589cf0CompareFebruary 27, 2026 11:22
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@ydah