Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

relax iso_zone rule (for accepting postgresql and sqlite3)

  • Loading branch information...
commit 5f2a097de73740297a5ad9e23b88aac42ea3d4f4 1 parent 99b039a
@funny-falcon funny-falcon authored
Showing with 216 additions and 198 deletions.
  1. +206 −196 ext/date_ext/date_parser.c
  2. +10 −2 ext/date_ext/date_parser.rl
View
402 ext/date_ext/date_parser.c
@@ -99,23 +99,23 @@ static const char _date_parser_actions[] = {
static const short _date_parser_key_offsets[] = {
0, 0, 20, 22, 24, 26, 28, 30,
32, 34, 36, 40, 42, 44, 45, 47,
- 49, 50, 52, 54, 56, 58, 59, 61,
- 63, 65, 68, 70, 72, 74, 77, 80,
- 96, 100, 102, 103, 106, 108, 110, 112,
- 114, 117, 119, 120, 122, 124, 125, 127,
- 129, 131, 133, 135, 137, 139, 141, 143,
- 145, 147, 149, 153, 155, 159, 161, 165,
- 167, 169, 171, 173, 175, 177, 179, 183,
- 185, 187, 188, 195, 204, 206, 225, 229,
- 231, 237, 239, 241, 243, 245, 247, 248,
- 250, 252, 253, 255, 257, 259, 261, 263,
- 265, 267, 269, 271, 273, 275, 277, 279,
- 283, 285, 289, 291, 295, 297, 299, 301,
- 303, 305, 307, 328, 349, 351, 353, 355,
- 357, 361, 363, 367, 369, 371, 373, 375,
- 380, 383, 389, 394, 397, 401, 404, 409,
- 414, 417, 423, 448, 473, 476, 479, 482,
- 489, 494
+ 49, 50, 52, 54, 56, 58, 60, 62,
+ 65, 67, 69, 71, 74, 77, 93, 97,
+ 99, 100, 103, 105, 107, 109, 111, 114,
+ 116, 117, 119, 121, 122, 124, 126, 128,
+ 130, 132, 134, 136, 138, 140, 142, 144,
+ 146, 150, 152, 156, 158, 162, 164, 166,
+ 168, 170, 172, 174, 176, 180, 182, 184,
+ 185, 192, 201, 203, 222, 226, 228, 234,
+ 236, 238, 240, 242, 244, 245, 247, 249,
+ 250, 252, 254, 256, 258, 260, 262, 264,
+ 266, 268, 270, 272, 274, 276, 280, 282,
+ 286, 288, 292, 294, 296, 298, 300, 302,
+ 304, 325, 346, 348, 350, 352, 354, 358,
+ 360, 364, 366, 368, 370, 372, 377, 380,
+ 386, 391, 397, 400, 405, 409, 412, 417,
+ 422, 425, 431, 456, 481, 484, 487, 490,
+ 497, 502
};
static const char _date_parser_trans_keys[] = {
@@ -126,49 +126,50 @@ static const char _date_parser_trans_keys[] = {
49, 57, 45, 47, 48, 51, 49, 50,
49, 57, 48, 57, 58, 48, 53, 48,
57, 58, 48, 53, 48, 57, 48, 57,
- 48, 57, 58, 48, 57, 48, 57, 48,
- 52, 50, 48, 49, 48, 57, 48, 49,
- 48, 50, 48, 49, 57, 47, 48, 57,
- 65, 68, 70, 74, 77, 78, 79, 83,
- 97, 100, 102, 106, 109, 110, 111, 115,
- 80, 85, 112, 117, 82, 114, 47, 45,
- 48, 57, 48, 57, 48, 57, 48, 57,
- 48, 57, 50, 48, 49, 48, 57, 58,
- 48, 53, 48, 57, 58, 48, 53, 48,
- 57, 48, 57, 48, 57, 48, 57, 48,
- 57, 48, 52, 71, 103, 69, 101, 67,
- 99, 69, 101, 66, 98, 65, 85, 97,
- 117, 78, 110, 76, 78, 108, 110, 65,
- 97, 82, 89, 114, 121, 79, 111, 86,
- 118, 67, 99, 84, 116, 69, 101, 80,
- 112, 48, 57, 48, 49, 50, 57, 82,
- 114, 73, 105, 44, 32, 48, 51, 9,
- 13, 49, 50, 32, 48, 51, 9, 13,
- 49, 50, 52, 57, 49, 57, 32, 65,
- 68, 70, 74, 77, 78, 79, 83, 97,
- 100, 102, 106, 109, 110, 111, 115, 9,
- 13, 80, 85, 112, 117, 82, 114, 32,
- 45, 9, 13, 48, 57, 48, 57, 48,
- 57, 48, 57, 48, 57, 48, 57, 58,
- 48, 53, 48, 57, 58, 48, 53, 48,
- 57, 48, 57, 48, 57, 48, 57, 48,
- 57, 84, 116, 48, 52, 71, 103, 69,
- 101, 67, 99, 69, 101, 66, 98, 65,
- 85, 97, 117, 78, 110, 76, 78, 108,
- 110, 65, 97, 82, 89, 114, 121, 79,
- 111, 86, 118, 67, 99, 84, 116, 69,
- 101, 80, 112, 32, 65, 68, 70, 74,
+ 48, 57, 48, 57, 48, 52, 50, 48,
+ 49, 48, 57, 48, 49, 48, 50, 48,
+ 49, 57, 47, 48, 57, 65, 68, 70,
+ 74, 77, 78, 79, 83, 97, 100, 102,
+ 106, 109, 110, 111, 115, 80, 85, 112,
+ 117, 82, 114, 47, 45, 48, 57, 48,
+ 57, 48, 57, 48, 57, 48, 57, 50,
+ 48, 49, 48, 57, 58, 48, 53, 48,
+ 57, 58, 48, 53, 48, 57, 48, 57,
+ 48, 57, 48, 57, 48, 57, 48, 52,
+ 71, 103, 69, 101, 67, 99, 69, 101,
+ 66, 98, 65, 85, 97, 117, 78, 110,
+ 76, 78, 108, 110, 65, 97, 82, 89,
+ 114, 121, 79, 111, 86, 118, 67, 99,
+ 84, 116, 69, 101, 80, 112, 48, 57,
+ 48, 49, 50, 57, 82, 114, 73, 105,
+ 44, 32, 48, 51, 9, 13, 49, 50,
+ 32, 48, 51, 9, 13, 49, 50, 52,
+ 57, 49, 57, 32, 65, 68, 70, 74,
77, 78, 79, 83, 97, 100, 102, 106,
- 109, 110, 111, 115, 9, 13, 48, 57,
+ 109, 110, 111, 115, 9, 13, 80, 85,
+ 112, 117, 82, 114, 32, 45, 9, 13,
+ 48, 57, 48, 57, 48, 57, 48, 57,
+ 48, 57, 48, 57, 58, 48, 53, 48,
+ 57, 58, 48, 53, 48, 57, 48, 57,
+ 48, 57, 48, 57, 48, 57, 84, 116,
+ 48, 52, 71, 103, 69, 101, 67, 99,
+ 69, 101, 66, 98, 65, 85, 97, 117,
+ 78, 110, 76, 78, 108, 110, 65, 97,
+ 82, 89, 114, 121, 79, 111, 86, 118,
+ 67, 99, 84, 116, 69, 101, 80, 112,
32, 65, 68, 70, 74, 77, 78, 79,
83, 97, 100, 102, 106, 109, 110, 111,
- 115, 9, 13, 48, 49, 48, 57, 48,
- 49, 79, 111, 78, 110, 65, 85, 97,
- 117, 84, 116, 72, 85, 104, 117, 85,
- 117, 69, 101, 69, 101, 68, 100, 32,
- 84, 116, 9, 13, 32, 9, 13, 32,
- 50, 9, 13, 48, 49, 32, 43, 45,
- 9, 13, 32, 9, 13, 32, 58, 9,
+ 115, 9, 13, 48, 57, 32, 65, 68,
+ 70, 74, 77, 78, 79, 83, 97, 100,
+ 102, 106, 109, 110, 111, 115, 9, 13,
+ 48, 49, 48, 57, 48, 49, 79, 111,
+ 78, 110, 65, 85, 97, 117, 84, 116,
+ 72, 85, 104, 117, 85, 117, 69, 101,
+ 69, 101, 68, 100, 32, 84, 116, 9,
+ 13, 32, 9, 13, 32, 50, 9, 13,
+ 48, 49, 32, 43, 45, 9, 13, 32,
+ 58, 9, 13, 48, 57, 32, 9, 13,
+ 32, 9, 13, 48, 57, 32, 58, 9,
13, 32, 9, 13, 32, 43, 45, 9,
13, 32, 43, 45, 9, 13, 32, 9,
13, 32, 50, 9, 13, 48, 49, 32,
@@ -187,21 +188,21 @@ static const char _date_parser_trans_keys[] = {
static const char _date_parser_single_lengths[] = {
0, 14, 0, 0, 0, 0, 2, 2,
0, 2, 2, 0, 0, 1, 0, 0,
- 1, 0, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 0, 1, 1, 16,
- 4, 2, 1, 1, 0, 0, 0, 0,
- 1, 0, 1, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 2, 2, 2,
- 2, 2, 4, 2, 4, 2, 4, 2,
- 2, 2, 2, 2, 2, 0, 0, 2,
- 2, 1, 3, 3, 0, 17, 4, 2,
- 2, 0, 0, 0, 0, 0, 1, 0,
- 0, 1, 0, 0, 0, 0, 0, 0,
- 2, 0, 2, 2, 2, 2, 2, 4,
- 2, 4, 2, 4, 2, 2, 2, 2,
- 2, 2, 17, 17, 0, 0, 2, 2,
- 4, 2, 4, 2, 2, 2, 2, 3,
- 1, 2, 3, 1, 2, 1, 3, 3,
+ 1, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 16, 4, 2,
+ 1, 1, 0, 0, 0, 0, 1, 0,
+ 1, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 2, 2, 2, 2, 2,
+ 4, 2, 4, 2, 4, 2, 2, 2,
+ 2, 2, 2, 0, 0, 2, 2, 1,
+ 3, 3, 0, 17, 4, 2, 2, 0,
+ 0, 0, 0, 0, 1, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 2, 0,
+ 2, 2, 2, 2, 2, 4, 2, 4,
+ 2, 4, 2, 2, 2, 2, 2, 2,
+ 17, 17, 0, 0, 2, 2, 4, 2,
+ 4, 2, 2, 2, 2, 3, 1, 2,
+ 3, 2, 1, 1, 2, 1, 3, 3,
1, 2, 15, 15, 1, 1, 1, 5,
3, 3
};
@@ -209,21 +210,21 @@ static const char _date_parser_single_lengths[] = {
static const char _date_parser_range_lengths[] = {
0, 3, 1, 1, 1, 1, 0, 0,
1, 0, 1, 1, 1, 0, 1, 1,
- 0, 1, 1, 1, 1, 0, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 1, 1, 1, 1, 1,
- 1, 1, 0, 1, 1, 0, 1, 1,
+ 0, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 0, 0, 0,
+ 0, 1, 1, 1, 1, 1, 1, 1,
+ 0, 1, 1, 0, 1, 1, 1, 1,
+ 1, 1, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 2, 0,
- 0, 0, 2, 3, 1, 1, 0, 0,
- 2, 1, 1, 1, 1, 1, 0, 1,
- 1, 0, 1, 1, 1, 1, 1, 1,
- 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 2, 0, 0, 0,
+ 2, 3, 1, 1, 0, 0, 2, 1,
+ 1, 1, 1, 1, 0, 1, 1, 0,
+ 1, 1, 1, 1, 1, 1, 0, 1,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 2, 2, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 1,
- 1, 2, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 2, 2, 1, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 1, 2,
+ 1, 2, 1, 2, 1, 1, 1, 1,
1, 2, 5, 5, 1, 1, 1, 1,
1, 1
};
@@ -232,22 +233,22 @@ static const short _date_parser_index_offsets[] = {
0, 0, 18, 20, 22, 24, 26, 29,
32, 34, 37, 41, 43, 45, 47, 49,
51, 53, 55, 57, 59, 61, 63, 65,
- 67, 69, 72, 74, 76, 78, 81, 84,
- 101, 106, 109, 111, 114, 116, 118, 120,
- 122, 125, 127, 129, 131, 133, 135, 137,
- 139, 141, 143, 145, 147, 149, 152, 155,
- 158, 161, 164, 169, 172, 177, 180, 185,
- 188, 191, 194, 197, 200, 203, 205, 208,
- 211, 214, 216, 222, 229, 231, 250, 255,
- 258, 263, 265, 267, 269, 271, 273, 275,
- 277, 279, 281, 283, 285, 287, 289, 291,
- 293, 296, 298, 301, 304, 307, 310, 313,
- 318, 321, 326, 329, 334, 337, 340, 343,
- 346, 349, 352, 372, 392, 394, 396, 399,
- 402, 407, 410, 415, 418, 421, 424, 427,
- 432, 435, 440, 445, 448, 452, 455, 460,
- 465, 468, 473, 494, 515, 518, 521, 524,
- 531, 536
+ 68, 70, 72, 74, 77, 80, 97, 102,
+ 105, 107, 110, 112, 114, 116, 118, 121,
+ 123, 125, 127, 129, 131, 133, 135, 137,
+ 139, 141, 143, 145, 148, 151, 154, 157,
+ 160, 165, 168, 173, 176, 181, 184, 187,
+ 190, 193, 196, 199, 201, 204, 207, 210,
+ 212, 218, 225, 227, 246, 251, 254, 259,
+ 261, 263, 265, 267, 269, 271, 273, 275,
+ 277, 279, 281, 283, 285, 287, 289, 292,
+ 294, 297, 300, 303, 306, 309, 314, 317,
+ 322, 325, 330, 333, 336, 339, 342, 345,
+ 348, 368, 388, 390, 392, 395, 398, 403,
+ 406, 411, 414, 417, 420, 423, 428, 431,
+ 436, 441, 446, 449, 453, 457, 460, 465,
+ 470, 473, 478, 499, 520, 523, 526, 529,
+ 536, 541
};
static const unsigned char _date_parser_indicies[] = {
@@ -258,90 +259,91 @@ static const unsigned char _date_parser_indicies[] = {
19, 1, 20, 20, 1, 21, 23, 22,
1, 24, 1, 25, 1, 26, 1, 27,
1, 28, 1, 29, 1, 30, 1, 31,
- 1, 32, 1, 33, 1, 34, 1, 35,
- 1, 36, 1, 25, 1, 38, 37, 1,
- 24, 1, 24, 1, 19, 1, 13, 39,
- 1, 40, 14, 1, 41, 42, 43, 44,
- 45, 46, 47, 48, 41, 42, 43, 44,
- 45, 46, 47, 48, 1, 49, 50, 49,
- 50, 1, 51, 51, 1, 52, 1, 53,
- 54, 1, 55, 1, 56, 1, 57, 1,
- 58, 1, 60, 59, 1, 61, 1, 62,
+ 1, 32, 1, 33, 1, 34, 1, 25,
+ 1, 36, 35, 1, 24, 1, 24, 1,
+ 19, 1, 13, 37, 1, 38, 14, 1,
+ 39, 40, 41, 42, 43, 44, 45, 46,
+ 39, 40, 41, 42, 43, 44, 45, 46,
+ 1, 47, 48, 47, 48, 1, 49, 49,
+ 1, 50, 1, 51, 52, 1, 53, 1,
+ 54, 1, 55, 1, 56, 1, 58, 57,
+ 1, 59, 1, 60, 1, 61, 1, 62,
1, 63, 1, 64, 1, 65, 1, 66,
- 1, 67, 1, 68, 1, 69, 1, 70,
- 1, 71, 1, 61, 1, 51, 51, 1,
- 72, 72, 1, 51, 51, 1, 73, 73,
- 1, 51, 51, 1, 74, 75, 74, 75,
- 1, 51, 51, 1, 51, 51, 51, 51,
- 1, 76, 76, 1, 51, 51, 51, 51,
- 1, 77, 77, 1, 51, 51, 1, 78,
- 78, 1, 51, 51, 1, 79, 79, 1,
- 51, 51, 1, 39, 1, 39, 13, 1,
- 80, 80, 1, 81, 81, 1, 82, 1,
- 83, 84, 86, 82, 85, 1, 83, 84,
- 88, 82, 87, 89, 1, 89, 1, 89,
- 90, 91, 92, 93, 94, 95, 96, 97,
- 90, 91, 92, 93, 94, 95, 96, 97,
- 89, 1, 98, 99, 98, 99, 1, 100,
- 100, 1, 100, 101, 100, 102, 1, 103,
+ 1, 67, 1, 68, 1, 69, 1, 59,
+ 1, 49, 49, 1, 70, 70, 1, 49,
+ 49, 1, 71, 71, 1, 49, 49, 1,
+ 72, 73, 72, 73, 1, 49, 49, 1,
+ 49, 49, 49, 49, 1, 74, 74, 1,
+ 49, 49, 49, 49, 1, 75, 75, 1,
+ 49, 49, 1, 76, 76, 1, 49, 49,
+ 1, 77, 77, 1, 49, 49, 1, 37,
+ 1, 37, 13, 1, 78, 78, 1, 79,
+ 79, 1, 80, 1, 81, 82, 84, 80,
+ 83, 1, 81, 82, 86, 80, 85, 87,
+ 1, 87, 1, 87, 88, 89, 90, 91,
+ 92, 93, 94, 95, 88, 89, 90, 91,
+ 92, 93, 94, 95, 87, 1, 96, 97,
+ 96, 97, 1, 98, 98, 1, 98, 99,
+ 98, 100, 1, 101, 1, 102, 1, 103,
1, 104, 1, 105, 1, 106, 1, 107,
1, 108, 1, 109, 1, 110, 1, 111,
1, 112, 1, 113, 1, 114, 1, 115,
- 1, 116, 1, 117, 1, 118, 118, 1,
- 107, 1, 100, 100, 1, 119, 119, 1,
- 100, 100, 1, 120, 120, 1, 100, 100,
- 1, 121, 122, 121, 122, 1, 100, 100,
- 1, 100, 100, 100, 100, 1, 123, 123,
- 1, 100, 100, 100, 100, 1, 124, 124,
- 1, 100, 100, 1, 125, 125, 1, 100,
- 100, 1, 126, 126, 1, 100, 100, 1,
- 89, 90, 91, 92, 93, 94, 95, 96,
- 97, 90, 91, 92, 93, 94, 95, 96,
- 97, 89, 89, 1, 89, 90, 91, 92,
- 93, 94, 95, 96, 97, 90, 91, 92,
- 93, 94, 95, 96, 97, 89, 89, 1,
- 89, 1, 89, 1, 127, 127, 1, 81,
- 81, 1, 128, 127, 128, 127, 1, 81,
- 81, 1, 129, 130, 129, 130, 1, 81,
- 81, 1, 81, 81, 1, 131, 131, 1,
- 81, 81, 1, 133, 134, 134, 132, 1,
- 132, 132, 1, 132, 38, 132, 37, 1,
- 135, 136, 136, 135, 1, 137, 137, 1,
- 138, 139, 138, 1, 138, 138, 1, 140,
- 141, 141, 140, 1, 142, 141, 141, 142,
- 1, 143, 143, 1, 106, 145, 106, 144,
- 1, 146, 147, 147, 149, 149, 150, 149,
- 149, 151, 149, 149, 150, 149, 149, 151,
- 146, 148, 148, 148, 148, 1, 152, 147,
+ 1, 116, 116, 1, 105, 1, 98, 98,
+ 1, 117, 117, 1, 98, 98, 1, 118,
+ 118, 1, 98, 98, 1, 119, 120, 119,
+ 120, 1, 98, 98, 1, 98, 98, 98,
+ 98, 1, 121, 121, 1, 98, 98, 98,
+ 98, 1, 122, 122, 1, 98, 98, 1,
+ 123, 123, 1, 98, 98, 1, 124, 124,
+ 1, 98, 98, 1, 87, 88, 89, 90,
+ 91, 92, 93, 94, 95, 88, 89, 90,
+ 91, 92, 93, 94, 95, 87, 87, 1,
+ 87, 88, 89, 90, 91, 92, 93, 94,
+ 95, 88, 89, 90, 91, 92, 93, 94,
+ 95, 87, 87, 1, 87, 1, 87, 1,
+ 125, 125, 1, 79, 79, 1, 126, 125,
+ 126, 125, 1, 79, 79, 1, 127, 128,
+ 127, 128, 1, 79, 79, 1, 79, 79,
+ 1, 129, 129, 1, 79, 79, 1, 131,
+ 132, 132, 130, 1, 130, 130, 1, 130,
+ 36, 130, 35, 1, 133, 134, 134, 133,
+ 1, 135, 137, 135, 136, 1, 135, 135,
+ 1, 135, 135, 136, 1, 138, 139, 138,
+ 1, 138, 138, 1, 140, 141, 141, 140,
+ 1, 142, 141, 141, 142, 1, 143, 143,
+ 1, 104, 145, 104, 144, 1, 146, 147,
147, 149, 149, 150, 149, 149, 151, 149,
- 149, 150, 149, 149, 151, 152, 148, 148,
- 148, 148, 1, 153, 153, 1, 154, 154,
- 1, 155, 155, 1, 155, 156, 156, 156,
- 156, 155, 1, 155, 156, 156, 155, 1,
- 155, 118, 118, 155, 1, 0
+ 149, 150, 149, 149, 151, 146, 148, 148,
+ 148, 148, 1, 152, 147, 147, 149, 149,
+ 150, 149, 149, 151, 149, 149, 150, 149,
+ 149, 151, 152, 148, 148, 148, 148, 1,
+ 153, 153, 1, 154, 154, 1, 155, 155,
+ 1, 155, 156, 156, 156, 156, 155, 1,
+ 155, 156, 156, 155, 1, 155, 116, 116,
+ 155, 1, 0
};
static const unsigned char _date_parser_trans_targs[] = {
- 1, 0, 2, 29, 69, 70, 3, 71,
- 118, 120, 122, 125, 3, 4, 5, 6,
- 7, 8, 28, 9, 10, 11, 26, 27,
- 127, 13, 14, 15, 16, 17, 18, 130,
- 20, 21, 22, 23, 131, 12, 24, 30,
- 31, 32, 54, 56, 58, 61, 63, 65,
- 67, 33, 53, 34, 35, 36, 37, 37,
- 38, 39, 132, 41, 52, 42, 43, 44,
- 45, 46, 47, 134, 49, 50, 51, 136,
- 55, 57, 59, 60, 62, 64, 66, 68,
- 72, 73, 74, 75, 76, 116, 117, 114,
- 115, 77, 78, 99, 101, 103, 106, 108,
- 110, 112, 79, 98, 80, 81, 82, 82,
- 83, 84, 137, 86, 87, 88, 89, 90,
- 91, 138, 93, 94, 95, 140, 142, 100,
- 102, 104, 105, 107, 109, 111, 113, 119,
- 121, 123, 124, 126, 128, 129, 25, 128,
- 19, 128, 133, 40, 135, 48, 135, 133,
- 85, 97, 139, 92, 142, 143, 144, 145,
- 139, 141, 141, 141, 96
+ 1, 0, 2, 27, 67, 68, 3, 69,
+ 116, 118, 120, 123, 3, 4, 5, 6,
+ 7, 8, 26, 9, 10, 11, 24, 25,
+ 125, 13, 14, 15, 16, 17, 18, 128,
+ 20, 129, 130, 12, 22, 28, 29, 30,
+ 52, 54, 56, 59, 61, 63, 65, 31,
+ 51, 32, 33, 34, 35, 35, 36, 37,
+ 132, 39, 50, 40, 41, 42, 43, 44,
+ 45, 134, 47, 48, 49, 136, 53, 55,
+ 57, 58, 60, 62, 64, 66, 70, 71,
+ 72, 73, 74, 114, 115, 112, 113, 75,
+ 76, 97, 99, 101, 104, 106, 108, 110,
+ 77, 96, 78, 79, 80, 80, 81, 82,
+ 137, 84, 85, 86, 87, 88, 89, 138,
+ 91, 92, 93, 140, 142, 98, 100, 102,
+ 103, 105, 107, 109, 111, 117, 119, 121,
+ 122, 124, 126, 127, 23, 126, 19, 126,
+ 21, 131, 133, 38, 135, 46, 135, 133,
+ 83, 95, 139, 90, 142, 143, 144, 145,
+ 139, 141, 141, 141, 94
};
static const char _date_parser_trans_actions[] = {
@@ -349,20 +351,20 @@ static const char _date_parser_trans_actions[] = {
19, 19, 19, 19, 0, 0, 0, 0,
0, 3, 3, 0, 0, 5, 5, 5,
0, 0, 0, 9, 0, 0, 11, 0,
- 0, 0, 0, 0, 0, 7, 7, 0,
- 0, 39, 39, 39, 39, 39, 39, 39,
- 39, 0, 0, 0, 0, 41, 41, 0,
- 0, 0, 0, 43, 43, 0, 0, 45,
- 0, 0, 47, 0, 0, 0, 0, 0,
+ 0, 0, 0, 7, 7, 0, 0, 39,
+ 39, 39, 39, 39, 39, 39, 39, 0,
+ 0, 0, 0, 41, 41, 0, 0, 0,
+ 0, 43, 43, 0, 0, 45, 0, 0,
+ 47, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 21, 21, 21, 21, 21, 21, 0,
+ 23, 23, 23, 23, 23, 23, 23, 23,
+ 0, 0, 0, 25, 25, 0, 0, 0,
+ 0, 0, 0, 29, 0, 0, 31, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 21, 21, 21, 21, 21,
- 21, 0, 23, 23, 23, 23, 23, 23,
- 23, 23, 0, 0, 0, 25, 25, 0,
- 0, 0, 0, 0, 0, 29, 0, 0,
- 31, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 15,
- 13, 61, 0, 0, 51, 49, 0, 76,
+ 0, 0, 0, 0, 0, 15, 13, 61,
+ 0, 0, 0, 0, 51, 49, 0, 76,
27, 27, 35, 33, 33, 33, 33, 33,
0, 67, 0, 70, 0
};
@@ -383,14 +385,14 @@ static const char _date_parser_eof_actions[] = {
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, 0, 0, 0, 0, 0, 17,
- 17, 17, 58, 79, 53, 53, 73, 53,
+ 0, 0, 0, 0, 0, 17, 17, 17,
+ 58, 79, 79, 79, 53, 53, 73, 53,
91, 37, 64, 37, 83, 37, 87, 87,
87, 87
};
static const int date_parser_start = 1;
-static const int date_parser_first_final = 127;
+static const int date_parser_first_final = 125;
static const int date_parser_error = 0;
static const int date_parser_en_main = 1;
@@ -456,14 +458,14 @@ VALUE rhrd__ragel_parse(char * p, long len) {
eof = pe;
-#line 460 "date_parser.c"
+#line 462 "date_parser.c"
{
cs = date_parser_start;
}
#line 244 "date_parser.rl"
-#line 467 "date_parser.c"
+#line 469 "date_parser.c"
{
int _klen;
unsigned int _trans;
@@ -665,7 +667,7 @@ VALUE rhrd__ragel_parse(char * p, long len) {
clf_state |= RHRR_CLF_ZONE_SET;
}
break;
-#line 669 "date_parser.c"
+#line 671 "date_parser.c"
}
}
@@ -733,7 +735,7 @@ VALUE rhrd__ragel_parse(char * p, long len) {
#line 168 "date_parser.rl"
{ parsers |= RHRR_CLF_PARSER; }
break;
-#line 737 "date_parser.c"
+#line 739 "date_parser.c"
}
}
}
@@ -757,7 +759,15 @@ VALUE rhrd__ragel_parse(char * p, long len) {
if (iso_state & RHRR_ISO_ZONE_SET) {
zone = t_iso_zone;
zone_len = t_iso_zone_end - zone;
- offset = atol(zone) * 3600 + atol(zone + 4) * 60;
+ if (zone_len == 3) { /* case for postgresql +03 */
+ offset = atol(zone) * 3600;
+ } else if (zone_len == 6) { /* standart iso */
+ offset = atol(zone) * 3600 + atol(zone + 4) * 60;
+ } else if (zone_len == 5) { /* case for sqlite +0300 */
+ char hours[3] = { zone[1], zone[2], 0};
+ offset = atol(hours) * 3600 + atol(zone + 3) * 60;
+ offset *= (zone[0] == '-') ? -1 : 1;
+ }
state |= RHRR_ZONE_SET | RHRR_OFFSET_SET;
}
}
View
12 ext/date_ext/date_parser.rl
@@ -107,7 +107,7 @@ long rhrd__weekday_num(char * str) {
iso_hour = ([0-1] . [0-9] | '2' . [0-4]) >tag_iso_hour;
iso_minute = ([0-5] . [0-9]) >tag_iso_minute;
iso_second = ([0-5] . [0-9]) >tag_iso_second;
- iso_zone = ([+\-] . digit{2} . ':' . digit{2}) > tag_iso_zone;
+ iso_zone = ([+\-] . digit{2} . ':'? . digit{2}?) > tag_iso_zone;
iso_date = (iso_year . [\-/] . iso_month . [\-/] . iso_day);
iso_time = (iso_hour . ':' . iso_minute . ':' . iso_second . (iso_zone %set_iso_zone)?) %set_iso_time;
@@ -257,7 +257,15 @@ VALUE rhrd__ragel_parse(char * p, long len) {
if (iso_state & RHRR_ISO_ZONE_SET) {
zone = t_iso_zone;
zone_len = t_iso_zone_end - zone;
- offset = atol(zone) * 3600 + atol(zone + 4) * 60;
+ if (zone_len == 3) { /* case for postgresql +03 */
+ offset = atol(zone) * 3600;
+ } else if (zone_len == 6) { /* standart iso */
+ offset = atol(zone) * 3600 + atol(zone + 4) * 60;
+ } else if (zone_len == 5) { /* case for sqlite +0300 */
+ char hours[3] = { zone[1], zone[2], 0};
+ offset = atol(hours) * 3600 + atol(zone + 3) * 60;
+ offset *= (zone[0] == '-') ? -1 : 1;
+ }
state |= RHRR_ZONE_SET | RHRR_OFFSET_SET;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.