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:
A4-Tacks authored and GitHub committed 2026-10-06 16:48:28 +09:00
1 parent f13c1effbf
commit a19efdd45d
7 files changed
+1277 -1297

No files matched your search

+5
View File
@@ -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