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:
Bruno BELANYI 2022-06-04 20:41:23 +02:00
parent 869b0bf79a
commit 21172e21e7
4 changed files with 1223 additions and 1203 deletions

View file

@ -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({