Skip to content

Fix: alternate operator (//) precedence (#3507)#3542

Open
CodeSasuke wants to merge 1 commit into
jqlang:masterfrom
CodeSasuke:fix-alternate-operator-precedence
Open

Fix: alternate operator (//) precedence (#3507)#3542
CodeSasuke wants to merge 1 commit into
jqlang:masterfrom
CodeSasuke:fix-alternate-operator-precedence

Conversation

@CodeSasuke
Copy link
Copy Markdown

Fixes #3507

Description:
The alternate operator // was declared with lower precedence than the assignment operator =, causing expressions like .[0] = null // 2 to be parsed incorrectly as (.[0] = null) // 2.

This PR moves the %right "//" directive below the %nonassoc '=' block in src/parser.y to bump the precedence of // above assignment.

Sign up for free to 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.

Strange x = y // z precedence

1 participant