#line 1 "./tasks/../ragel/i18n/cs.c.rl" #include #include #if defined(_WIN32) #include #endif #ifdef HAVE_RUBY_RE_H #include #else #include #endif #ifdef HAVE_RUBY_ENCODING_H #include #define ENCODED_STR_NEW(ptr, len) \ rb_enc_str_new(ptr, len, rb_utf8_encoding()); #else #define ENCODED_STR_NEW(ptr, len) \ rb_str_new(ptr, len); #endif #ifndef RSTRING_PTR #define RSTRING_PTR(s) (RSTRING(s)->ptr) #endif #ifndef RSTRING_LEN #define RSTRING_LEN(s) (RSTRING(s)->len) #endif #define DATA_GET(FROM, TYPE, NAME) \ Data_Get_Struct(FROM, TYPE, NAME); \ if (NAME == NULL) { \ rb_raise(rb_eArgError, "NULL found for " # NAME " when it shouldn't be."); \ } typedef struct lexer_state { int content_len; int line_number; int current_line; int start_col; size_t mark; size_t keyword_start; size_t keyword_end; size_t next_keyword_start; size_t content_start; size_t content_end; size_t field_len; size_t query_start; size_t last_newline; size_t final_newline; } lexer_state; static VALUE mGherkin; static VALUE mLexer; static VALUE mCLexer; static VALUE cI18nLexer; static VALUE rb_eGherkinLexerError; #define LEN(AT, P) (P - data - lexer->AT) #define MARK(M, P) (lexer->M = (P) - data) #define PTR_TO(P) (data + lexer->P) #define STORE_KW_END_CON(EVENT) \ store_kw_con(listener, # EVENT, \ PTR_TO(keyword_start), LEN(keyword_start, PTR_TO(keyword_end - 1)), \ PTR_TO(content_start), LEN(content_start, PTR_TO(content_end)), \ lexer->current_line); \ if (lexer->content_end != 0) { \ p = PTR_TO(content_end - 1); \ } \ lexer->content_end = 0; #define STORE_ATTR(ATTR) \ store_attr(listener, # ATTR, \ PTR_TO(content_start), LEN(content_start, p), \ lexer->line_number); #line 239 "./tasks/../ragel/i18n/cs.c.rl" /** Data **/ #line 88 "ext/gherkin_lexer_cs/gherkin_lexer_cs.c" static const char _lexer_actions[] = { 0, 1, 0, 1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 9, 1, 10, 1, 11, 1, 14, 1, 15, 1, 16, 1, 17, 1, 18, 1, 19, 1, 20, 1, 23, 2, 1, 16, 2, 12, 13, 2, 15, 0, 2, 15, 2, 2, 15, 14, 2, 15, 17, 2, 16, 4, 2, 16, 5, 2, 16, 6, 2, 16, 7, 2, 16, 8, 2, 16, 14, 2, 18, 19, 2, 21, 20, 2, 21, 22, 3, 3, 12, 13, 3, 9, 12, 13, 3, 10, 12, 13, 3, 11, 12, 13, 3, 12, 13, 16, 3, 15, 0, 9, 3, 15, 12, 13, 3, 21, 22, 0, 3, 21, 22, 2, 3, 21, 22, 14, 4, 1, 12, 13, 16, 4, 15, 0, 12, 13 }; static const short _lexer_key_offsets[] = { 0, 0, 16, 17, 18, 22, 27, 32, 37, 42, 46, 50, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 75, 82, 87, 89, 91, 94, 97, 100, 103, 106, 108, 109, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, 234, 236, 238, 240, 242, 244, 247, 264, 265, 266, 267, 268, 269, 270, 271, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 290, 291, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 316, 318, 320, 322, 324, 326, 328, 330, 332, 334, 336, 338, 340, 342, 344, 346, 348, 350, 352, 354, 356, 358, 360, 362, 364, 366, 368, 370, 372, 374, 376, 378, 380, 382, 384, 386, 388, 390, 392, 394, 396, 398, 400, 402, 404, 406, 408, 410, 412, 414, 416, 418, 420, 422, 424, 426, 428, 430, 432, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 465, 467, 469, 471, 473, 475, 477, 479, 481, 483, 485, 487, 489, 491, 493, 495, 498, 515, 516, 517, 518, 519, 520, 524, 529, 530, 535, 551, 553, 555, 557, 559, 561, 563, 565, 567, 569, 571, 573, 575, 577, 579, 581, 583, 585, 587, 589, 591, 593, 595, 597, 599, 601, 603, 605, 607, 609, 611, 614, 616, 618, 620, 622, 624, 626, 628, 630, 632, 634, 636, 638, 639, 640, 641, 642, 643, 645, 647, 649, 651, 653, 656, 658, 660, 662, 664, 666, 668, 670, 672, 674, 676, 678, 680, 682, 685, 702, 703, 704, 705, 706, 707, 709, 711, 713, 715, 717, 719, 721, 723, 725, 727, 729, 731, 733, 735, 737, 739, 741, 743, 745, 747, 749, 751, 753, 755, 757, 759, 761, 763, 765, 767, 770, 772, 774, 776, 778, 780, 782, 784, 786, 788, 790, 792, 794 }; static const char _lexer_trans_keys[] = { 10, 32, 34, 35, 37, 42, 64, 65, 75, 78, 79, 80, 83, 124, 9, 13, 34, 34, 10, 32, 9, 13, 10, 32, 34, 9, 13, 10, 32, 34, 9, 13, 10, 32, 34, 9, 13, 10, 32, 34, 9, 13, 10, 32, 9, 13, 10, 32, 9, 13, 10, 13, 95, 70, 69, 65, 84, 85, 82, 69, 95, 69, 78, 68, 95, 37, 32, 10, 10, 13, 13, 32, 64, 9, 10, 9, 10, 13, 32, 64, 11, 12, 10, 32, 64, 9, 13, 32, 108, 10, 116, 10, 13, 97, 10, 13, 107, -61, 10, 13, -87, 10, 13, 10, 13, 32, 10, 13, 101, 100, 111, 121, -59, -66, 110, 116, 101, 120, 116, 58, 10, 10, 10, 32, 35, 37, 42, 64, 65, 75, 78, 79, 80, 83, 9, 13, 10, 95, 10, 70, 10, 69, 10, 65, 10, 84, 10, 85, 10, 82, 10, 69, 10, 95, 10, 69, 10, 78, 10, 68, 10, 95, 10, 37, 10, 32, 10, 32, 34, 35, 37, 42, 64, 65, 75, 78, 79, 80, 83, 124, 9, 13, -61, -95, -60, -115, 114, 116, 32, 83, 99, -61, -87, 110, -61, -95, -59, -103, 101, 58, 10, 10, 10, 32, 35, 37, 42, 64, 65, 75, 80, 83, 9, 13, 10, 95, 10, 70, 10, 69, 10, 65, 10, 84, 10, 85, 10, 82, 10, 69, 10, 95, 10, 69, 10, 78, 10, 68, 10, 95, 10, 37, 10, 32, 10, 32, 108, 10, 32, 34, 35, 37, 42, 64, 65, 75, 78, 79, 80, 83, 116, 124, 9, 13, 115, 110, 111, 118, 97, 32, 115, -59, 97, 111, -103, -61, -83, 107, 108, 97, 100, 121, 58, 10, 10, 10, 32, 124, 9, 13, 107, -59, 107, 122, -66, 97, 100, 97, 118, 101, 107, 58, 10, 10, 10, 32, 35, 37, 64, 75, 78, 79, 80, 83, 9, 13, 10, 95, 10, 70, 10, 69, 10, 65, 10, 84, 10, 85, 10, 82, 10, 69, 10, 95, 10, 69, 10, 78, 10, 68, 10, 95, 10, 37, 10, 111, 10, 110, 10, 116, 10, 101, 10, 120, 10, 116, 10, 58, -61, 10, -95, 10, -60, 10, -115, 10, 10, 114, 10, 116, 10, 32, 10, 83, 10, 99, -61, 10, -87, 10, 10, 110, -61, 10, -95, 10, -59, 10, -103, 10, 10, 101, 10, 115, 10, 110, 10, 111, 10, 118, 10, 97, 10, 32, 10, 115, 10, 111, 10, 122, 10, 97, 10, 100, -61, 10, -83, 10, 10, 99, -61, 10, -87, 10, 10, 110, -61, 10, -95, 10, -59, 10, -103, 10, 117, 100, 97, 100, -61, -83, 99, -61, -87, 110, -61, -95, -59, -103, 58, 10, 10, 10, 32, 35, 37, 42, 64, 65, 75, 78, 79, 80, 83, 9, 13, 10, 95, 10, 70, 10, 69, 10, 65, 10, 84, 10, 85, 10, 82, 10, 69, 10, 95, 10, 69, 10, 78, 10, 68, 10, 95, 10, 37, 10, 32, 10, 32, 108, 10, 32, 34, 35, 37, 42, 64, 65, 75, 78, 79, 80, 83, 116, 124, 9, 13, 97, 107, -61, -87, 32, 32, 124, 9, 13, 10, 32, 124, 9, 13, 124, 10, 32, 124, 9, 13, 10, 32, 34, 35, 37, 42, 64, 65, 75, 78, 79, 80, 83, 124, 9, 13, 10, 101, 10, 100, 10, 121, -59, 10, -66, 10, -61, 10, -95, 10, -60, 10, -115, 10, 10, 114, 10, 116, 10, 32, 10, 83, 10, 99, -61, 10, -87, 10, 10, 110, -61, 10, -95, 10, -59, 10, -103, 10, 10, 101, 10, 58, 10, 115, 10, 110, 10, 111, 10, 118, 10, 97, 10, 32, 10, 115, 10, 97, 111, 10, 107, 10, 107, 10, 117, 10, 100, 10, 99, -61, 10, -87, 10, 10, 110, -61, 10, -95, 10, -59, 10, -103, 10, 97, 107, -61, -87, 32, 10, 101, 10, 100, 10, 121, -59, 10, -66, 10, 10, 97, 111, 10, 107, 10, 107, 10, 117, 10, 100, 10, 99, -61, 10, -87, 10, 10, 110, -61, 10, -95, 10, -59, 10, -103, 10, 10, 58, 10, 32, 108, 10, 32, 34, 35, 37, 42, 64, 65, 75, 78, 79, 80, 83, 116, 124, 9, 13, 97, 107, -61, -87, 32, 10, 101, 10, 100, 10, 121, -59, 10, -66, 10, -61, 10, -95, 10, -60, 10, -115, 10, 10, 114, 10, 116, 10, 32, 10, 83, 10, 99, -61, 10, -87, 10, 10, 110, -61, 10, -95, 10, -59, 10, -103, 10, 10, 101, 10, 58, 10, 115, 10, 110, 10, 111, 10, 118, 10, 97, 10, 32, 10, 115, 10, 97, 111, 10, 107, 10, 107, 10, 117, 10, 100, 10, 99, -61, 10, -87, 10, 10, 110, -61, 10, -95, 10, -59, 10, -103, 10, 0 }; static const char _lexer_single_lengths[] = { 0, 14, 1, 1, 2, 3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 5, 3, 2, 2, 3, 3, 3, 3, 3, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 14, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 15, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 15, 1, 1, 1, 1, 1, 2, 3, 1, 3, 14, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 15, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0 }; static const char _lexer_range_lengths[] = { 0, 1, 0, 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, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 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, 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, 0, 0, 0, 0, 0, 0, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static const short _lexer_index_offsets[] = { 0, 0, 16, 18, 20, 24, 29, 34, 39, 44, 48, 52, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 90, 95, 102, 107, 110, 113, 117, 121, 125, 129, 133, 136, 138, 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, 161, 163, 177, 180, 183, 186, 189, 192, 195, 198, 201, 204, 207, 210, 213, 216, 219, 222, 238, 240, 242, 244, 246, 248, 250, 252, 254, 256, 258, 260, 262, 264, 266, 268, 270, 272, 274, 276, 278, 290, 293, 296, 299, 302, 305, 308, 311, 314, 317, 320, 323, 326, 329, 332, 335, 339, 356, 358, 360, 362, 364, 366, 368, 370, 374, 376, 378, 380, 382, 384, 386, 388, 390, 392, 394, 396, 401, 403, 407, 409, 411, 413, 415, 417, 419, 421, 423, 425, 427, 439, 442, 445, 448, 451, 454, 457, 460, 463, 466, 469, 472, 475, 478, 481, 484, 487, 490, 493, 496, 499, 502, 505, 508, 511, 514, 517, 520, 523, 526, 529, 532, 535, 538, 541, 544, 547, 550, 553, 556, 559, 562, 565, 568, 571, 574, 577, 580, 583, 586, 589, 592, 595, 598, 601, 604, 607, 610, 613, 616, 618, 620, 622, 624, 626, 628, 630, 632, 634, 636, 638, 640, 642, 644, 646, 648, 650, 664, 667, 670, 673, 676, 679, 682, 685, 688, 691, 694, 697, 700, 703, 706, 709, 713, 730, 732, 734, 736, 738, 740, 744, 749, 751, 756, 772, 775, 778, 781, 784, 787, 790, 793, 796, 799, 802, 805, 808, 811, 814, 817, 820, 823, 826, 829, 832, 835, 838, 841, 844, 847, 850, 853, 856, 859, 862, 866, 869, 872, 875, 878, 881, 884, 887, 890, 893, 896, 899, 902, 904, 906, 908, 910, 912, 915, 918, 921, 924, 927, 931, 934, 937, 940, 943, 946, 949, 952, 955, 958, 961, 964, 967, 970, 974, 991, 993, 995, 997, 999, 1001, 1004, 1007, 1010, 1013, 1016, 1019, 1022, 1025, 1028, 1031, 1034, 1037, 1040, 1043, 1046, 1049, 1052, 1055, 1058, 1061, 1064, 1067, 1070, 1073, 1076, 1079, 1082, 1085, 1088, 1091, 1095, 1098, 1101, 1104, 1107, 1110, 1113, 1116, 1119, 1122, 1125, 1128, 1131 }; static const short _lexer_trans_targs[] = { 1, 1, 2, 11, 12, 26, 29, 32, 41, 70, 108, 115, 206, 240, 1, 0, 3, 0, 4, 0, 5, 4, 4, 0, 6, 6, 7, 6, 6, 6, 6, 7, 6, 6, 6, 6, 8, 6, 6, 6, 6, 9, 6, 6, 1, 10, 10, 0, 1, 10, 10, 0, 1, 11, 11, 13, 0, 14, 0, 15, 0, 16, 0, 17, 0, 18, 0, 19, 0, 20, 0, 21, 0, 22, 0, 23, 0, 24, 0, 25, 0, 362, 0, 27, 0, 0, 28, 1, 28, 28, 0, 0, 0, 0, 30, 31, 1, 31, 31, 29, 30, 30, 1, 31, 29, 31, 0, 33, 40, 0, 0, 34, 28, 1, 28, 35, 28, 1, 28, 36, 28, 37, 1, 28, 28, 38, 1, 28, 28, 1, 28, 39, 28, 1, 28, 28, 26, 0, 42, 45, 0, 43, 0, 44, 0, 26, 0, 46, 0, 47, 0, 48, 0, 49, 0, 50, 0, 51, 0, 53, 52, 53, 52, 53, 53, 1, 54, 68, 1, 312, 320, 324, 342, 349, 354, 53, 52, 53, 55, 52, 53, 56, 52, 53, 57, 52, 53, 58, 52, 53, 59, 52, 53, 60, 52, 53, 61, 52, 53, 62, 52, 53, 63, 52, 53, 64, 52, 53, 65, 52, 53, 66, 52, 53, 67, 52, 53, 1, 52, 53, 69, 52, 1, 1, 2, 11, 12, 26, 29, 32, 41, 70, 108, 115, 206, 240, 1, 0, 71, 0, 72, 0, 73, 0, 74, 0, 75, 0, 76, 0, 77, 0, 78, 0, 79, 0, 80, 0, 81, 0, 82, 0, 83, 0, 84, 0, 85, 0, 86, 0, 87, 0, 88, 0, 90, 89, 90, 89, 90, 90, 1, 91, 105, 1, 106, 294, 298, 303, 90, 89, 90, 92, 89, 90, 93, 89, 90, 94, 89, 90, 95, 89, 90, 96, 89, 90, 97, 89, 90, 98, 89, 90, 99, 89, 90, 100, 89, 90, 101, 89, 90, 102, 89, 90, 103, 89, 90, 104, 89, 90, 1, 89, 90, 69, 89, 90, 107, 293, 89, 1, 1, 2, 11, 12, 26, 29, 32, 41, 70, 108, 115, 206, 288, 240, 1, 0, 109, 0, 110, 0, 111, 0, 112, 0, 113, 0, 114, 0, 78, 0, 116, 128, 129, 0, 117, 0, 118, 0, 119, 0, 120, 0, 121, 0, 122, 0, 123, 0, 124, 0, 125, 0, 127, 126, 127, 126, 127, 127, 1, 127, 126, 26, 0, 130, 200, 202, 0, 131, 0, 132, 0, 133, 0, 134, 0, 135, 0, 136, 0, 137, 0, 138, 0, 140, 139, 140, 139, 140, 140, 1, 141, 1, 155, 162, 179, 186, 192, 140, 139, 140, 142, 139, 140, 143, 139, 140, 144, 139, 140, 145, 139, 140, 146, 139, 140, 147, 139, 140, 148, 139, 140, 149, 139, 140, 150, 139, 140, 151, 139, 140, 152, 139, 140, 153, 139, 140, 154, 139, 140, 1, 139, 140, 156, 139, 140, 157, 139, 140, 158, 139, 140, 159, 139, 140, 160, 139, 140, 161, 139, 140, 69, 139, 163, 140, 139, 164, 140, 139, 165, 140, 139, 166, 140, 139, 140, 167, 139, 140, 168, 139, 140, 169, 139, 140, 170, 139, 140, 171, 139, 172, 140, 139, 173, 140, 139, 140, 174, 139, 175, 140, 139, 176, 140, 139, 177, 140, 139, 178, 140, 139, 140, 161, 139, 140, 180, 139, 140, 181, 139, 140, 182, 139, 140, 183, 139, 140, 184, 139, 140, 185, 139, 140, 170, 139, 140, 187, 139, 140, 188, 139, 140, 189, 139, 140, 190, 139, 191, 140, 139, 161, 140, 139, 140, 193, 139, 194, 140, 139, 195, 140, 139, 140, 196, 139, 197, 140, 139, 198, 140, 139, 199, 140, 139, 161, 140, 139, 201, 0, 26, 0, 203, 0, 204, 0, 205, 0, 50, 0, 207, 0, 208, 0, 209, 0, 210, 0, 211, 0, 212, 0, 213, 0, 214, 0, 215, 0, 217, 216, 217, 216, 217, 217, 1, 218, 232, 1, 233, 246, 250, 268, 275, 280, 217, 216, 217, 219, 216, 217, 220, 216, 217, 221, 216, 217, 222, 216, 217, 223, 216, 217, 224, 216, 217, 225, 216, 217, 226, 216, 217, 227, 216, 217, 228, 216, 217, 229, 216, 217, 230, 216, 217, 231, 216, 217, 1, 216, 217, 69, 216, 217, 234, 245, 216, 1, 1, 2, 11, 12, 26, 29, 32, 41, 70, 108, 115, 206, 235, 240, 1, 0, 236, 0, 237, 0, 238, 0, 239, 0, 69, 0, 240, 241, 240, 0, 244, 243, 241, 243, 242, 241, 242, 244, 243, 241, 243, 242, 244, 244, 2, 11, 12, 26, 29, 32, 41, 70, 108, 115, 206, 241, 244, 0, 217, 232, 216, 217, 247, 216, 217, 248, 216, 249, 217, 216, 232, 217, 216, 251, 217, 216, 252, 217, 216, 253, 217, 216, 254, 217, 216, 217, 255, 216, 217, 256, 216, 217, 257, 216, 217, 258, 216, 217, 259, 216, 260, 217, 216, 261, 217, 216, 217, 262, 216, 263, 217, 216, 264, 217, 216, 265, 217, 216, 266, 217, 216, 217, 267, 216, 217, 69, 216, 217, 269, 216, 217, 270, 216, 217, 271, 216, 217, 272, 216, 217, 273, 216, 217, 274, 216, 217, 258, 216, 217, 276, 277, 216, 217, 232, 216, 217, 278, 216, 217, 279, 216, 217, 232, 216, 217, 281, 216, 282, 217, 216, 283, 217, 216, 217, 284, 216, 285, 217, 216, 286, 217, 216, 287, 217, 216, 267, 217, 216, 289, 0, 290, 0, 291, 0, 292, 0, 69, 0, 90, 105, 89, 90, 295, 89, 90, 296, 89, 297, 90, 89, 105, 90, 89, 90, 299, 300, 89, 90, 105, 89, 90, 301, 89, 90, 302, 89, 90, 105, 89, 90, 304, 89, 305, 90, 89, 306, 90, 89, 90, 307, 89, 308, 90, 89, 309, 90, 89, 310, 90, 89, 311, 90, 89, 90, 69, 89, 53, 313, 319, 52, 1, 1, 2, 11, 12, 26, 29, 32, 41, 70, 108, 115, 206, 314, 240, 1, 0, 315, 0, 316, 0, 317, 0, 318, 0, 69, 0, 53, 68, 52, 53, 321, 52, 53, 322, 52, 323, 53, 52, 68, 53, 52, 325, 53, 52, 326, 53, 52, 327, 53, 52, 328, 53, 52, 53, 329, 52, 53, 330, 52, 53, 331, 52, 53, 332, 52, 53, 333, 52, 334, 53, 52, 335, 53, 52, 53, 336, 52, 337, 53, 52, 338, 53, 52, 339, 53, 52, 340, 53, 52, 53, 341, 52, 53, 69, 52, 53, 343, 52, 53, 344, 52, 53, 345, 52, 53, 346, 52, 53, 347, 52, 53, 348, 52, 53, 332, 52, 53, 350, 351, 52, 53, 68, 52, 53, 352, 52, 53, 353, 52, 53, 68, 52, 53, 355, 52, 356, 53, 52, 357, 53, 52, 53, 358, 52, 359, 53, 52, 360, 53, 52, 361, 53, 52, 341, 53, 52, 0, 0 }; static const unsigned char _lexer_trans_actions[] = { 42, 0, 5, 1, 0, 23, 0, 23, 23, 23, 23, 23, 23, 29, 0, 37, 0, 37, 0, 37, 42, 0, 0, 37, 124, 39, 39, 39, 3, 100, 27, 27, 27, 0, 100, 27, 27, 27, 0, 100, 27, 0, 27, 0, 84, 7, 7, 37, 42, 0, 0, 37, 92, 19, 0, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 37, 45, 88, 17, 0, 37, 37, 37, 37, 1, 21, 96, 21, 21, 21, 21, 0, 42, 0, 0, 0, 37, 0, 0, 37, 37, 45, 45, 88, 17, 0, 0, 88, 17, 0, 0, 0, 88, 17, 0, 0, 88, 17, 0, 88, 17, 0, 0, 88, 104, 45, 0, 37, 0, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 129, 45, 42, 0, 42, 0, 60, 27, 72, 60, 72, 72, 72, 72, 72, 72, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 11, 0, 42, 11, 0, 108, 25, 48, 45, 25, 51, 25, 51, 51, 51, 51, 51, 51, 54, 25, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 129, 45, 42, 0, 42, 0, 66, 27, 72, 66, 72, 72, 72, 72, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 15, 0, 42, 15, 0, 42, 15, 0, 0, 108, 25, 48, 45, 25, 51, 25, 51, 51, 51, 51, 51, 51, 0, 54, 25, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 0, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 129, 45, 42, 0, 42, 0, 69, 0, 0, 0, 37, 0, 0, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 129, 45, 42, 0, 42, 0, 57, 27, 57, 72, 72, 72, 72, 72, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 9, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 9, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 0, 42, 0, 0, 42, 0, 42, 0, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 0, 42, 0, 0, 42, 0, 42, 0, 0, 0, 42, 0, 0, 42, 0, 42, 0, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 129, 45, 42, 0, 42, 0, 63, 27, 72, 63, 72, 72, 72, 72, 72, 72, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 13, 0, 42, 13, 0, 42, 13, 0, 0, 108, 25, 48, 45, 25, 51, 25, 51, 51, 51, 51, 51, 51, 0, 54, 25, 37, 0, 37, 0, 37, 0, 37, 0, 37, 13, 37, 0, 35, 0, 37, 42, 31, 75, 31, 31, 33, 0, 42, 0, 33, 0, 0, 42, 0, 116, 112, 81, 120, 81, 120, 120, 120, 120, 120, 120, 78, 0, 37, 42, 0, 0, 42, 0, 0, 42, 0, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 0, 42, 0, 0, 42, 0, 42, 0, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 42, 0, 0, 42, 13, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 0, 42, 0, 0, 42, 0, 42, 0, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 37, 0, 37, 0, 37, 0, 37, 15, 37, 42, 0, 0, 42, 0, 0, 42, 0, 0, 0, 42, 0, 0, 42, 0, 42, 0, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 0, 42, 0, 0, 42, 0, 42, 0, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 42, 15, 0, 42, 11, 0, 0, 108, 25, 48, 45, 25, 51, 25, 51, 51, 51, 51, 51, 51, 0, 54, 25, 37, 0, 37, 0, 37, 0, 37, 0, 37, 11, 37, 42, 0, 0, 42, 0, 0, 42, 0, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 0, 42, 0, 0, 42, 0, 42, 0, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 42, 0, 0, 42, 11, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 0, 42, 0, 0, 42, 0, 42, 0, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 42, 0, 0, 0 }; static const unsigned char _lexer_eof_actions[] = { 0, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37 }; static const int lexer_start = 1; static const int lexer_first_final = 362; static const int lexer_error = 0; static const int lexer_en_main = 1; #line 243 "./tasks/../ragel/i18n/cs.c.rl" static VALUE strip_i(VALUE str, VALUE ary) { rb_funcall(str, rb_intern("strip!"), 0); rb_ary_push(ary, str); return Qnil; } static VALUE multiline_strip(VALUE text) { VALUE map = rb_ary_new(); VALUE split = rb_str_split(text, "\n"); rb_iterate(rb_each, split, strip_i, map); return rb_ary_join(split, rb_str_new2("\n")); } static void store_kw_con(VALUE listener, const char * event_name, const char * keyword_at, size_t keyword_length, const char * at, size_t length, int current_line) { VALUE con = Qnil, kw = Qnil; kw = ENCODED_STR_NEW(keyword_at, keyword_length); con = ENCODED_STR_NEW(at, length); con = multiline_strip(con); rb_funcall(con, rb_intern("strip!"), 0); rb_funcall(kw, rb_intern("strip!"), 0); rb_funcall(listener, rb_intern(event_name), 3, kw, con, INT2FIX(current_line)); } static void store_attr(VALUE listener, const char * attr_type, const char * at, size_t length, int line) { VALUE val = ENCODED_STR_NEW(at, length); rb_funcall(listener, rb_intern(attr_type), 2, val, INT2FIX(line)); } static void store_pystring_content(VALUE listener, int start_col, const char *at, size_t length, int current_line) { VALUE con = ENCODED_STR_NEW(at, length); // Gherkin will crash gracefully if the string representation of start_col pushes the pattern past 32 characters char pat[32]; snprintf(pat, 32, "^ {0,%d}", start_col); VALUE re = rb_reg_regcomp(rb_str_new2(pat)); rb_funcall(con, rb_intern("gsub!"), 2, re, rb_str_new2("")); rb_funcall(listener, rb_intern("py_string"), 2, con, INT2FIX(current_line)); } static void raise_lexer_error(VALUE listener, const char * at, int line) { rb_raise(rb_eGherkinLexerError, "Lexing error on line %d: '%s'.", line, at); } static void lexer_init(lexer_state *lexer) { lexer->content_start = 0; lexer->content_end = 0; lexer->content_len = 0; lexer->mark = 0; lexer->field_len = 0; lexer->keyword_start = 0; lexer->keyword_end = 0; lexer->next_keyword_start = 0; lexer->line_number = 1; lexer->last_newline = 0; lexer->final_newline = 0; lexer->start_col = 0; } static VALUE CLexer_alloc(VALUE klass) { VALUE obj; lexer_state *lxr = ALLOC(lexer_state); lexer_init(lxr); obj = Data_Wrap_Struct(klass, NULL, -1, lxr); return obj; } static VALUE CLexer_init(VALUE self, VALUE listener) { rb_iv_set(self, "@listener", listener); lexer_state *lxr = NULL; DATA_GET(self, lexer_state, lxr); lexer_init(lxr); return self; } static VALUE CLexer_scan(VALUE self, VALUE input) { lexer_state *lexer = NULL; DATA_GET(self, lexer_state, lexer); VALUE input_copy = rb_str_dup(input); rb_str_append(input_copy, rb_str_new2("\n%_FEATURE_END_%")); char *data = RSTRING_PTR(input_copy); long len = RSTRING_LEN(input_copy); if (len == 0) { rb_raise(rb_eGherkinLexerError, "No content to lex."); } else { const char *p, *pe, *eof; int cs = 0; VALUE listener = rb_iv_get(self, "@listener"); VALUE rows = rb_ary_new(); VALUE current_row = rb_ary_new(); p = data; pe = data + len; eof = pe; assert(*pe == '\0' && "pointer does not end on NULL"); assert(pe - p == len && "pointers aren't same distance"); #line 886 "ext/gherkin_lexer_cs/gherkin_lexer_cs.c" { cs = lexer_start; } #line 374 "./tasks/../ragel/i18n/cs.c.rl" #line 893 "ext/gherkin_lexer_cs/gherkin_lexer_cs.c" { int _klen; unsigned int _trans; const char *_acts; unsigned int _nacts; const char *_keys; if ( p == pe ) goto _test_eof; if ( cs == 0 ) goto _out; _resume: _keys = _lexer_trans_keys + _lexer_key_offsets[cs]; _trans = _lexer_index_offsets[cs]; _klen = _lexer_single_lengths[cs]; if ( _klen > 0 ) { const char *_lower = _keys; const char *_mid; const char *_upper = _keys + _klen - 1; while (1) { if ( _upper < _lower ) break; _mid = _lower + ((_upper-_lower) >> 1); if ( (*p) < *_mid ) _upper = _mid - 1; else if ( (*p) > *_mid ) _lower = _mid + 1; else { _trans += (_mid - _keys); goto _match; } } _keys += _klen; _trans += _klen; } _klen = _lexer_range_lengths[cs]; if ( _klen > 0 ) { const char *_lower = _keys; const char *_mid; const char *_upper = _keys + (_klen<<1) - 2; while (1) { if ( _upper < _lower ) break; _mid = _lower + (((_upper-_lower) >> 1) & ~1); if ( (*p) < _mid[0] ) _upper = _mid - 2; else if ( (*p) > _mid[1] ) _lower = _mid + 2; else { _trans += ((_mid - _keys)>>1); goto _match; } } _trans += _klen; } _match: cs = _lexer_trans_targs[_trans]; if ( _lexer_trans_actions[_trans] == 0 ) goto _again; _acts = _lexer_actions + _lexer_trans_actions[_trans]; _nacts = (unsigned int) *_acts++; while ( _nacts-- > 0 ) { switch ( *_acts++ ) { case 0: #line 82 "./tasks/../ragel/i18n/cs.c.rl" { MARK(content_start, p); lexer->current_line = lexer->line_number; } break; case 1: #line 87 "./tasks/../ragel/i18n/cs.c.rl" { MARK(content_start, p); } break; case 2: #line 91 "./tasks/../ragel/i18n/cs.c.rl" { lexer->current_line = lexer->line_number; lexer->start_col = p - data - lexer->last_newline; } break; case 3: #line 96 "./tasks/../ragel/i18n/cs.c.rl" { int len = LEN(content_start, PTR_TO(final_newline)); if (len < 0) len = 0; store_pystring_content(listener, lexer->start_col, PTR_TO(content_start), len, lexer->current_line); } break; case 4: #line 104 "./tasks/../ragel/i18n/cs.c.rl" { STORE_KW_END_CON(feature) } break; case 5: #line 108 "./tasks/../ragel/i18n/cs.c.rl" { STORE_KW_END_CON(background) } break; case 6: #line 112 "./tasks/../ragel/i18n/cs.c.rl" { STORE_KW_END_CON(scenario) } break; case 7: #line 116 "./tasks/../ragel/i18n/cs.c.rl" { STORE_KW_END_CON(scenario_outline) } break; case 8: #line 120 "./tasks/../ragel/i18n/cs.c.rl" { STORE_KW_END_CON(examples) } break; case 9: #line 124 "./tasks/../ragel/i18n/cs.c.rl" { store_kw_con(listener, "step", PTR_TO(keyword_start), LEN(keyword_start, PTR_TO(keyword_end)), PTR_TO(content_start), LEN(content_start, p), lexer->current_line); } break; case 10: #line 131 "./tasks/../ragel/i18n/cs.c.rl" { STORE_ATTR(comment) lexer->mark = 0; } break; case 11: #line 136 "./tasks/../ragel/i18n/cs.c.rl" { STORE_ATTR(tag) lexer->mark = 0; } break; case 12: #line 141 "./tasks/../ragel/i18n/cs.c.rl" { lexer->line_number += 1; MARK(final_newline, p); } break; case 13: #line 146 "./tasks/../ragel/i18n/cs.c.rl" { MARK(last_newline, p + 1); } break; case 14: #line 150 "./tasks/../ragel/i18n/cs.c.rl" { if (lexer->mark == 0) { MARK(mark, p); } } break; case 15: #line 156 "./tasks/../ragel/i18n/cs.c.rl" { MARK(keyword_end, p); MARK(keyword_start, PTR_TO(mark)); MARK(content_start, p + 1); lexer->mark = 0; } break; case 16: #line 163 "./tasks/../ragel/i18n/cs.c.rl" { MARK(content_end, p); } break; case 17: #line 167 "./tasks/../ragel/i18n/cs.c.rl" { p = p - 1; lexer->current_line = lexer->line_number; rb_ary_clear(rows); rb_ary_clear(current_row); } break; case 18: #line 174 "./tasks/../ragel/i18n/cs.c.rl" { MARK(content_start, p); } break; case 19: #line 178 "./tasks/../ragel/i18n/cs.c.rl" { VALUE con = Qnil; con = ENCODED_STR_NEW(PTR_TO(content_start), LEN(content_start, p)); rb_funcall(con, rb_intern("strip!"), 0); rb_ary_push(current_row, con); } break; case 20: #line 186 "./tasks/../ragel/i18n/cs.c.rl" { current_row = rb_ary_new(); } break; case 21: #line 190 "./tasks/../ragel/i18n/cs.c.rl" { rb_ary_push(rows, current_row); } break; case 22: #line 194 "./tasks/../ragel/i18n/cs.c.rl" { rb_funcall(listener, rb_intern("table"), 2, rows, INT2FIX(lexer->current_line)); } break; case 23: #line 198 "./tasks/../ragel/i18n/cs.c.rl" { if (cs < lexer_first_final) { if (raise_lexer_error != NULL) { int count = 0; int newstr_count = 0; size_t len; const char *buff; if (lexer->last_newline != 0) { len = LEN(last_newline, eof); buff = PTR_TO(last_newline); } else { len = strlen(data); buff = data; } char newstr[len]; for (count = 0; count < len; count++) { if(buff[count] == 10) { newstr[newstr_count] = '\0'; // terminate new string at first newline found break; } else { if (buff[count] == '%') { newstr[newstr_count++] = buff[count]; newstr[newstr_count] = buff[count]; } else { newstr[newstr_count] = buff[count]; } } newstr_count++; } int line = lexer->line_number; lexer_init(lexer); // Re-initialize so we can scan again with the same lexer raise_lexer_error(listener, newstr, line); } } } break; #line 1169 "ext/gherkin_lexer_cs/gherkin_lexer_cs.c" } } _again: if ( cs == 0 ) goto _out; if ( ++p != pe ) goto _resume; _test_eof: {} if ( p == eof ) { const char *__acts = _lexer_actions + _lexer_eof_actions[cs]; unsigned int __nacts = (unsigned int) *__acts++; while ( __nacts-- > 0 ) { switch ( *__acts++ ) { case 23: #line 198 "./tasks/../ragel/i18n/cs.c.rl" { if (cs < lexer_first_final) { if (raise_lexer_error != NULL) { int count = 0; int newstr_count = 0; size_t len; const char *buff; if (lexer->last_newline != 0) { len = LEN(last_newline, eof); buff = PTR_TO(last_newline); } else { len = strlen(data); buff = data; } char newstr[len]; for (count = 0; count < len; count++) { if(buff[count] == 10) { newstr[newstr_count] = '\0'; // terminate new string at first newline found break; } else { if (buff[count] == '%') { newstr[newstr_count++] = buff[count]; newstr[newstr_count] = buff[count]; } else { newstr[newstr_count] = buff[count]; } } newstr_count++; } int line = lexer->line_number; lexer_init(lexer); // Re-initialize so we can scan again with the same lexer raise_lexer_error(listener, newstr, line); } } } break; #line 1226 "ext/gherkin_lexer_cs/gherkin_lexer_cs.c" } } } _out: {} } #line 375 "./tasks/../ragel/i18n/cs.c.rl" assert(p <= pe && "data overflow after parsing execute"); assert(lexer->content_start <= len && "content starts after data end"); assert(lexer->mark < len && "mark is after data end"); assert(lexer->field_len <= len && "field has length longer than the whole data"); // Reset lexer by re-initializing the whole thing lexer_init(lexer); if (cs == lexer_error) { rb_raise(rb_eGherkinLexerError, "Invalid format, lexing fails."); } else { return Qtrue; } } } void Init_gherkin_lexer_cs() { mGherkin = rb_define_module("Gherkin"); mLexer = rb_const_get(mGherkin, rb_intern("Lexer")); rb_eGherkinLexerError = rb_const_get(mLexer, rb_intern("LexingError")); mCLexer = rb_define_module_under(mGherkin, "CLexer"); cI18nLexer = rb_define_class_under(mCLexer, "Cs", rb_cObject); rb_define_alloc_func(cI18nLexer, CLexer_alloc); rb_define_method(cI18nLexer, "initialize", CLexer_init, 1); rb_define_method(cI18nLexer, "scan", CLexer_scan, 1); }