Parse ?// as ? and // outside destructuring patterns (#3593)
The lexer returned a single ALTERNATION token for `?//`, so any `?` followed by `//` was consumed by it, and `.name?//"unknown"` failed to parse even though they read as the optional operator followed by the alternative operator. Drop the lexer rule and spell the destructuring alternative operator as `'?' "//"` instead. So `x ?// y` now parses as `x? // y`, while `. as [$a] ?// [$b] | ...` keeps its meaning. Note that `?` and `//` may now be separated by whitespaces inside a pattern.
This commit is contained in:
1 parent
f13c1effbf
commit
a19efdd45d
7 files changed
+1277
-1297
No files matched your search
@@ -1485,6 +1485,11 @@ try error(0) // 1
|
||||
null
|
||||
1
|
||||
|
||||
# Lex token test #3589, like error(0)? // 1
|
||||
error(0) ?// 1
|
||||
null
|
||||
1
|
||||
|
||||
1, try error(2), 3
|
||||
null
|
||||
1
|
||||
|
||||
Reference in new issue
Block a user