Support CRLF line breaks in filters (#3274)

This commit is contained in:
itchyny authored and GitHub committed 2025-03-04 22:11:40 +09:00
1 parent b7a1201b72
commit c4e1fb08fb
4 files changed
+181 -165

No files matched your search

Generated
+160 -156
View File
@@ -1,6 +1,6 @@
#line 1 "src/lexer.c" #line 2 "src/lexer.c"
#line 3 "src/lexer.c" #line 4 "src/lexer.c"
#define YY_INT_ALIGNED short int #define YY_INT_ALIGNED short int
@@ -582,44 +582,44 @@ 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[168] = static const flex_int16_t yy_accept[171] =
{ 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, 54, 52, 51, 51, 52, 42,
1, 37, 37, 38, 39, 37, 37, 37, 37, 37, 1, 37, 37, 38, 39, 37, 37, 37, 37, 37,
37, 41, 37, 37, 37, 37, 52, 48, 48, 48, 37, 41, 37, 37, 37, 37, 52, 48, 48, 48,
48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
37, 46, 46, 44, 47, 2, 3, 2, 51, 4, 37, 46, 46, 44, 47, 2, 3, 2, 2, 51,
50, 50, 31, 29, 27, 28, 35, 41, 49, 20, 4, 50, 50, 31, 29, 27, 28, 35, 41, 49,
30, 41, 41, 0, 33, 5, 34, 0, 40, 48, 20, 30, 41, 41, 0, 33, 5, 34, 0, 40,
0, 48, 6, 48, 48, 48, 48, 48, 48, 11, 48, 0, 48, 6, 48, 48, 48, 48, 48, 48,
48, 48, 48, 48, 16, 48, 48, 48, 26, 46, 11, 48, 48, 48, 48, 16, 48, 48, 48, 26,
45, 43, 45, 2, 50, 0, 50, 49, 32, 41, 46, 45, 43, 45, 3, 2, 0, 50, 0, 50,
0, 41, 36, 0, 15, 48, 48, 10, 48, 48, 49, 32, 41, 0, 41, 36, 0, 15, 48, 48,
17, 48, 48, 48, 48, 48, 48, 48, 21, 0, 10, 48, 48, 17, 48, 48, 48, 48, 48, 48,
45, 0, 50, 48, 48, 48, 14, 13, 48, 48, 48, 21, 0, 45, 0, 50, 48, 48, 48, 14,
48, 48, 48, 48, 12, 45, 50, 24, 22, 48, 13, 48, 48, 48, 48, 48, 48, 12, 45, 50,
48, 48, 23, 48, 48, 45, 50, 48, 7, 48, 24, 22, 48, 48, 48, 23, 48, 48, 45, 50,
9, 18, 50, 19, 8, 25, 0 48, 7, 48, 9, 18, 50, 19, 8, 25, 0
} ; } ;
static const YY_CHAR yy_ec[256] = static const YY_CHAR yy_ec[256] =
{ 0, { 0,
1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
1, 1, 4, 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, 2, 5, 6, 7, 8, 9, 1, 1, 10,
1, 2, 4, 5, 6, 7, 8, 1, 1, 9, 11, 12, 13, 14, 15, 16, 17, 18, 18, 18,
10, 11, 12, 13, 14, 15, 16, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 19, 20, 21,
17, 17, 17, 17, 17, 17, 17, 18, 19, 20, 22, 23, 24, 25, 26, 26, 26, 26, 27, 26,
21, 22, 23, 24, 25, 25, 25, 25, 26, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 28, 29, 30, 1, 31, 1, 32, 33, 34, 35,
27, 28, 29, 1, 30, 1, 31, 32, 33, 34,
35, 36, 25, 37, 38, 25, 39, 40, 41, 42, 36, 37, 26, 38, 39, 26, 40, 41, 42, 43,
43, 44, 25, 45, 46, 47, 48, 25, 25, 25, 44, 45, 26, 46, 47, 48, 49, 26, 26, 26,
49, 25, 50, 51, 52, 1, 1, 1, 1, 1, 50, 26, 51, 52, 53, 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,
@@ -636,154 +636,158 @@ static const YY_CHAR yy_ec[256] =
1, 1, 1, 1, 1 1, 1, 1, 1, 1
} ; } ;
static const YY_CHAR yy_meta[53] = static const YY_CHAR yy_meta[54] =
{ 0, { 0,
1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1,
1, 1, 1, 1, 3, 1, 4, 5, 1, 1, 1, 1, 1, 1, 1, 3, 1, 4, 5, 1,
1, 1, 1, 1, 6, 6, 1, 7, 1, 8, 1, 1, 1, 1, 1, 6, 6, 1, 7, 1,
8, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 1, 1, 1, 1
1, 1
} ; } ;
static const flex_int16_t yy_base[183] = static const flex_int16_t yy_base[186] =
{ 0, { 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
50, 51, 54, 55, 331, 332, 57, 59, 309, 332, 51, 52, 56, 58, 340, 341, 61, 64, 317, 341,
332, 299, 307, 332, 332, 306, 305, 332, 304, 48, 341, 307, 315, 341, 341, 314, 313, 341, 312, 53,
48, 51, 303, 302, 301, 305, 0, 302, 49, 52, 53, 56, 311, 310, 309, 313, 0, 310, 54, 57,
53, 54, 56, 57, 63, 62, 58, 67, 55, 69, 58, 59, 63, 65, 70, 67, 72, 69, 60, 79,
298, 0, 0, 332, 79, 332, 332, 89, 100, 332, 306, 0, 0, 341, 83, 341, 341, 324, 107, 116,
300, 89, 332, 332, 332, 332, 332, 94, 0, 296, 341, 307, 83, 341, 341, 341, 341, 341, 103, 0,
332, 96, 106, 116, 332, 332, 332, 300, 0, 297, 303, 341, 104, 108, 128, 341, 341, 341, 307, 0,
296, 76, 295, 90, 91, 98, 97, 106, 100, 294, 304, 301, 110, 297, 114, 75, 115, 108, 118, 119,
108, 118, 121, 124, 293, 126, 119, 128, 332, 0, 293, 109, 123, 129, 132, 290, 137, 130, 139, 341,
282, 332, 281, 332, 288, 284, 129, 0, 332, 131, 0, 276, 341, 273, 341, 341, 297, 278, 265, 140,
281, 278, 332, 0, 273, 131, 132, 270, 137, 141, 0, 341, 142, 261, 258, 341, 0, 252, 142, 145,
268, 143, 138, 145, 149, 146, 150, 153, 265, 161, 250, 149, 144, 247, 151, 152, 154, 156, 157, 158,
242, 0, 154, 247, 157, 156, 244, 239, 161, 162, 165, 245, 172, 231, 0, 166, 222, 164, 171, 221,
164, 165, 168, 169, 237, 224, 170, 232, 228, 171, 220, 169, 172, 174, 175, 178, 179, 218, 206, 180,
172, 181, 209, 182, 183, 196, 192, 188, 205, 193, 215, 214, 181, 183, 192, 213, 184, 186, 201, 193,
203, 202, 196, 198, 195, 173, 332, 228, 236, 239, 198, 210, 206, 209, 89, 207, 86, 81, 37, 341,
245, 250, 255, 263, 271, 276, 281, 286, 288, 293, 242, 250, 253, 259, 264, 269, 277, 285, 290, 295,
297, 301 300, 302, 307, 311, 315
} ; } ;
static const flex_int16_t yy_def[183] = static const flex_int16_t yy_def[186] =
{ 0, { 0,
167, 1, 1, 1, 1, 1, 1, 1, 1, 1, 170, 1, 1, 1, 1, 1, 1, 1, 1, 1,
168, 168, 169, 169, 167, 167, 167, 167, 167, 167, 171, 171, 172, 172, 170, 170, 170, 170, 170, 170,
167, 170, 167, 167, 167, 167, 167, 167, 167, 171, 170, 173, 170, 170, 170, 170, 170, 170, 170, 174,
167, 167, 167, 167, 167, 167, 172, 173, 173, 173, 170, 170, 170, 170, 170, 170, 175, 176, 176, 176,
173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176,
167, 174, 174, 167, 175, 167, 167, 167, 167, 167, 170, 177, 177, 170, 178, 170, 170, 170, 170, 170,
176, 176, 167, 167, 167, 167, 167, 167, 177, 167, 170, 179, 179, 170, 170, 170, 170, 170, 170, 180,
167, 167, 167, 167, 167, 167, 167, 167, 172, 173, 170, 170, 170, 170, 170, 170, 170, 170, 170, 175,
167, 173, 173, 173, 173, 173, 173, 173, 173, 173, 176, 170, 176, 176, 176, 176, 176, 176, 176, 176,
173, 173, 173, 173, 173, 173, 173, 173, 167, 174, 176, 176, 176, 176, 176, 176, 176, 176, 176, 170,
167, 167, 178, 167, 176, 167, 176, 177, 167, 167, 177, 170, 170, 181, 170, 170, 170, 179, 170, 179,
167, 167, 167, 179, 173, 173, 173, 173, 173, 173, 180, 170, 170, 170, 170, 170, 182, 176, 176, 176,
173, 173, 173, 173, 173, 173, 173, 173, 173, 175, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176,
180, 170, 176, 173, 173, 173, 173, 173, 173, 173, 176, 176, 178, 183, 173, 179, 176, 176, 176, 176,
173, 173, 173, 173, 173, 181, 176, 173, 173, 173, 176, 176, 176, 176, 176, 176, 176, 176, 184, 179,
173, 173, 173, 173, 173, 182, 176, 173, 173, 173, 176, 176, 176, 176, 176, 176, 176, 176, 185, 179,
173, 173, 176, 173, 173, 176, 0, 167, 167, 167, 176, 176, 176, 176, 176, 179, 176, 176, 179, 0,
167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
167, 167 170, 170, 170, 170, 170
} ; } ;
static const flex_int16_t yy_nxt[385] = static const flex_int16_t yy_nxt[395] =
{ 0, { 0,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 16, 17, 18, 17, 19, 20, 21, 22, 23, 24,
26, 27, 28, 29, 30, 31, 32, 28, 28, 33, 25, 26, 27, 28, 29, 30, 31, 32, 28, 28,
34, 35, 36, 37, 38, 38, 24, 16, 25, 38, 33, 34, 35, 36, 37, 38, 38, 24, 16, 25,
39, 40, 41, 42, 43, 44, 38, 45, 38, 46, 38, 39, 40, 41, 42, 43, 44, 38, 45, 38,
47, 38, 48, 38, 49, 38, 50, 38, 38, 24, 46, 47, 38, 48, 38, 49, 38, 50, 38, 38,
51, 25, 53, 53, 54, 54, 57, 57, 59, 59, 24, 51, 25, 53, 53, 109, 54, 54, 57, 58,
59, 59, 67, 70, 68, 72, 81, 73, 71, 81, 57, 58, 60, 60, 60, 60, 60, 60, 68, 71,
81, 81, 81, 81, 81, 81, 74, 55, 55, 81, 69, 73, 82, 74, 72, 82, 82, 82, 82, 55,
81, 58, 58, 85, 81, 74, 81, 102, 86, 96, 55, 82, 75, 82, 59, 82, 59, 82, 82, 86,
82, 104, 93, 81, 83, 87, 84, 88, 90, 89, 82, 75, 103, 82, 87, 97, 83, 82, 94, 82,
94, 59, 59, 91, 92, 97, 106, 81, 81, 115, 84, 109, 85, 88, 82, 89, 91, 82, 90, 106,
68, 95, 110, 98, 81, 81, 104, 81, 107, 74, 107, 92, 93, 110, 96, 95, 98, 60, 60, 60,
72, 74, 73, 81, 116, 81, 103, 111, 74, 111, 69, 113, 120, 73, 99, 74, 82, 82, 82, 75,
74, 74, 112, 118, 119, 81, 81, 117, 81, 121, 75, 104, 82, 82, 75, 106, 82, 82, 75, 75,
74, 81, 120, 81, 122, 81, 106, 110, 81, 81, 114, 82, 114, 75, 118, 115, 122, 82, 82, 119,
124, 123, 125, 128, 81, 81, 74, 126, 81, 127, 82, 121, 124, 126, 123, 82, 127, 82, 109, 113,
81, 135, 81, 81, 136, 74, 81, 81, 133, 167, 82, 128, 82, 82, 125, 131, 129, 82, 75, 82,
81, 106, 137, 81, 81, 138, 129, 139, 81, 81, 82, 130, 82, 138, 82, 82, 82, 75, 139, 141,
140, 81, 81, 142, 141, 81, 81, 106, 81, 81, 136, 170, 82, 82, 109, 140, 142, 82, 132, 82,
106, 150, 149, 143, 145, 148, 147, 144, 81, 81, 82, 145, 82, 82, 144, 143, 82, 82, 109, 82,
81, 155, 157, 158, 153, 81, 151, 154, 103, 106, 153, 82, 82, 151, 82, 146, 147, 148, 152, 150,
81, 152, 81, 106, 160, 81, 161, 162, 159, 81, 82, 109, 158, 160, 161, 156, 82, 154, 157, 164,
81, 163, 81, 130, 164, 166, 81, 165, 52, 52, 104, 165, 155, 166, 82, 109, 163, 82, 82, 133,
52, 52, 52, 52, 52, 52, 56, 56, 56, 56, 162, 82, 82, 82, 133, 167, 82, 169, 82, 82,
56, 56, 56, 56, 61, 81, 61, 69, 69, 81, 82, 168, 52, 52, 52, 52, 52, 52, 52, 52,
69, 130, 69, 79, 81, 79, 81, 79, 80, 80, 56, 56, 56, 56, 56, 56, 56, 56, 62, 133,
80, 81, 80, 100, 81, 100, 100, 100, 100, 130, 62, 70, 70, 82, 70, 82, 70, 80, 82, 80,
100, 101, 101, 101, 101, 101, 101, 101, 101, 105, 82, 80, 81, 81, 81, 115, 81, 101, 115, 101,
105, 105, 81, 105, 108, 81, 108, 81, 108, 131, 101, 101, 101, 135, 101, 102, 102, 102, 102, 102,
81, 131, 131, 134, 112, 134, 146, 112, 146, 146, 102, 102, 102, 108, 108, 108, 109, 108, 111, 106,
111, 133, 111, 134, 133, 134, 134, 137, 82, 137,
149, 82, 149, 149, 159, 82, 159, 159, 102, 117,
102, 102, 82, 116, 112, 109, 105, 100, 82, 79,
78, 77, 76, 67, 66, 65, 64, 63, 61, 170,
15, 170, 170, 170, 170, 170, 170, 170, 170, 170,
170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
170, 170, 170, 170
156, 132, 156, 156, 101, 106, 101, 101, 130, 130,
81, 81, 81, 114, 81, 113, 109, 106, 99, 81,
78, 77, 76, 75, 66, 65, 64, 63, 62, 60,
167, 15, 167, 167, 167, 167, 167, 167, 167, 167,
167, 167, 167, 167, 167, 167, 167, 167, 167, 167,
167, 167, 167, 167, 167, 167, 167, 167, 167, 167,
167, 167, 167, 167, 167, 167, 167, 167, 167, 167,
167, 167, 167, 167, 167, 167, 167, 167, 167, 167,
167, 167, 167, 167
} ; } ;
static const flex_int16_t yy_chk[385] = static const flex_int16_t yy_chk[395] =
{ 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, 11, 12, 11, 12, 13, 14, 17, 17, 1, 1, 1, 11, 12, 169, 11, 12, 13, 13,
18, 18, 30, 31, 30, 32, 39, 32, 31, 40, 14, 14, 17, 17, 17, 18, 18, 18, 30, 31,
41, 42, 49, 43, 44, 47, 32, 11, 12, 46, 30, 32, 39, 32, 31, 40, 41, 42, 49, 11,
45, 13, 14, 41, 48, 32, 50, 55, 42, 49, 12, 43, 32, 44, 13, 46, 14, 48, 45, 41,
39, 58, 46, 82, 39, 43, 40, 43, 45, 44, 47, 32, 55, 86, 42, 49, 39, 50, 46, 168,
47, 59, 59, 45, 45, 50, 62, 84, 85, 82, 39, 63, 40, 43, 167, 43, 45, 165, 44, 59,
68, 48, 72, 50, 87, 86, 58, 89, 62, 68, 59, 45, 45, 63, 48, 47, 50, 60, 60, 60,
73, 72, 73, 88, 84, 91, 55, 74, 68, 74, 69, 73, 86, 74, 50, 74, 88, 92, 83, 69,
72, 73, 74, 86, 87, 92, 97, 85, 93, 88, 73, 55, 85, 87, 74, 59, 89, 90, 69, 73,
73, 94, 87, 96, 89, 98, 107, 110, 116, 117, 75, 93, 75, 74, 83, 75, 88, 94, 98, 85,
92, 91, 93, 97, 119, 123, 110, 94, 120, 96, 95, 87, 89, 92, 88, 97, 93, 99, 110, 113,
122, 116, 124, 126, 117, 110, 125, 127, 107, 130, 119, 94, 123, 120, 90, 98, 95, 122, 113, 125,
128, 133, 119, 136, 135, 120, 98, 122, 139, 140, 126, 97, 127, 119, 128, 129, 130, 113, 120, 123,
123, 141, 142, 125, 124, 143, 144, 147, 150, 151, 110, 133, 138, 131, 136, 122, 125, 142, 99, 139,
166, 139, 136, 126, 128, 135, 133, 127, 152, 154, 143, 128, 144, 145, 127, 126, 146, 147, 150, 153,
155, 144, 147, 150, 142, 158, 140, 143, 130, 157, 142, 154, 157, 138, 158, 129, 130, 131, 139, 136,
160, 141, 165, 163, 152, 164, 154, 155, 151, 162, 155, 160, 147, 150, 153, 145, 161, 143, 146, 157,
161, 157, 159, 156, 158, 163, 153, 160, 168, 168, 133, 158, 144, 160, 163, 166, 155, 164, 162, 159,
168, 168, 168, 168, 168, 168, 169, 169, 169, 169, 154, 156, 152, 151, 149, 161, 148, 166, 141, 140,
169, 169, 169, 169, 170, 149, 170, 171, 171, 148, 137, 163, 171, 171, 171, 171, 171, 171, 171, 171,
171, 146, 171, 172, 145, 172, 138, 172, 173, 173, 172, 172, 172, 172, 172, 172, 172, 172, 173, 134,
173, 137, 173, 174, 134, 174, 174, 174, 174, 131, 173, 174, 174, 132, 174, 124, 174, 175, 121, 175,
174, 175, 175, 175, 175, 175, 175, 175, 175, 176, 118, 175, 176, 176, 176, 115, 176, 177, 114, 177,
176, 176, 129, 176, 177, 121, 177, 118, 177, 178, 177, 177, 177, 109, 177, 178, 178, 178, 178, 178,
115, 178, 178, 179, 112, 179, 180, 111, 180, 180, 178, 178, 178, 179, 179, 179, 108, 179, 180, 107,
180, 104, 180, 181, 102, 181, 181, 182, 96, 182,
183, 91, 183, 183, 184, 84, 184, 184, 185, 82,
185, 185, 81, 79, 71, 62, 58, 51, 38, 36,
35, 34, 33, 29, 27, 26, 23, 22, 19, 15,
170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
170, 170, 170, 170
181, 106, 181, 181, 182, 105, 182, 182, 103, 101,
95, 90, 83, 81, 80, 78, 70, 61, 51, 38,
36, 35, 34, 33, 29, 27, 26, 23, 22, 19,
15, 167, 167, 167, 167, 167, 167, 167, 167, 167,
167, 167, 167, 167, 167, 167, 167, 167, 167, 167,
167, 167, 167, 167, 167, 167, 167, 167, 167, 167,
167, 167, 167, 167, 167, 167, 167, 167, 167, 167,
167, 167, 167, 167, 167, 167, 167, 167, 167, 167,
167, 167, 167, 167
} ; } ;
/* The intent behind this definition is that it'll catch /* The intent behind this definition is that it'll catch
@@ -810,14 +814,14 @@ struct lexer_param;
yyset_extra(yylloc->end, yyscanner); \ yyset_extra(yylloc->end, yyscanner); \
} while (0); } while (0);
#line 813 "src/lexer.c" #line 818 "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 818 "src/lexer.c" #line 823 "src/lexer.c"
#define YY_NO_INPUT 1 #define YY_NO_INPUT 1
#line 820 "src/lexer.c" #line 825 "src/lexer.c"
#define INITIAL 0 #define INITIAL 0
#define IN_PAREN 1 #define IN_PAREN 1
@@ -1112,7 +1116,7 @@ YY_DECL
#line 39 "src/lexer.l" #line 39 "src/lexer.l"
#line 1115 "src/lexer.c" #line 1120 "src/lexer.c"
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{ {
@@ -1139,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 >= 168 ) if ( yy_current_state >= 171 )
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] != 332 ); while ( yy_base[yy_current_state] != 341 );
yy_find_action: yy_find_action:
yy_act = yy_accept[yy_current_state]; yy_act = yy_accept[yy_current_state];
@@ -1474,7 +1478,7 @@ YY_RULE_SETUP
#line 137 "src/lexer.l" #line 137 "src/lexer.l"
YY_FATAL_ERROR( "flex scanner jammed" ); YY_FATAL_ERROR( "flex scanner jammed" );
YY_BREAK YY_BREAK
#line 1477 "src/lexer.c" #line 1482 "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):
@@ -1778,7 +1782,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 >= 168 ) if ( yy_current_state >= 171 )
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];
@@ -1807,11 +1811,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 >= 168 ) if ( yy_current_state >= 171 )
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 == 167); yy_is_jam = (yy_current_state == 170);
(void)yyg; (void)yyg;
return yy_is_jam ? 0 : yy_current_state; return yy_is_jam ? 0 : yy_current_state;
Generated
+3 -3
View File
@@ -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 5 "src/lexer.h" #line 6 "src/lexer.h"
#line 7 "src/lexer.h" #line 8 "src/lexer.h"
#define YY_INT_ALIGNED short int #define YY_INT_ALIGNED short int
@@ -735,6 +735,6 @@ extern int yylex \
#line 137 "src/lexer.l" #line 137 "src/lexer.l"
#line 738 "src/lexer.h" #line 739 "src/lexer.h"
#undef jq_yyIN_HEADER #undef jq_yyIN_HEADER
#endif /* jq_yyHEADER_H */ #endif /* jq_yyHEADER_H */
+3 -3
View File
@@ -40,8 +40,8 @@ struct lexer_param;
"#" { yy_push_state(IN_COMMENT, yyscanner); } "#" { yy_push_state(IN_COMMENT, yyscanner); }
<IN_COMMENT>{ <IN_COMMENT>{
\\[\\\n]|. { } \\(\\|\r?\n)|. { }
\n { yy_pop_state(yyscanner); } \r?\n { yy_pop_state(yyscanner); }
} }
<IN_COMMENT><<EOF>> { yy_pop_state(yyscanner); } <IN_COMMENT><<EOF>> { yy_pop_state(yyscanner); }
@@ -130,7 +130,7 @@ struct lexer_param;
\.[a-zA-Z_][a-zA-Z_0-9]* { yylval->literal = jv_string(yytext+1); return FIELD;} \.[a-zA-Z_][a-zA-Z_0-9]* { yylval->literal = jv_string(yytext+1); return FIELD;}
\$([a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]* { yylval->literal = jv_string(yytext+1); return BINDING;} \$([a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]* { yylval->literal = jv_string(yytext+1); return BINDING;}
[ \n\t]+ {} [ \r\n\t]+ {}
. { return INVALID_CHARACTER; } . { return INVALID_CHARACTER; }
+15 -3
View File
@@ -189,6 +189,12 @@ cmp $d/out $d/expected
$JQ -V -h > $d/out 2>&1 $JQ -V -h > $d/out 2>&1
cmp $d/out $d/expected cmp $d/out $d/expected
# CRLF line break support #1219
if ! x=$($JQ -n "$(printf '1\r\n+\r\n2')") || [ "$x" != '3' ]; then
echo 'CRLF line break support failed?' 1>&2
exit 1
fi
## Test streaming parser ## Test streaming parser
## If we add an option to stream to the `import ... as $symbol;` directive ## If we add an option to stream to the `import ... as $symbol;` directive
@@ -657,6 +663,12 @@ if ! x=$($JQ -cn '[
exit 1 exit 1
fi fi
if ! x=$($JQ -cn "$(printf '[\r\n1,# comment\r\n2,# comment\\\r\ncomment\r\n3\r\n]')") \
|| [ "$x" != '[1,2,3]' ]; then
echo 'multiline comment with CRLF line breaks was not handled correctly'
exit 1
fi
# CVE-2023-50268: No stack overflow comparing a nan with a large payload # CVE-2023-50268: No stack overflow comparing a nan with a large payload
if $JQ -ne 'have_decnum'; then if $JQ -ne 'have_decnum'; then
$VALGRIND $Q $JQ '1 != .' <<\EOF >/dev/null $VALGRIND $Q $JQ '1 != .' <<\EOF >/dev/null
@@ -715,20 +727,20 @@ if ! $msys && ! $mingw; then
echo "Incorrectly formatted local time" echo "Incorrectly formatted local time"
exit 1 exit 1
fi fi
if ! r=$(TZ=Europe/Paris $JQ -rn '1731627341 | strflocaltime("%F %T %z %Z")') \ if ! r=$(TZ=Europe/Paris $JQ -rn '1731627341 | strflocaltime("%F %T %z %Z")') \
|| [ "$r" != "2024-11-15 00:35:41 +0100 CET" ]; then || [ "$r" != "2024-11-15 00:35:41 +0100 CET" ]; then
echo "Incorrectly formatted local time" echo "Incorrectly formatted local time"
exit 1 exit 1
fi fi
if ! r=$(TZ=Europe/Paris $JQ -rn '1731627341 | strftime("%F %T %z %Z")') \ if ! r=$(TZ=Europe/Paris $JQ -rn '1731627341 | strftime("%F %T %z %Z")') \
|| ( [ "$r" != "2024-11-14 23:35:41 +0000 UTC" ] \ || ( [ "$r" != "2024-11-14 23:35:41 +0000 UTC" ] \
&& [ "$r" != "2024-11-14 23:35:41 +0000 GMT" ] ); then && [ "$r" != "2024-11-14 23:35:41 +0000 GMT" ] ); then
echo "Incorrectly formatted universal time" echo "Incorrectly formatted universal time"
exit 1 exit 1
fi fi
if ! r=$(TZ=Etc/GMT+7 $JQ -nc '1731627341 | .,. | [strftime("%FT%T"),strflocaltime("%FT%T%z")]' if ! r=$(TZ=Etc/GMT+7 $JQ -nc '1731627341 | .,. | [strftime("%FT%T"),strflocaltime("%FT%T%z")]'
) \ ) \
|| [ "$r" != '["2024-11-14T23:35:41","2024-11-14T16:35:41-0700"] || [ "$r" != '["2024-11-14T23:35:41","2024-11-14T16:35:41-0700"]