Fix assignment priority
The assignment operator is lower priority than any other binary operator. Otherwise the following: ```tiger a := b | c ``` Would be parsed as: ```tiger (a := b) | c ``` Instead of the expected: ```tiger a := (b | c) ```
This commit is contained in:
parent
869b0bf79a
commit
21172e21e7
4 changed files with 1223 additions and 1203 deletions
12
grammar.js
12
grammar.js
|
|
@ -7,12 +7,12 @@ function sepBy(sep, rule) {
|
|||
}
|
||||
|
||||
const PREC = {
|
||||
assign: 6,
|
||||
multiplicative: 5,
|
||||
additive: 4,
|
||||
comparative: 3,
|
||||
and: 2,
|
||||
or: 1,
|
||||
multiplicative: 6,
|
||||
additive: 5,
|
||||
comparative: 4,
|
||||
and: 3,
|
||||
or: 2,
|
||||
assign: 1,
|
||||
};
|
||||
|
||||
module.exports = grammar({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue