@@ -4,7 +4,7 @@ Author: Bob Nystrom
4
4
5
5
Status: In progress
6
6
7
- Version 2.5 (see [ CHANGELOG] ( #CHANGELOG ) at end)
7
+ Version 2.6 (see [ CHANGELOG] ( #CHANGELOG ) at end)
8
8
9
9
Note: This proposal is broken into a couple of separate documents. See also
10
10
[ records] [ ] and [ exhaustiveness] [ ] .
@@ -214,8 +214,8 @@ Here is the overall grammar for the different kinds of patterns:
214
214
pattern ::= logicalOrPattern
215
215
patterns ::= pattern ( ',' pattern )* ','?
216
216
217
- logicalOrPattern ::= logicalAndPattern ( '|' logicalOrPattern )?
218
- logicalAndPattern ::= relationalPattern ( '&' logicalAndPattern )?
217
+ logicalOrPattern ::= ( logicalOrPattern '|' )? logicalAndPattern
218
+ logicalAndPattern ::= ( logicalAndPattern '&' )? relationalPattern
219
219
relationalPattern ::= ( equalityOperator | relationalOperator) relationalExpression
220
220
| unaryPattern
221
221
@@ -243,7 +243,7 @@ The individual patterns are:
243
243
### Logical-or pattern
244
244
245
245
```
246
- logicalOrPattern ::= logicalAndPattern ( '|' logicalOrPattern )?
246
+ logicalOrPattern ::= ( logicalOrPattern '|' )? logicalAndPattern
247
247
```
248
248
249
249
A pair of patterns separated by ` | ` matches if either of the branches match.
@@ -300,7 +300,7 @@ problems stemming from that, the following restrictions apply:
300
300
### Logical-and pattern
301
301
302
302
```
303
- logicalAndPattern ::= relationalPattern ( '&' logicalAndPattern )?
303
+ logicalAndPattern ::= ( logicalAndPattern '&' )? relationalPattern
304
304
```
305
305
306
306
A pair of patterns separated by ` & ` matches only if * both* subpatterns match.
@@ -2251,6 +2251,10 @@ Here is one way it could be broken down into separate pieces:
2251
2251
2252
2252
## Changelog
2253
2253
2254
+ ### 2.6
2255
+
2256
+ - Change logical-or and logical-and patterns to be left-associative.
2257
+
2254
2258
### 2.5
2255
2259
2256
2260
- Move back to a syntax where variable declarations are explicit in cases but
0 commit comments