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.h. All files
@@ -2,9 +2,9 @@ #define jq_yyHEADER_H 1 #define jq_yyIN_HEADER 1 -#line 6 "src/lexer.h"+#line 5 "src/lexer.h" -#line 8 "src/lexer.h"+#line 7 "src/lexer.h" #define YY_INT_ALIGNED short int @@ -732,9 +732,9 @@ extern int yylex \ #undef yyTABLES_NAME #endif -#line 137 "src/lexer.l"+#line 136 "src/lexer.l" -#line 739 "src/lexer.h"+#line 738 "src/lexer.h" #undef jq_yyIN_HEADER #endif /* jq_yyHEADER_H */