@ 261102.1

261006.1 · a19efdd45dfe91329a7d266efb2ac0a64279a938

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.

reading declarations

Changes to src/lexer.l. All files

src/lexer.l

@@ -77,7 +77,6 @@ struct lexer_param; "<=" { return LESSEQ; } ">=" { return GREATEREQ; } ".." { return REC; }-"?//" { return ALTERNATION; } "."|"?"|"="|";"|","|":"|"|"|"+"|"-"|"*"|"/"|"%"|"\$"|"<"|">" { return yytext[0];}  "["|"{"|"(" {