bitwise operator precedence is wrong #27

Closed
opened 2024-01-10 03:18:03 +01:00 by jedwards1211 · 1 comment
jedwards1211 commented 2024-01-10 03:18:03 +01:00 (Migrated from github.com)

This probably doesn't affect anything this grammar is being used for, but FWIW...

The grammar defines precedence

  bitOr @left,
  bitXor @left,
  bitAnd @left,

But according to MDN the correct precedence is

7: bitwise AND left-to-right Bitwise ANDx & y
6: bitwise XOR left-to-right Bitwise XORx ^ y
5: bitwise OR left-to-right Bitwise ORx | y
This probably doesn't affect anything this grammar is being used for, but FWIW... The grammar defines precedence ``` bitOr @left, bitXor @left, bitAnd @left, ``` But [according to MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_precedence) the correct precedence is 7: bitwise AND | left-to-right | Bitwise ANDx & y -- | -- | -- 6: bitwise XOR | left-to-right | Bitwise XORx ^ y 5: bitwise OR | left-to-right | Bitwise ORx \| y
marijnh commented 2024-01-10 09:51:59 +01:00 (Migrated from github.com)

Thanks for spotting that. Merged.

Thanks for spotting that. Merged.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lezer/javascript#27
No description provided.