Skip to content
Browse files

Use atoi instead of rb_cstr_to_dbl to allow compilation on JRuby 1.6.0

  • Loading branch information...
1 parent bb21a5b commit 31a0c3ddf1ca139f747a758a76759ceb1cffd13b @jeremyevans committed Mar 18, 2011
Showing with 263 additions and 246 deletions.
  1. +256 −243 ext/date_ext/date_parser.c
  2. +7 −3 ext/date_ext/date_parser.rl
View
499 ext/date_ext/date_parser.c
@@ -104,23 +104,23 @@ 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, 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,
+ 64, 67, 69, 71, 73, 76, 79, 95,
+ 99, 101, 102, 105, 107, 109, 111, 113,
+ 116, 118, 119, 121, 123, 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, 392, 398, 401, 406, 413, 420, 427,
- 434, 441, 448, 453, 457, 460, 465, 470,
- 473, 479, 504, 529, 532, 535, 538, 545,
- 550
+ 146, 148, 152, 154, 158, 160, 164, 166,
+ 168, 170, 172, 174, 176, 178, 182, 184,
+ 186, 187, 194, 203, 205, 224, 228, 230,
+ 236, 238, 240, 242, 244, 246, 247, 249,
+ 251, 252, 254, 256, 258, 260, 262, 264,
+ 266, 268, 270, 272, 274, 276, 278, 282,
+ 284, 288, 290, 294, 296, 298, 300, 302,
+ 304, 306, 327, 348, 350, 352, 354, 356,
+ 360, 362, 366, 368, 370, 372, 374, 379,
+ 382, 388, 394, 400, 403, 408, 415, 422,
+ 429, 436, 443, 450, 457, 464, 469, 473,
+ 476, 481, 486, 489, 495, 520, 545, 548,
+ 551, 554, 561, 566
};
static const char _date_parser_trans_keys[] = {
@@ -131,50 +131,52 @@ 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, 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,
+ 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, 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, 57, 32, 65, 68,
+ 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, 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, 46, 9, 13,
- 32, 58, 9, 13, 48, 57, 32, 9,
- 13, 32, 9, 13, 48, 57, 32, 43,
+ 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, 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, 46,
+ 9, 13, 32, 58, 9, 13, 48, 57,
+ 32, 9, 13, 32, 9, 13, 48, 57,
+ 32, 43, 45, 9, 13, 48, 57, 32,
+ 43, 45, 9, 13, 48, 57, 32, 43,
45, 9, 13, 48, 57, 32, 43, 45,
9, 13, 48, 57, 32, 43, 45, 9,
13, 48, 57, 32, 43, 45, 9, 13,
@@ -199,70 +201,70 @@ 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, 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,
- 4, 2, 1, 1, 3, 3, 3, 3,
- 3, 3, 3, 2, 1, 3, 3, 1,
- 2, 15, 15, 1, 1, 1, 5, 3,
- 3
+ 1, 0, 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, 4, 2, 1, 1, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 2, 1,
+ 3, 3, 1, 2, 15, 15, 1, 1,
+ 1, 5, 3, 3
};
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, 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, 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,
+ 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, 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, 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, 2, 2, 2, 2,
- 2, 2, 1, 1, 1, 1, 1, 1,
- 2, 5, 5, 1, 1, 1, 1, 1,
- 1
+ 0, 2, 2, 1, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 1,
+ 2, 1, 2, 1, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 1, 1, 1,
+ 1, 1, 1, 2, 5, 5, 1, 1,
+ 1, 1, 1, 1
};
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,
- 68, 70, 72, 74, 77, 80, 97, 102,
- 105, 107, 110, 112, 114, 116, 118, 121,
+ 67, 70, 72, 74, 76, 79, 82, 99,
+ 104, 107, 109, 112, 114, 116, 118, 120,
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,
+ 139, 141, 143, 145, 147, 150, 153, 156,
+ 159, 162, 167, 170, 175, 178, 183, 186,
+ 189, 192, 195, 198, 201, 203, 206, 209,
+ 212, 214, 220, 227, 229, 248, 253, 256,
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, 442, 447, 450, 454, 460, 466, 472,
- 478, 484, 490, 495, 499, 502, 507, 512,
- 515, 520, 541, 562, 565, 568, 571, 578,
- 583
+ 277, 279, 281, 283, 285, 287, 289, 291,
+ 294, 296, 299, 302, 305, 308, 311, 316,
+ 319, 324, 327, 332, 335, 338, 341, 344,
+ 347, 350, 370, 390, 392, 394, 397, 400,
+ 405, 408, 413, 416, 419, 422, 425, 430,
+ 433, 438, 444, 449, 452, 456, 462, 468,
+ 474, 480, 486, 492, 498, 504, 509, 513,
+ 516, 521, 526, 529, 534, 555, 576, 579,
+ 582, 585, 592, 597
};
static const unsigned char _date_parser_indicies[] = {
@@ -273,121 +275,125 @@ 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, 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, 32, 1, 33, 1, 34, 1, 35,
+ 1, 25, 1, 37, 36, 1, 24, 1,
+ 24, 1, 19, 1, 13, 38, 1, 39,
+ 14, 1, 40, 41, 42, 43, 44, 45,
+ 46, 47, 40, 41, 42, 43, 44, 45,
+ 46, 47, 1, 48, 49, 48, 49, 1,
+ 50, 50, 1, 51, 1, 52, 53, 1,
+ 54, 1, 55, 1, 56, 1, 57, 1,
+ 59, 58, 1, 60, 1, 61, 1, 62,
1, 63, 1, 64, 1, 65, 1, 66,
- 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, 67, 1, 68, 1, 69, 1, 70,
+ 1, 60, 1, 50, 50, 1, 71, 71,
+ 1, 50, 50, 1, 72, 72, 1, 50,
+ 50, 1, 73, 74, 73, 74, 1, 50,
+ 50, 1, 50, 50, 50, 50, 1, 75,
+ 75, 1, 50, 50, 50, 50, 1, 76,
+ 76, 1, 50, 50, 1, 77, 77, 1,
+ 50, 50, 1, 78, 78, 1, 50, 50,
+ 1, 38, 1, 38, 13, 1, 79, 79,
+ 1, 80, 80, 1, 81, 1, 82, 83,
+ 85, 81, 84, 1, 82, 83, 87, 81,
+ 86, 88, 1, 88, 1, 88, 89, 90,
+ 91, 92, 93, 94, 95, 96, 89, 90,
+ 91, 92, 93, 94, 95, 96, 88, 1,
+ 97, 98, 97, 98, 1, 99, 99, 1,
+ 99, 100, 99, 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, 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, 135,
- 133, 1, 136, 138, 136, 137, 1, 136,
- 136, 1, 136, 136, 137, 1, 139, 140,
- 140, 139, 141, 1, 139, 140, 140, 139,
- 142, 1, 139, 140, 140, 139, 143, 1,
- 139, 140, 140, 139, 144, 1, 139, 140,
- 140, 139, 145, 1, 139, 140, 140, 139,
- 146, 1, 139, 140, 140, 139, 1, 147,
- 148, 147, 1, 147, 147, 1, 149, 150,
- 150, 149, 1, 151, 150, 150, 151, 1,
- 152, 152, 1, 104, 154, 104, 153, 1,
- 155, 156, 156, 158, 158, 159, 158, 158,
- 160, 158, 158, 159, 158, 158, 160, 155,
- 157, 157, 157, 157, 1, 161, 156, 156,
- 158, 158, 159, 158, 158, 160, 158, 158,
- 159, 158, 158, 160, 161, 157, 157, 157,
- 157, 1, 162, 162, 1, 163, 163, 1,
- 164, 164, 1, 164, 165, 165, 165, 165,
- 164, 1, 164, 165, 165, 164, 1, 164,
- 116, 116, 164, 1, 0
+ 1, 116, 1, 117, 117, 1, 106, 1,
+ 99, 99, 1, 118, 118, 1, 99, 99,
+ 1, 119, 119, 1, 99, 99, 1, 120,
+ 121, 120, 121, 1, 99, 99, 1, 99,
+ 99, 99, 99, 1, 122, 122, 1, 99,
+ 99, 99, 99, 1, 123, 123, 1, 99,
+ 99, 1, 124, 124, 1, 99, 99, 1,
+ 125, 125, 1, 99, 99, 1, 88, 89,
+ 90, 91, 92, 93, 94, 95, 96, 89,
+ 90, 91, 92, 93, 94, 95, 96, 88,
+ 88, 1, 88, 89, 90, 91, 92, 93,
+ 94, 95, 96, 89, 90, 91, 92, 93,
+ 94, 95, 96, 88, 88, 1, 88, 1,
+ 88, 1, 126, 126, 1, 80, 80, 1,
+ 127, 126, 127, 126, 1, 80, 80, 1,
+ 128, 129, 128, 129, 1, 80, 80, 1,
+ 80, 80, 1, 130, 130, 1, 80, 80,
+ 1, 132, 133, 133, 131, 1, 131, 131,
+ 1, 131, 37, 131, 36, 1, 134, 135,
+ 135, 136, 134, 1, 137, 139, 137, 138,
+ 1, 137, 137, 1, 137, 137, 138, 1,
+ 140, 141, 141, 140, 142, 1, 140, 141,
+ 141, 140, 143, 1, 140, 141, 141, 140,
+ 144, 1, 140, 141, 141, 140, 145, 1,
+ 140, 141, 141, 140, 146, 1, 140, 141,
+ 141, 140, 147, 1, 140, 141, 141, 140,
+ 148, 1, 140, 141, 141, 140, 149, 1,
+ 140, 141, 141, 140, 1, 150, 151, 150,
+ 1, 150, 150, 1, 152, 153, 153, 152,
+ 1, 154, 153, 153, 154, 1, 155, 155,
+ 1, 105, 157, 105, 156, 1, 158, 159,
+ 159, 161, 161, 162, 161, 161, 163, 161,
+ 161, 162, 161, 161, 163, 158, 160, 160,
+ 160, 160, 1, 164, 159, 159, 161, 161,
+ 162, 161, 161, 163, 161, 161, 162, 161,
+ 161, 163, 164, 160, 160, 160, 160, 1,
+ 165, 165, 1, 166, 166, 1, 167, 167,
+ 1, 167, 168, 168, 168, 168, 167, 1,
+ 167, 168, 168, 167, 1, 167, 117, 117,
+ 167, 1, 0
};
static const unsigned char _date_parser_trans_targs[] = {
- 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,
- 139, 39, 50, 40, 41, 42, 43, 44,
- 45, 141, 47, 48, 49, 143, 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,
- 144, 84, 85, 86, 87, 88, 89, 145,
- 91, 92, 93, 147, 149, 98, 100, 102,
- 103, 105, 107, 109, 111, 117, 119, 121,
- 122, 124, 126, 127, 23, 126, 19, 132,
- 126, 21, 131, 126, 19, 133, 134, 135,
- 136, 137, 138, 140, 38, 142, 46, 142,
- 140, 83, 95, 146, 90, 149, 150, 151,
- 152, 146, 148, 148, 148, 94
+ 1, 0, 2, 28, 68, 69, 3, 70,
+ 117, 119, 121, 124, 3, 4, 5, 6,
+ 7, 8, 27, 9, 10, 11, 25, 26,
+ 126, 13, 14, 15, 16, 17, 18, 129,
+ 20, 130, 131, 133, 12, 23, 29, 30,
+ 31, 53, 55, 57, 60, 62, 64, 66,
+ 32, 52, 33, 34, 35, 36, 36, 37,
+ 38, 142, 40, 51, 41, 42, 43, 44,
+ 45, 46, 144, 48, 49, 50, 146, 54,
+ 56, 58, 59, 61, 63, 65, 67, 71,
+ 72, 73, 74, 75, 115, 116, 113, 114,
+ 76, 77, 98, 100, 102, 105, 107, 109,
+ 111, 78, 97, 79, 80, 81, 81, 82,
+ 83, 147, 85, 86, 87, 88, 89, 90,
+ 148, 92, 93, 94, 150, 152, 99, 101,
+ 103, 104, 106, 108, 110, 112, 118, 120,
+ 122, 123, 125, 127, 128, 24, 127, 19,
+ 22, 127, 21, 132, 127, 19, 134, 135,
+ 136, 137, 138, 139, 140, 141, 143, 39,
+ 145, 47, 145, 143, 84, 96, 149, 91,
+ 152, 153, 154, 155, 149, 151, 151, 151,
+ 95
};
static const char _date_parser_trans_actions[] = {
0, 0, 1, 57, 57, 57, 1, 21,
21, 21, 21, 21, 0, 0, 0, 0,
0, 3, 3, 0, 0, 5, 5, 5,
0, 0, 0, 9, 0, 0, 11, 0,
- 0, 0, 0, 7, 7, 0, 0, 41,
- 41, 41, 41, 41, 41, 41, 41, 0,
- 0, 0, 0, 43, 43, 0, 0, 0,
- 0, 45, 45, 0, 0, 47, 0, 0,
- 49, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 7, 7, 0, 0,
+ 41, 41, 41, 41, 41, 41, 41, 41,
+ 0, 0, 0, 0, 43, 43, 0, 0,
+ 0, 0, 45, 45, 0, 0, 47, 0,
+ 0, 49, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 23, 23, 23, 23, 23, 23,
+ 0, 25, 25, 25, 25, 25, 25, 25,
+ 25, 0, 0, 0, 27, 27, 0, 0,
+ 0, 0, 0, 0, 31, 0, 0, 33,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 23, 23, 23, 23, 23, 23, 0,
- 25, 25, 25, 25, 25, 25, 25, 25,
- 0, 0, 0, 27, 27, 0, 0, 0,
- 0, 0, 0, 31, 0, 0, 33, 0,
0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 17, 15,
+ 13, 69, 0, 0, 66, 63, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 17, 15, 13,
- 69, 0, 0, 66, 63, 0, 0, 0,
- 0, 0, 0, 0, 0, 53, 51, 0,
- 84, 29, 29, 37, 35, 35, 35, 35,
- 35, 0, 75, 0, 78, 0
+ 53, 51, 0, 84, 29, 29, 37, 35,
+ 35, 35, 35, 35, 0, 75, 0, 78,
+ 0
};
static const char _date_parser_eof_actions[] = {
@@ -406,21 +412,21 @@ 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, 19, 19, 19,
- 60, 91, 91, 91, 87, 87, 87, 87,
- 87, 87, 87, 55, 55, 81, 55, 103,
- 39, 72, 39, 95, 39, 99, 99, 99,
- 99
+ 0, 0, 0, 0, 0, 0, 19, 19,
+ 19, 60, 91, 91, 91, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 55, 55,
+ 81, 55, 103, 39, 72, 39, 95, 39,
+ 99, 99, 99, 99
};
static const int date_parser_start = 1;
-static const int date_parser_first_final = 125;
+static const int date_parser_first_final = 126;
static const int date_parser_error = 0;
static const int date_parser_en_main = 1;
-#line 192 "date_parser.rl"
+#line 195 "date_parser.rl"
VALUE rhrd__ragel_parse(char * p, long len) {
@@ -451,6 +457,7 @@ VALUE rhrd__ragel_parse(char * p, long len) {
char * t_iso_minute = NULL;
char * t_iso_second = NULL;
char * t_iso_sec_fraction = NULL;
+ char * t_iso_sec_fraction_end = NULL;
char * t_iso_zone = NULL;
char * t_iso_zone_end = NULL;
@@ -482,14 +489,14 @@ VALUE rhrd__ragel_parse(char * p, long len) {
eof = pe;
-#line 486 "date_parser.c"
+#line 493 "date_parser.c"
{
cs = date_parser_start;
}
-#line 253 "date_parser.rl"
+#line 257 "date_parser.rl"
-#line 493 "date_parser.c"
+#line 500 "date_parser.c"
{
int _klen;
unsigned int _trans;
@@ -601,105 +608,108 @@ VALUE rhrd__ragel_parse(char * p, long len) {
break;
case 9:
#line 101 "date_parser.rl"
- { iso_state |= RHRR_ISO_SEC_FRACTION_SET; }
+ {
+ t_iso_sec_fraction_end = p;
+ iso_state |= RHRR_ISO_SEC_FRACTION_SET;
+ }
break;
case 10:
-#line 102 "date_parser.rl"
+#line 105 "date_parser.rl"
{
t_iso_zone_end = p;
iso_state |= RHRR_ISO_ZONE_SET;
}
break;
case 12:
-#line 125 "date_parser.rl"
+#line 128 "date_parser.rl"
{ t_rfc_wday = p; }
break;
case 13:
-#line 126 "date_parser.rl"
+#line 129 "date_parser.rl"
{ t_rfc_day = p; }
break;
case 14:
-#line 127 "date_parser.rl"
+#line 130 "date_parser.rl"
{ t_rfc_month = p; }
break;
case 15:
-#line 128 "date_parser.rl"
+#line 131 "date_parser.rl"
{ t_rfc_year = p; }
break;
case 16:
-#line 129 "date_parser.rl"
+#line 132 "date_parser.rl"
{ t_rfc_hour = p; }
break;
case 17:
-#line 130 "date_parser.rl"
+#line 133 "date_parser.rl"
{ t_rfc_minute = p; }
break;
case 18:
-#line 131 "date_parser.rl"
+#line 134 "date_parser.rl"
{ t_rfc_second = p; }
break;
case 19:
-#line 132 "date_parser.rl"
+#line 135 "date_parser.rl"
{ t_rfc_zone = p; }
break;
case 20:
-#line 134 "date_parser.rl"
+#line 137 "date_parser.rl"
{ rfc_state |= RHRR_RFC_TIME_SET; }
break;
case 21:
-#line 135 "date_parser.rl"
+#line 138 "date_parser.rl"
{
t_rfc_zone_end = p;
rfc_state |= RHRR_RFC_ZONE_SET | RHRR_RFC_ZONE_NUM_SET;
}
break;
case 22:
-#line 139 "date_parser.rl"
+#line 142 "date_parser.rl"
{
t_rfc_zone_end = p;
rfc_state |= RHRR_RFC_ZONE_SET | RHRR_RFC_ZONE_NAME_SET;
}
break;
case 24:
-#line 162 "date_parser.rl"
+#line 165 "date_parser.rl"
{ t_clf_day = p; }
break;
case 25:
-#line 163 "date_parser.rl"
+#line 166 "date_parser.rl"
{ t_clf_month = p; }
break;
case 26:
-#line 164 "date_parser.rl"
+#line 167 "date_parser.rl"
{ t_clf_year = p; }
break;
case 27:
-#line 165 "date_parser.rl"
+#line 168 "date_parser.rl"
{ t_clf_hour = p; }
break;
case 28:
-#line 166 "date_parser.rl"
+#line 169 "date_parser.rl"
{ t_clf_minute = p; }
break;
case 29:
-#line 167 "date_parser.rl"
+#line 170 "date_parser.rl"
{ t_clf_second = p; }
break;
case 30:
-#line 168 "date_parser.rl"
+#line 171 "date_parser.rl"
{ t_clf_zone = p; }
break;
case 31:
-#line 170 "date_parser.rl"
+#line 173 "date_parser.rl"
{ clf_state |= RHRR_CLF_TIME_SET; }
break;
case 32:
-#line 171 "date_parser.rl"
+#line 174 "date_parser.rl"
{
t_clf_zone_end = p;
clf_state |= RHRR_CLF_ZONE_SET;
}
break;
-#line 703 "date_parser.c"
+#line 713 "date_parser.c"
}
}
@@ -721,65 +731,68 @@ VALUE rhrd__ragel_parse(char * p, long len) {
break;
case 9:
#line 101 "date_parser.rl"
- { iso_state |= RHRR_ISO_SEC_FRACTION_SET; }
+ {
+ t_iso_sec_fraction_end = p;
+ iso_state |= RHRR_ISO_SEC_FRACTION_SET;
+ }
break;
case 10:
-#line 102 "date_parser.rl"
+#line 105 "date_parser.rl"
{
t_iso_zone_end = p;
iso_state |= RHRR_ISO_ZONE_SET;
}
break;
case 11:
-#line 106 "date_parser.rl"
+#line 109 "date_parser.rl"
{ parsers |= RHRR_ISO_PARSER; }
break;
case 20:
-#line 134 "date_parser.rl"
+#line 137 "date_parser.rl"
{ rfc_state |= RHRR_RFC_TIME_SET; }
break;
case 21:
-#line 135 "date_parser.rl"
+#line 138 "date_parser.rl"
{
t_rfc_zone_end = p;
rfc_state |= RHRR_RFC_ZONE_SET | RHRR_RFC_ZONE_NUM_SET;
}
break;
case 22:
-#line 139 "date_parser.rl"
+#line 142 "date_parser.rl"
{
t_rfc_zone_end = p;
rfc_state |= RHRR_RFC_ZONE_SET | RHRR_RFC_ZONE_NAME_SET;
}
break;
case 23:
-#line 143 "date_parser.rl"
+#line 146 "date_parser.rl"
{ parsers |= RHRR_RFC_PARSER; }
break;
case 31:
-#line 170 "date_parser.rl"
+#line 173 "date_parser.rl"
{ clf_state |= RHRR_CLF_TIME_SET; }
break;
case 32:
-#line 171 "date_parser.rl"
+#line 174 "date_parser.rl"
{
t_clf_zone_end = p;
clf_state |= RHRR_CLF_ZONE_SET;
}
break;
case 33:
-#line 175 "date_parser.rl"
+#line 178 "date_parser.rl"
{ parsers |= RHRR_CLF_PARSER; }
break;
-#line 775 "date_parser.c"
+#line 788 "date_parser.c"
}
}
}
_out: {}
}
-#line 254 "date_parser.rl"
+#line 258 "date_parser.rl"
switch(parsers) {
case RHRR_ISO_PARSER:
@@ -793,7 +806,7 @@ VALUE rhrd__ragel_parse(char * p, long len) {
second = atol(t_iso_second);
state |= RHRR_HOUR_SET | RHRR_MINUTE_SET | RHRR_SECOND_SET;
if (iso_state & RHRR_ISO_SEC_FRACTION_SET) {
- sec_fraction = rb_cstr_to_dbl(t_iso_sec_fraction, Qfalse);
+ sec_fraction = atoi(t_iso_sec_fraction+1) / pow(10, t_iso_sec_fraction_end - t_iso_sec_fraction - 1);
state |= RHRR_SEC_FRACTION_SET;
}
if (iso_state & RHRR_ISO_ZONE_SET) {
View
10 ext/date_ext/date_parser.rl
@@ -98,7 +98,10 @@ long rhrd__weekday_num(char * str) {
action tag_iso_zone { t_iso_zone = p; }
action set_iso_time { iso_state |= RHRR_ISO_TIME_SET; }
- action set_iso_sec_fraction { iso_state |= RHRR_ISO_SEC_FRACTION_SET; }
+ action set_iso_sec_fraction {
+ t_iso_sec_fraction_end = p;
+ iso_state |= RHRR_ISO_SEC_FRACTION_SET;
+ }
action set_iso_zone {
t_iso_zone_end = p;
iso_state |= RHRR_ISO_ZONE_SET;
@@ -111,7 +114,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_sec_fraction = ('.' . digit{0,6}) >tag_iso_sec_fraction;
+ iso_sec_fraction = ('.' . digit{1,9}) >tag_iso_sec_fraction;
iso_zone = ([+\-] . digit{2} . ':'? . digit{2}?) > tag_iso_zone;
iso_date = (iso_year . [\-/] . iso_month . [\-/] . iso_day);
@@ -219,6 +222,7 @@ VALUE rhrd__ragel_parse(char * p, long len) {
char * t_iso_minute = NULL;
char * t_iso_second = NULL;
char * t_iso_sec_fraction = NULL;
+ char * t_iso_sec_fraction_end = NULL;
char * t_iso_zone = NULL;
char * t_iso_zone_end = NULL;
@@ -264,7 +268,7 @@ VALUE rhrd__ragel_parse(char * p, long len) {
second = atol(t_iso_second);
state |= RHRR_HOUR_SET | RHRR_MINUTE_SET | RHRR_SECOND_SET;
if (iso_state & RHRR_ISO_SEC_FRACTION_SET) {
- sec_fraction = rb_cstr_to_dbl(t_iso_sec_fraction, Qfalse);
+ sec_fraction = atoi(t_iso_sec_fraction+1) / pow(10, t_iso_sec_fraction_end - t_iso_sec_fraction - 1);
state |= RHRR_SEC_FRACTION_SET;
}
if (iso_state & RHRR_ISO_ZONE_SET) {

0 comments on commit 31a0c3d

Please sign in to comment.
Something went wrong with that request. Please try again.