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
Generated
+182
-187
@@ -1,6 +1,6 @@
|
|||||||
#line 2 "src/lexer.c"
|
#line 1 "src/lexer.c"
|
||||||
|
|
||||||
#line 4 "src/lexer.c"
|
#line 3 "src/lexer.c"
|
||||||
|
|
||||||
#define YY_INT_ALIGNED short int
|
#define YY_INT_ALIGNED short int
|
||||||
|
|
||||||
@@ -573,8 +573,8 @@ static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner );
|
|||||||
yyg->yy_hold_char = *yy_cp; \
|
yyg->yy_hold_char = *yy_cp; \
|
||||||
*yy_cp = '\0'; \
|
*yy_cp = '\0'; \
|
||||||
yyg->yy_c_buf_p = yy_cp;
|
yyg->yy_c_buf_p = yy_cp;
|
||||||
#define YY_NUM_RULES 53
|
#define YY_NUM_RULES 52
|
||||||
#define YY_END_OF_BUFFER 54
|
#define YY_END_OF_BUFFER 53
|
||||||
/* This struct is not used in this scanner,
|
/* This struct is not used in this scanner,
|
||||||
but its presence is necessary. */
|
but its presence is necessary. */
|
||||||
struct yy_trans_info
|
struct yy_trans_info
|
||||||
@@ -582,26 +582,26 @@ struct yy_trans_info
|
|||||||
flex_int32_t yy_verify;
|
flex_int32_t yy_verify;
|
||||||
flex_int32_t yy_nxt;
|
flex_int32_t yy_nxt;
|
||||||
};
|
};
|
||||||
static const flex_int16_t yy_accept[171] =
|
static const flex_int16_t yy_accept[168] =
|
||||||
{ 0,
|
{ 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 54, 52, 51, 51, 52, 42,
|
0, 0, 0, 0, 53, 51, 50, 50, 51, 41,
|
||||||
1, 37, 37, 38, 39, 37, 37, 37, 37, 37,
|
1, 36, 36, 37, 38, 36, 36, 36, 36, 36,
|
||||||
37, 41, 37, 37, 37, 37, 52, 48, 48, 48,
|
36, 40, 36, 36, 36, 51, 47, 47, 47, 47,
|
||||||
48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
|
47, 47, 47, 47, 47, 47, 47, 47, 47, 36,
|
||||||
37, 46, 46, 44, 47, 2, 3, 2, 2, 51,
|
45, 45, 43, 46, 2, 3, 2, 2, 50, 4,
|
||||||
4, 50, 50, 31, 29, 27, 28, 35, 41, 49,
|
49, 49, 31, 29, 27, 28, 35, 40, 48, 20,
|
||||||
20, 30, 41, 41, 0, 33, 5, 34, 0, 40,
|
30, 40, 40, 0, 33, 5, 34, 39, 47, 0,
|
||||||
48, 0, 48, 6, 48, 48, 48, 48, 48, 48,
|
47, 6, 47, 47, 47, 47, 47, 47, 11, 47,
|
||||||
11, 48, 48, 48, 48, 16, 48, 48, 48, 26,
|
47, 47, 47, 16, 47, 47, 47, 26, 45, 44,
|
||||||
|
|
||||||
46, 45, 43, 45, 3, 2, 0, 50, 0, 50,
|
42, 44, 3, 2, 0, 49, 0, 49, 48, 32,
|
||||||
49, 32, 41, 0, 41, 36, 0, 15, 48, 48,
|
40, 0, 40, 0, 15, 47, 47, 10, 47, 47,
|
||||||
10, 48, 48, 17, 48, 48, 48, 48, 48, 48,
|
17, 47, 47, 47, 47, 47, 47, 47, 21, 0,
|
||||||
48, 21, 0, 45, 0, 50, 48, 48, 48, 14,
|
44, 0, 49, 47, 47, 47, 14, 13, 47, 47,
|
||||||
13, 48, 48, 48, 48, 48, 48, 12, 45, 50,
|
47, 47, 47, 47, 12, 44, 49, 24, 22, 47,
|
||||||
24, 22, 48, 48, 48, 23, 48, 48, 45, 50,
|
47, 47, 23, 47, 47, 44, 49, 47, 7, 47,
|
||||||
48, 7, 48, 9, 18, 50, 19, 8, 25, 0
|
9, 18, 49, 19, 8, 25, 0
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static const YY_CHAR yy_ec[256] =
|
static const YY_CHAR yy_ec[256] =
|
||||||
@@ -646,147 +646,147 @@ static const YY_CHAR yy_meta[54] =
|
|||||||
1, 1, 1
|
1, 1, 1
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static const flex_int16_t yy_base[186] =
|
static const flex_int16_t yy_base[183] =
|
||||||
{ 0,
|
{ 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
51, 52, 56, 58, 340, 341, 61, 64, 317, 341,
|
51, 52, 56, 58, 338, 339, 61, 64, 315, 339,
|
||||||
341, 307, 315, 341, 341, 314, 313, 341, 312, 53,
|
339, 305, 313, 339, 339, 312, 311, 339, 310, 53,
|
||||||
53, 56, 311, 310, 309, 313, 0, 310, 54, 57,
|
53, 56, 309, 308, 307, 0, 309, 54, 57, 58,
|
||||||
58, 59, 63, 65, 70, 67, 72, 69, 60, 79,
|
59, 63, 65, 70, 67, 72, 69, 60, 79, 305,
|
||||||
306, 0, 0, 341, 83, 341, 341, 324, 107, 116,
|
0, 0, 339, 83, 339, 339, 323, 107, 116, 339,
|
||||||
341, 307, 83, 341, 341, 341, 341, 341, 103, 0,
|
306, 83, 339, 339, 339, 339, 339, 103, 0, 302,
|
||||||
303, 341, 104, 108, 128, 341, 341, 341, 307, 0,
|
339, 104, 108, 128, 339, 339, 339, 0, 304, 301,
|
||||||
304, 301, 110, 297, 114, 75, 115, 108, 118, 119,
|
110, 297, 114, 75, 115, 108, 118, 119, 293, 109,
|
||||||
293, 109, 123, 129, 132, 290, 137, 130, 139, 341,
|
123, 129, 132, 290, 137, 130, 139, 339, 0, 276,
|
||||||
|
|
||||||
0, 276, 341, 273, 341, 341, 297, 278, 265, 140,
|
339, 273, 339, 339, 297, 278, 265, 140, 0, 339,
|
||||||
0, 341, 142, 261, 258, 341, 0, 252, 142, 145,
|
142, 261, 258, 0, 252, 142, 145, 250, 149, 144,
|
||||||
250, 149, 144, 247, 151, 152, 154, 156, 157, 158,
|
247, 151, 152, 154, 156, 157, 158, 165, 245, 172,
|
||||||
165, 245, 172, 231, 0, 166, 222, 164, 171, 221,
|
231, 0, 166, 222, 164, 171, 221, 220, 169, 172,
|
||||||
220, 169, 172, 174, 175, 178, 179, 218, 206, 180,
|
174, 175, 178, 179, 218, 206, 180, 215, 214, 181,
|
||||||
215, 214, 181, 183, 192, 213, 184, 186, 201, 193,
|
183, 192, 213, 184, 186, 201, 193, 198, 210, 206,
|
||||||
198, 210, 206, 209, 89, 207, 86, 81, 37, 341,
|
209, 89, 207, 86, 81, 37, 339, 242, 250, 253,
|
||||||
242, 250, 253, 259, 264, 269, 277, 285, 290, 295,
|
259, 264, 269, 277, 285, 290, 295, 300, 302, 307,
|
||||||
300, 302, 307, 311, 315
|
311, 315
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static const flex_int16_t yy_def[186] =
|
static const flex_int16_t yy_def[183] =
|
||||||
{ 0,
|
{ 0,
|
||||||
170, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
167, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
171, 171, 172, 172, 170, 170, 170, 170, 170, 170,
|
168, 168, 169, 169, 167, 167, 167, 167, 167, 167,
|
||||||
170, 173, 170, 170, 170, 170, 170, 170, 170, 174,
|
167, 170, 167, 167, 167, 167, 167, 167, 167, 171,
|
||||||
170, 170, 170, 170, 170, 170, 175, 176, 176, 176,
|
167, 167, 167, 167, 167, 172, 173, 173, 173, 173,
|
||||||
176, 176, 176, 176, 176, 176, 176, 176, 176, 176,
|
173, 173, 173, 173, 173, 173, 173, 173, 173, 167,
|
||||||
170, 177, 177, 170, 178, 170, 170, 170, 170, 170,
|
174, 174, 167, 175, 167, 167, 167, 167, 167, 167,
|
||||||
170, 179, 179, 170, 170, 170, 170, 170, 170, 180,
|
176, 176, 167, 167, 167, 167, 167, 167, 177, 167,
|
||||||
170, 170, 170, 170, 170, 170, 170, 170, 170, 175,
|
167, 167, 167, 167, 167, 167, 167, 172, 173, 167,
|
||||||
176, 170, 176, 176, 176, 176, 176, 176, 176, 176,
|
173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
|
||||||
176, 176, 176, 176, 176, 176, 176, 176, 176, 170,
|
173, 173, 173, 173, 173, 173, 173, 167, 174, 167,
|
||||||
|
|
||||||
177, 170, 170, 181, 170, 170, 170, 179, 170, 179,
|
167, 178, 167, 167, 167, 176, 167, 176, 177, 167,
|
||||||
180, 170, 170, 170, 170, 170, 182, 176, 176, 176,
|
167, 167, 167, 179, 173, 173, 173, 173, 173, 173,
|
||||||
176, 176, 176, 176, 176, 176, 176, 176, 176, 176,
|
173, 173, 173, 173, 173, 173, 173, 173, 173, 175,
|
||||||
176, 176, 178, 183, 173, 179, 176, 176, 176, 176,
|
180, 170, 176, 173, 173, 173, 173, 173, 173, 173,
|
||||||
176, 176, 176, 176, 176, 176, 176, 176, 184, 179,
|
173, 173, 173, 173, 173, 181, 176, 173, 173, 173,
|
||||||
176, 176, 176, 176, 176, 176, 176, 176, 185, 179,
|
173, 173, 173, 173, 173, 182, 176, 173, 173, 173,
|
||||||
176, 176, 176, 176, 176, 179, 176, 176, 179, 0,
|
173, 173, 176, 173, 173, 176, 0, 167, 167, 167,
|
||||||
170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
|
167, 167, 167, 167, 167, 167, 167, 167, 167, 167,
|
||||||
170, 170, 170, 170, 170
|
167, 167
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static const flex_int16_t yy_nxt[395] =
|
static const flex_int16_t yy_nxt[393] =
|
||||||
{ 0,
|
{ 0,
|
||||||
16, 17, 18, 17, 19, 20, 21, 22, 23, 24,
|
16, 17, 18, 17, 19, 20, 21, 22, 23, 24,
|
||||||
25, 26, 27, 28, 29, 30, 31, 32, 28, 28,
|
25, 26, 27, 28, 29, 30, 31, 32, 28, 28,
|
||||||
33, 34, 35, 36, 37, 38, 38, 24, 16, 25,
|
33, 34, 35, 28, 36, 37, 37, 24, 16, 25,
|
||||||
38, 39, 40, 41, 42, 43, 44, 38, 45, 38,
|
37, 38, 39, 40, 41, 42, 43, 37, 44, 37,
|
||||||
46, 47, 38, 48, 38, 49, 38, 50, 38, 38,
|
45, 46, 37, 47, 37, 48, 37, 49, 37, 37,
|
||||||
24, 51, 25, 53, 53, 109, 54, 54, 57, 58,
|
24, 50, 25, 52, 52, 107, 53, 53, 56, 57,
|
||||||
57, 58, 60, 60, 60, 60, 60, 60, 68, 71,
|
56, 57, 59, 59, 59, 59, 59, 59, 67, 70,
|
||||||
69, 73, 82, 74, 72, 82, 82, 82, 82, 55,
|
68, 72, 80, 73, 71, 80, 80, 80, 80, 54,
|
||||||
55, 82, 75, 82, 59, 82, 59, 82, 82, 86,
|
54, 80, 74, 80, 58, 80, 58, 80, 80, 84,
|
||||||
82, 75, 103, 82, 87, 97, 83, 82, 94, 82,
|
80, 74, 101, 80, 85, 95, 81, 80, 92, 80,
|
||||||
|
|
||||||
84, 109, 85, 88, 82, 89, 91, 82, 90, 106,
|
82, 107, 83, 86, 80, 87, 89, 80, 88, 104,
|
||||||
107, 92, 93, 110, 96, 95, 98, 60, 60, 60,
|
105, 90, 91, 108, 94, 93, 96, 59, 59, 59,
|
||||||
69, 113, 120, 73, 99, 74, 82, 82, 82, 75,
|
68, 111, 117, 72, 97, 73, 80, 80, 80, 74,
|
||||||
75, 104, 82, 82, 75, 106, 82, 82, 75, 75,
|
74, 102, 80, 80, 74, 104, 80, 80, 74, 74,
|
||||||
114, 82, 114, 75, 118, 115, 122, 82, 82, 119,
|
112, 80, 112, 74, 115, 113, 119, 80, 80, 116,
|
||||||
82, 121, 124, 126, 123, 82, 127, 82, 109, 113,
|
80, 118, 121, 123, 120, 80, 124, 80, 107, 111,
|
||||||
82, 128, 82, 82, 125, 131, 129, 82, 75, 82,
|
80, 125, 80, 80, 122, 128, 126, 80, 74, 80,
|
||||||
82, 130, 82, 138, 82, 82, 82, 75, 139, 141,
|
80, 127, 80, 135, 80, 80, 80, 74, 136, 138,
|
||||||
136, 170, 82, 82, 109, 140, 142, 82, 132, 82,
|
133, 167, 80, 80, 107, 137, 139, 80, 129, 80,
|
||||||
82, 145, 82, 82, 144, 143, 82, 82, 109, 82,
|
80, 142, 80, 80, 141, 140, 80, 80, 107, 80,
|
||||||
|
|
||||||
153, 82, 82, 151, 82, 146, 147, 148, 152, 150,
|
150, 80, 80, 148, 80, 143, 144, 145, 149, 147,
|
||||||
82, 109, 158, 160, 161, 156, 82, 154, 157, 164,
|
80, 107, 155, 157, 158, 153, 80, 151, 154, 161,
|
||||||
104, 165, 155, 166, 82, 109, 163, 82, 82, 133,
|
102, 162, 152, 163, 80, 107, 160, 80, 80, 130,
|
||||||
162, 82, 82, 82, 133, 167, 82, 169, 82, 82,
|
159, 80, 80, 80, 130, 164, 80, 166, 80, 80,
|
||||||
82, 168, 52, 52, 52, 52, 52, 52, 52, 52,
|
80, 165, 51, 51, 51, 51, 51, 51, 51, 51,
|
||||||
56, 56, 56, 56, 56, 56, 56, 56, 62, 133,
|
55, 55, 55, 55, 55, 55, 55, 55, 61, 130,
|
||||||
62, 70, 70, 82, 70, 82, 70, 80, 82, 80,
|
61, 69, 69, 80, 69, 80, 69, 78, 80, 78,
|
||||||
82, 80, 81, 81, 81, 115, 81, 101, 115, 101,
|
80, 78, 79, 79, 79, 113, 79, 99, 113, 99,
|
||||||
101, 101, 101, 135, 101, 102, 102, 102, 102, 102,
|
99, 99, 99, 132, 99, 100, 100, 100, 100, 100,
|
||||||
102, 102, 102, 108, 108, 108, 109, 108, 111, 106,
|
100, 100, 100, 106, 106, 106, 107, 106, 109, 104,
|
||||||
|
|
||||||
111, 133, 111, 134, 133, 134, 134, 137, 82, 137,
|
109, 130, 109, 131, 130, 131, 131, 134, 80, 134,
|
||||||
149, 82, 149, 149, 159, 82, 159, 159, 102, 117,
|
146, 80, 146, 146, 156, 80, 156, 156, 100, 114,
|
||||||
102, 102, 82, 116, 112, 109, 105, 100, 82, 79,
|
100, 100, 80, 110, 107, 103, 98, 80, 77, 76,
|
||||||
78, 77, 76, 67, 66, 65, 64, 63, 61, 170,
|
75, 66, 65, 64, 63, 62, 60, 167, 15, 167,
|
||||||
15, 170, 170, 170, 170, 170, 170, 170, 170, 170,
|
167, 167, 167, 167, 167, 167, 167, 167, 167, 167,
|
||||||
170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
|
167, 167, 167, 167, 167, 167, 167, 167, 167, 167,
|
||||||
170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
|
167, 167, 167, 167, 167, 167, 167, 167, 167, 167,
|
||||||
170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
|
167, 167, 167, 167, 167, 167, 167, 167, 167, 167,
|
||||||
170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
|
167, 167, 167, 167, 167, 167, 167, 167, 167, 167,
|
||||||
170, 170, 170, 170
|
167, 167
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static const flex_int16_t yy_chk[395] =
|
static const flex_int16_t yy_chk[393] =
|
||||||
{ 0,
|
{ 0,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 11, 12, 169, 11, 12, 13, 13,
|
1, 1, 1, 11, 12, 166, 11, 12, 13, 13,
|
||||||
14, 14, 17, 17, 17, 18, 18, 18, 30, 31,
|
14, 14, 17, 17, 17, 18, 18, 18, 30, 31,
|
||||||
30, 32, 39, 32, 31, 40, 41, 42, 49, 11,
|
30, 32, 38, 32, 31, 39, 40, 41, 48, 11,
|
||||||
12, 43, 32, 44, 13, 46, 14, 48, 45, 41,
|
12, 42, 32, 43, 13, 45, 14, 47, 44, 40,
|
||||||
47, 32, 55, 86, 42, 49, 39, 50, 46, 168,
|
46, 32, 54, 84, 41, 48, 38, 49, 45, 165,
|
||||||
|
|
||||||
39, 63, 40, 43, 167, 43, 45, 165, 44, 59,
|
38, 62, 39, 42, 164, 42, 44, 162, 43, 58,
|
||||||
59, 45, 45, 63, 48, 47, 50, 60, 60, 60,
|
58, 44, 44, 62, 47, 46, 49, 59, 59, 59,
|
||||||
69, 73, 86, 74, 50, 74, 88, 92, 83, 69,
|
68, 72, 84, 73, 49, 73, 86, 90, 81, 68,
|
||||||
73, 55, 85, 87, 74, 59, 89, 90, 69, 73,
|
72, 54, 83, 85, 73, 58, 87, 88, 68, 72,
|
||||||
75, 93, 75, 74, 83, 75, 88, 94, 98, 85,
|
74, 91, 74, 73, 81, 74, 86, 92, 96, 83,
|
||||||
95, 87, 89, 92, 88, 97, 93, 99, 110, 113,
|
93, 85, 87, 90, 86, 95, 91, 97, 108, 111,
|
||||||
119, 94, 123, 120, 90, 98, 95, 122, 113, 125,
|
116, 92, 120, 117, 88, 96, 93, 119, 111, 122,
|
||||||
126, 97, 127, 119, 128, 129, 130, 113, 120, 123,
|
123, 95, 124, 116, 125, 126, 127, 111, 117, 120,
|
||||||
110, 133, 138, 131, 136, 122, 125, 142, 99, 139,
|
108, 130, 135, 128, 133, 119, 122, 139, 97, 136,
|
||||||
143, 128, 144, 145, 127, 126, 146, 147, 150, 153,
|
140, 125, 141, 142, 124, 123, 143, 144, 147, 150,
|
||||||
|
|
||||||
142, 154, 157, 138, 158, 129, 130, 131, 139, 136,
|
139, 151, 154, 135, 155, 126, 127, 128, 136, 133,
|
||||||
155, 160, 147, 150, 153, 145, 161, 143, 146, 157,
|
152, 157, 144, 147, 150, 142, 158, 140, 143, 154,
|
||||||
133, 158, 144, 160, 163, 166, 155, 164, 162, 159,
|
130, 155, 141, 157, 160, 163, 152, 161, 159, 156,
|
||||||
154, 156, 152, 151, 149, 161, 148, 166, 141, 140,
|
151, 153, 149, 148, 146, 158, 145, 163, 138, 137,
|
||||||
137, 163, 171, 171, 171, 171, 171, 171, 171, 171,
|
134, 160, 168, 168, 168, 168, 168, 168, 168, 168,
|
||||||
172, 172, 172, 172, 172, 172, 172, 172, 173, 134,
|
169, 169, 169, 169, 169, 169, 169, 169, 170, 131,
|
||||||
173, 174, 174, 132, 174, 124, 174, 175, 121, 175,
|
170, 171, 171, 129, 171, 121, 171, 172, 118, 172,
|
||||||
118, 175, 176, 176, 176, 115, 176, 177, 114, 177,
|
115, 172, 173, 173, 173, 113, 173, 174, 112, 174,
|
||||||
177, 177, 177, 109, 177, 178, 178, 178, 178, 178,
|
174, 174, 174, 107, 174, 175, 175, 175, 175, 175,
|
||||||
178, 178, 178, 179, 179, 179, 108, 179, 180, 107,
|
175, 175, 175, 176, 176, 176, 106, 176, 177, 105,
|
||||||
|
|
||||||
180, 104, 180, 181, 102, 181, 181, 182, 96, 182,
|
177, 102, 177, 178, 100, 178, 178, 179, 94, 179,
|
||||||
183, 91, 183, 183, 184, 84, 184, 184, 185, 82,
|
180, 89, 180, 180, 181, 82, 181, 181, 182, 80,
|
||||||
185, 185, 81, 79, 71, 62, 58, 51, 38, 36,
|
182, 182, 79, 70, 61, 57, 50, 37, 35, 34,
|
||||||
35, 34, 33, 29, 27, 26, 23, 22, 19, 15,
|
33, 29, 27, 26, 23, 22, 19, 15, 167, 167,
|
||||||
170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
|
167, 167, 167, 167, 167, 167, 167, 167, 167, 167,
|
||||||
170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
|
167, 167, 167, 167, 167, 167, 167, 167, 167, 167,
|
||||||
170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
|
167, 167, 167, 167, 167, 167, 167, 167, 167, 167,
|
||||||
170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
|
167, 167, 167, 167, 167, 167, 167, 167, 167, 167,
|
||||||
170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
|
167, 167, 167, 167, 167, 167, 167, 167, 167, 167,
|
||||||
170, 170, 170, 170
|
167, 167
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
@@ -814,14 +814,14 @@ struct lexer_param;
|
|||||||
yyset_extra(yylloc->end, yyscanner); \
|
yyset_extra(yylloc->end, yyscanner); \
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
#line 818 "src/lexer.c"
|
#line 817 "src/lexer.c"
|
||||||
|
|
||||||
#line 26 "src/lexer.l"
|
#line 26 "src/lexer.l"
|
||||||
static int enter(int opening, int state, yyscan_t yyscanner);
|
static int enter(int opening, int state, yyscan_t yyscanner);
|
||||||
static int try_exit(int closing, int state, yyscan_t yyscanner);
|
static int try_exit(int closing, int state, yyscan_t yyscanner);
|
||||||
#line 823 "src/lexer.c"
|
#line 822 "src/lexer.c"
|
||||||
#define YY_NO_INPUT 1
|
#define YY_NO_INPUT 1
|
||||||
#line 825 "src/lexer.c"
|
#line 824 "src/lexer.c"
|
||||||
|
|
||||||
#define INITIAL 0
|
#define INITIAL 0
|
||||||
#define IN_PAREN 1
|
#define IN_PAREN 1
|
||||||
@@ -1116,7 +1116,7 @@ YY_DECL
|
|||||||
#line 39 "src/lexer.l"
|
#line 39 "src/lexer.l"
|
||||||
|
|
||||||
|
|
||||||
#line 1120 "src/lexer.c"
|
#line 1119 "src/lexer.c"
|
||||||
|
|
||||||
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
|
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
|
||||||
{
|
{
|
||||||
@@ -1143,13 +1143,13 @@ yy_match:
|
|||||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||||
{
|
{
|
||||||
yy_current_state = (int) yy_def[yy_current_state];
|
yy_current_state = (int) yy_def[yy_current_state];
|
||||||
if ( yy_current_state >= 171 )
|
if ( yy_current_state >= 168 )
|
||||||
yy_c = yy_meta[yy_c];
|
yy_c = yy_meta[yy_c];
|
||||||
}
|
}
|
||||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
|
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
|
||||||
++yy_cp;
|
++yy_cp;
|
||||||
}
|
}
|
||||||
while ( yy_base[yy_current_state] != 341 );
|
while ( yy_base[yy_current_state] != 339 );
|
||||||
|
|
||||||
yy_find_action:
|
yy_find_action:
|
||||||
yy_act = yy_accept[yy_current_state];
|
yy_act = yy_accept[yy_current_state];
|
||||||
@@ -1359,69 +1359,64 @@ YY_RULE_SETUP
|
|||||||
case 36:
|
case 36:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 80 "src/lexer.l"
|
#line 80 "src/lexer.l"
|
||||||
{ return ALTERNATION; }
|
{ return yytext[0];}
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 37:
|
case 37:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 81 "src/lexer.l"
|
#line 82 "src/lexer.l"
|
||||||
{ return yytext[0];}
|
|
||||||
YY_BREAK
|
|
||||||
case 38:
|
|
||||||
YY_RULE_SETUP
|
|
||||||
#line 83 "src/lexer.l"
|
|
||||||
{
|
{
|
||||||
return enter(yytext[0], YY_START, yyscanner);
|
return enter(yytext[0], YY_START, yyscanner);
|
||||||
}
|
}
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 39:
|
case 38:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 87 "src/lexer.l"
|
#line 86 "src/lexer.l"
|
||||||
{
|
{
|
||||||
return try_exit(yytext[0], YY_START, yyscanner);
|
return try_exit(yytext[0], YY_START, yyscanner);
|
||||||
}
|
}
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 40:
|
case 39:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 91 "src/lexer.l"
|
#line 90 "src/lexer.l"
|
||||||
{
|
{
|
||||||
yylval->literal = jv_string_sized(yytext + 1, yyleng - 1); return FORMAT;
|
yylval->literal = jv_string_sized(yytext + 1, yyleng - 1); return FORMAT;
|
||||||
}
|
}
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 41:
|
case 40:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 95 "src/lexer.l"
|
#line 94 "src/lexer.l"
|
||||||
{
|
{
|
||||||
yylval->literal = jv_parse_sized(yytext, yyleng); return LITERAL;
|
yylval->literal = jv_parse_sized(yytext, yyleng); return LITERAL;
|
||||||
}
|
}
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 42:
|
case 41:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 99 "src/lexer.l"
|
#line 98 "src/lexer.l"
|
||||||
{
|
{
|
||||||
yy_push_state(IN_QQSTRING, yyscanner);
|
yy_push_state(IN_QQSTRING, yyscanner);
|
||||||
return QQSTRING_START;
|
return QQSTRING_START;
|
||||||
}
|
}
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
|
|
||||||
case 43:
|
case 42:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 105 "src/lexer.l"
|
#line 104 "src/lexer.l"
|
||||||
{
|
{
|
||||||
return enter(QQSTRING_INTERP_START, YY_START, yyscanner);
|
return enter(QQSTRING_INTERP_START, YY_START, yyscanner);
|
||||||
}
|
}
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 44:
|
case 43:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 108 "src/lexer.l"
|
#line 107 "src/lexer.l"
|
||||||
{
|
{
|
||||||
yy_pop_state(yyscanner);
|
yy_pop_state(yyscanner);
|
||||||
return QQSTRING_END;
|
return QQSTRING_END;
|
||||||
}
|
}
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 45:
|
case 44:
|
||||||
/* rule 45 can match eol */
|
/* rule 44 can match eol */
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 112 "src/lexer.l"
|
#line 111 "src/lexer.l"
|
||||||
{
|
{
|
||||||
/* pass escapes to the json parser */
|
/* pass escapes to the json parser */
|
||||||
jv escapes = jv_string_fmt("\"%.*s\"", (int)yyleng, yytext);
|
jv escapes = jv_string_fmt("\"%.*s\"", (int)yyleng, yytext);
|
||||||
@@ -1430,55 +1425,55 @@ YY_RULE_SETUP
|
|||||||
return QQSTRING_TEXT;
|
return QQSTRING_TEXT;
|
||||||
}
|
}
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 46:
|
case 45:
|
||||||
/* rule 46 can match eol */
|
/* rule 45 can match eol */
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 119 "src/lexer.l"
|
#line 118 "src/lexer.l"
|
||||||
{
|
{
|
||||||
yylval->literal = jv_string_sized(yytext, yyleng);
|
yylval->literal = jv_string_sized(yytext, yyleng);
|
||||||
return QQSTRING_TEXT;
|
return QQSTRING_TEXT;
|
||||||
}
|
}
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 47:
|
case 46:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 123 "src/lexer.l"
|
#line 122 "src/lexer.l"
|
||||||
{
|
{
|
||||||
return INVALID_CHARACTER;
|
return INVALID_CHARACTER;
|
||||||
}
|
}
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
|
|
||||||
|
case 47:
|
||||||
|
YY_RULE_SETUP
|
||||||
|
#line 128 "src/lexer.l"
|
||||||
|
{ yylval->literal = jv_string(yytext); return IDENT;}
|
||||||
|
YY_BREAK
|
||||||
case 48:
|
case 48:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 129 "src/lexer.l"
|
#line 129 "src/lexer.l"
|
||||||
{ yylval->literal = jv_string(yytext); return IDENT;}
|
{ yylval->literal = jv_string(yytext+1); return FIELD;}
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 49:
|
case 49:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 130 "src/lexer.l"
|
#line 130 "src/lexer.l"
|
||||||
{ yylval->literal = jv_string(yytext+1); return FIELD;}
|
|
||||||
YY_BREAK
|
|
||||||
case 50:
|
|
||||||
YY_RULE_SETUP
|
|
||||||
#line 131 "src/lexer.l"
|
|
||||||
{ yylval->literal = jv_string(yytext+1); return BINDING;}
|
{ yylval->literal = jv_string(yytext+1); return BINDING;}
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 51:
|
case 50:
|
||||||
/* rule 51 can match eol */
|
/* rule 50 can match eol */
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 133 "src/lexer.l"
|
#line 132 "src/lexer.l"
|
||||||
{}
|
{}
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
|
case 51:
|
||||||
|
YY_RULE_SETUP
|
||||||
|
#line 134 "src/lexer.l"
|
||||||
|
{ return INVALID_CHARACTER; }
|
||||||
|
YY_BREAK
|
||||||
case 52:
|
case 52:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 135 "src/lexer.l"
|
#line 136 "src/lexer.l"
|
||||||
{ return INVALID_CHARACTER; }
|
|
||||||
YY_BREAK
|
|
||||||
case 53:
|
|
||||||
YY_RULE_SETUP
|
|
||||||
#line 137 "src/lexer.l"
|
|
||||||
YY_FATAL_ERROR( "flex scanner jammed" );
|
YY_FATAL_ERROR( "flex scanner jammed" );
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
#line 1482 "src/lexer.c"
|
#line 1476 "src/lexer.c"
|
||||||
case YY_STATE_EOF(INITIAL):
|
case YY_STATE_EOF(INITIAL):
|
||||||
case YY_STATE_EOF(IN_PAREN):
|
case YY_STATE_EOF(IN_PAREN):
|
||||||
case YY_STATE_EOF(IN_BRACKET):
|
case YY_STATE_EOF(IN_BRACKET):
|
||||||
@@ -1782,7 +1777,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
|||||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||||
{
|
{
|
||||||
yy_current_state = (int) yy_def[yy_current_state];
|
yy_current_state = (int) yy_def[yy_current_state];
|
||||||
if ( yy_current_state >= 171 )
|
if ( yy_current_state >= 168 )
|
||||||
yy_c = yy_meta[yy_c];
|
yy_c = yy_meta[yy_c];
|
||||||
}
|
}
|
||||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
|
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
|
||||||
@@ -1811,11 +1806,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
|||||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||||
{
|
{
|
||||||
yy_current_state = (int) yy_def[yy_current_state];
|
yy_current_state = (int) yy_def[yy_current_state];
|
||||||
if ( yy_current_state >= 171 )
|
if ( yy_current_state >= 168 )
|
||||||
yy_c = yy_meta[yy_c];
|
yy_c = yy_meta[yy_c];
|
||||||
}
|
}
|
||||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
|
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
|
||||||
yy_is_jam = (yy_current_state == 170);
|
yy_is_jam = (yy_current_state == 167);
|
||||||
|
|
||||||
(void)yyg;
|
(void)yyg;
|
||||||
return yy_is_jam ? 0 : yy_current_state;
|
return yy_is_jam ? 0 : yy_current_state;
|
||||||
@@ -2650,7 +2645,7 @@ static int yy_flex_strlen (const char * s , yyscan_t yyscanner)
|
|||||||
|
|
||||||
#define YYTABLES_NAME "yytables"
|
#define YYTABLES_NAME "yytables"
|
||||||
|
|
||||||
#line 137 "src/lexer.l"
|
#line 136 "src/lexer.l"
|
||||||
|
|
||||||
/* perhaps these should be calls... */
|
/* perhaps these should be calls... */
|
||||||
/*
|
/*
|
||||||
|
|||||||
Generated
+4
-4
@@ -2,9 +2,9 @@
|
|||||||
#define jq_yyHEADER_H 1
|
#define jq_yyHEADER_H 1
|
||||||
#define jq_yyIN_HEADER 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
|
#define YY_INT_ALIGNED short int
|
||||||
|
|
||||||
@@ -732,9 +732,9 @@ extern int yylex \
|
|||||||
#undef yyTABLES_NAME
|
#undef yyTABLES_NAME
|
||||||
#endif
|
#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
|
#undef jq_yyIN_HEADER
|
||||||
#endif /* jq_yyHEADER_H */
|
#endif /* jq_yyHEADER_H */
|
||||||
@@ -77,7 +77,6 @@ struct lexer_param;
|
|||||||
"<=" { return LESSEQ; }
|
"<=" { return LESSEQ; }
|
||||||
">=" { return GREATEREQ; }
|
">=" { return GREATEREQ; }
|
||||||
".." { return REC; }
|
".." { return REC; }
|
||||||
"?//" { return ALTERNATION; }
|
|
||||||
"."|"?"|"="|";"|","|":"|"|"|"+"|"-"|"*"|"/"|"%"|"\$"|"<"|">" { return yytext[0];}
|
"."|"?"|"="|";"|","|":"|"|"|"+"|"-"|"*"|"/"|"%"|"\$"|"<"|">" { return yytext[0];}
|
||||||
|
|
||||||
"["|"{"|"(" {
|
"["|"{"|"(" {
|
||||||
|
|||||||
Generated
+1067
-1083
File diff suppressed because it is too large.
Load diff
Generated
+15
-17
@@ -111,14 +111,13 @@ struct lexer_param;
|
|||||||
SETDEFINEDOR = 293, /* "//=" */
|
SETDEFINEDOR = 293, /* "//=" */
|
||||||
LESSEQ = 294, /* "<=" */
|
LESSEQ = 294, /* "<=" */
|
||||||
GREATEREQ = 295, /* ">=" */
|
GREATEREQ = 295, /* ">=" */
|
||||||
ALTERNATION = 296, /* "?//" */
|
QQSTRING_START = 296, /* QQSTRING_START */
|
||||||
QQSTRING_START = 297, /* QQSTRING_START */
|
QQSTRING_TEXT = 297, /* QQSTRING_TEXT */
|
||||||
QQSTRING_TEXT = 298, /* QQSTRING_TEXT */
|
QQSTRING_INTERP_START = 298, /* QQSTRING_INTERP_START */
|
||||||
QQSTRING_INTERP_START = 299, /* QQSTRING_INTERP_START */
|
QQSTRING_INTERP_END = 299, /* QQSTRING_INTERP_END */
|
||||||
QQSTRING_INTERP_END = 300, /* QQSTRING_INTERP_END */
|
QQSTRING_END = 300, /* QQSTRING_END */
|
||||||
QQSTRING_END = 301, /* QQSTRING_END */
|
FUNCDEF = 301, /* FUNCDEF */
|
||||||
FUNCDEF = 302, /* FUNCDEF */
|
NONOPT = 302 /* NONOPT */
|
||||||
NONOPT = 303 /* NONOPT */
|
|
||||||
};
|
};
|
||||||
typedef enum yytokentype yytoken_kind_t;
|
typedef enum yytokentype yytoken_kind_t;
|
||||||
#endif
|
#endif
|
||||||
@@ -165,14 +164,13 @@ struct lexer_param;
|
|||||||
#define SETDEFINEDOR 293
|
#define SETDEFINEDOR 293
|
||||||
#define LESSEQ 294
|
#define LESSEQ 294
|
||||||
#define GREATEREQ 295
|
#define GREATEREQ 295
|
||||||
#define ALTERNATION 296
|
#define QQSTRING_START 296
|
||||||
#define QQSTRING_START 297
|
#define QQSTRING_TEXT 297
|
||||||
#define QQSTRING_TEXT 298
|
#define QQSTRING_INTERP_START 298
|
||||||
#define QQSTRING_INTERP_START 299
|
#define QQSTRING_INTERP_END 299
|
||||||
#define QQSTRING_INTERP_END 300
|
#define QQSTRING_END 300
|
||||||
#define QQSTRING_END 301
|
#define FUNCDEF 301
|
||||||
#define FUNCDEF 302
|
#define NONOPT 302
|
||||||
#define NONOPT 303
|
|
||||||
|
|
||||||
/* Value type. */
|
/* Value type. */
|
||||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||||
@@ -183,7 +181,7 @@ union YYSTYPE
|
|||||||
jv literal;
|
jv literal;
|
||||||
block blk;
|
block blk;
|
||||||
|
|
||||||
#line 187 "src/parser.h"
|
#line 185 "src/parser.h"
|
||||||
|
|
||||||
};
|
};
|
||||||
typedef union YYSTYPE YYSTYPE;
|
typedef union YYSTYPE YYSTYPE;
|
||||||
|
|||||||
+4
-5
@@ -85,7 +85,6 @@ struct lexer_param;
|
|||||||
%token SETDEFINEDOR "//="
|
%token SETDEFINEDOR "//="
|
||||||
%token LESSEQ "<="
|
%token LESSEQ "<="
|
||||||
%token GREATEREQ ">="
|
%token GREATEREQ ">="
|
||||||
%token ALTERNATION "?//"
|
|
||||||
|
|
||||||
%token QQSTRING_START
|
%token QQSTRING_START
|
||||||
%token <literal> QQSTRING_TEXT
|
%token <literal> QQSTRING_TEXT
|
||||||
@@ -746,16 +745,16 @@ Query {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RepPatterns:
|
RepPatterns:
|
||||||
RepPatterns "?//" Pattern {
|
RepPatterns '?' "//" Pattern {
|
||||||
$$ = BLOCK($1, gen_destructure_alt($3));
|
$$ = BLOCK($1, gen_destructure_alt($4));
|
||||||
} |
|
} |
|
||||||
Pattern {
|
Pattern {
|
||||||
$$ = gen_destructure_alt($1);
|
$$ = gen_destructure_alt($1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Patterns:
|
Patterns:
|
||||||
RepPatterns "?//" Pattern {
|
RepPatterns '?' "//" Pattern {
|
||||||
$$ = BLOCK($1, $3);
|
$$ = BLOCK($1, $4);
|
||||||
} |
|
} |
|
||||||
Pattern {
|
Pattern {
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
|
|||||||
@@ -1485,6 +1485,11 @@ try error(0) // 1
|
|||||||
null
|
null
|
||||||
1
|
1
|
||||||
|
|
||||||
|
# Lex token test #3589, like error(0)? // 1
|
||||||
|
error(0) ?// 1
|
||||||
|
null
|
||||||
|
1
|
||||||
|
|
||||||
1, try error(2), 3
|
1, try error(2), 3
|
||||||
null
|
null
|
||||||
1
|
1
|
||||||
|
|||||||
Reference in new issue
Block a user