#line 1 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.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 #define LF_FLAG 0 #define CRLF_FLAG 1 #define LF "\n" #define CRLF "\r\n" #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; int eol; 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 query_start; size_t last_newline; size_t final_newline; } lexer_state; static VALUE mGherkin; static VALUE mCLexer; static VALUE cI18nLexer; static VALUE rb_eGherkinLexingError; #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, lexer->eol); \ 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 235 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.c.rl" /** Data **/ #line 92 "ext/gherkin_lexer_bg/gherkin_lexer_bg.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, 21, 2, 1, 16, 2, 11, 0, 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, 20, 0, 2, 20, 2, 2, 20, 14, 2, 20, 17, 3, 3, 12, 13, 3, 9, 12, 13, 3, 10, 12, 13, 3, 11, 12, 13, 3, 12, 13, 16, 3, 15, 12, 13, 4, 1, 12, 13, 16, 4, 15, 0, 12, 13 }; static const short _lexer_key_offsets[] = { 0, 0, 11, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 76, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 117, 118, 119, 123, 128, 133, 138, 143, 147, 151, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 172, 179, 184, 188, 193, 194, 199, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, 234, 236, 238, 240, 242, 244, 246, 248, 250, 252, 254, 256, 258, 260, 262, 264, 266, 268, 270, 272, 274, 276, 278, 280, 282, 284, 286, 288, 290, 292, 294, 296, 298, 300, 302, 304, 306, 308, 310, 312, 314, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 374, 381, 383, 385, 387, 389, 391, 393, 395, 397, 399, 401, 403, 405, 407, 409, 411, 413, 415, 417, 419, 421, 423, 425, 427, 429, 431, 433, 435, 437, 439, 441, 443, 445, 447, 449, 451, 453, 455, 457, 459, 461, 463, 465, 467, 469, 471, 473, 475, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 503, 511, 513, 515, 517, 519, 521, 523, 525, 527, 529, 531, 533, 535, 537, 539, 541, 543, 545, 547, 549, 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, 613, 615, 617, 619, 621, 623, 625, 627, 629, 631, 633, 635, 637, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 676, 680, 682, 684, 686, 688, 690, 692, 694, 696, 698, 700, 702, 704, 706, 708, 710, 712, 714, 716, 718, 720, 722, 724, 726, 728, 730, 732, 734, 736, 738, 740, 742, 744, 746, 748, 750, 752, 754, 756, 758, 760, 762, 764, 766, 768, 770, 772, 774, 776, 778, 780, 782, 784, 786, 788, 790, 792, 794, 796, 798, 800, 802, 804, 806, 808, 810 }; static const char _lexer_trans_keys[] = { -48, 10, 32, 34, 35, 37, 42, 64, 124, 9, 13, -108, -104, -102, -99, -97, -96, -95, -94, -92, -48, -80, -48, -76, -48, -75, -48, -67, -48, -66, 32, 10, 10, 13, 10, -48, -66, -48, -77, -48, -80, -47, -126, -47, -128, -48, -75, -72, -48, -76, -48, -72, -47, -127, -47, -126, -48, -66, -47, -128, -48, -72, -47, -113, 58, 10, 10, -48, 10, 32, 35, 37, 42, 64, 9, 13, -108, -104, -102, -99, -96, -95, -94, 10, -48, 10, -80, 10, -48, 10, -76, 10, -48, 10, -75, 10, -48, 10, -67, 10, -48, 10, -66, 10, 10, 32, -48, 10, 32, 34, 35, 37, 42, 64, 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, 13, 32, 64, 9, 10, 9, 10, 13, 32, 64, 11, 12, 10, 32, 64, 9, 13, 32, 124, 9, 13, 10, 32, 124, 9, 13, 124, 10, 32, 124, 9, 13, -48, 10, 32, 34, 35, 37, 42, 64, 124, 9, 13, -48, 10, -66, 10, -48, 10, -77, 10, -48, 10, -80, 10, -47, 10, -126, 10, -48, 10, -80, 10, -48, 10, -68, 10, -48, 10, -70, 10, -48, 10, -80, 10, 10, 32, -48, 10, -67, 10, -48, 10, -80, 10, 10, 32, -47, 10, -127, 10, -47, 10, -122, 10, -48, 10, -75, 10, -48, 10, -67, 10, -48, 10, -80, 10, -47, 10, -128, 10, -48, 10, -72, 10, -48, 10, -71, 10, 10, 58, 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, -48, -68, -48, -75, -47, -128, -48, -72, 58, 10, 10, 10, 32, 124, 9, 13, -48, -80, -48, -68, -48, -70, -48, -80, 32, -48, -67, -48, -80, 32, -47, -127, -47, -122, -48, -75, -48, -67, -48, -80, -47, -128, -48, -72, -48, -71, 58, 10, 10, -48, 10, 32, 35, 37, 42, 64, 9, 13, -108, -104, -102, -99, -95, -94, 10, -48, 10, -80, 10, -48, 10, -76, 10, -48, 10, -75, 10, -48, 10, -67, 10, -48, 10, -66, 10, 10, 32, -48, 10, -66, 10, -48, 10, -77, 10, -48, 10, -80, 10, -47, 10, -126, 10, -47, 10, -122, 10, -48, 10, -75, 10, -48, 10, -67, 10, -48, 10, -80, 10, -47, 10, -128, 10, -48, 10, -72, 10, -48, 10, -71, 10, 10, 58, 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, -47, -122, -48, -75, -48, -67, -48, -80, -47, -128, -48, -72, -48, -71, 58, 10, 10, -48, 10, 32, 35, 37, 42, 64, 9, 13, -108, -104, -102, -99, -96, -95, -94, 10, -48, 10, -80, 10, -48, 10, -76, 10, -48, 10, -75, 10, -48, 10, -67, 10, -48, 10, -66, 10, 10, 32, -48, 10, -66, 10, -48, 10, -77, 10, -48, 10, -80, 10, -47, 10, -126, 10, -48, 10, -80, 10, -48, 10, -68, 10, -48, 10, -70, 10, -48, 10, -80, 10, 10, 32, -48, 10, -67, 10, -48, 10, -80, 10, 10, 32, -47, 10, -127, 10, -47, 10, -122, 10, -48, 10, -75, 10, -48, 10, -67, 10, -48, 10, -80, 10, -47, 10, -128, 10, -48, 10, -72, 10, -48, 10, -71, 10, 10, 58, 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, -47, -125, -48, -67, -48, -70, -47, -122, -48, -72, -48, -66, -48, -67, -48, -80, -48, -69, -48, -67, -48, -66, -47, -127, -47, -126, 58, 10, 10, -48, 10, 32, 35, 37, 64, 9, 13, -97, -96, -95, 10, -47, 10, -128, 10, -48, 10, -75, 10, -48, 10, -76, 10, -48, 10, -72, 10, -47, 10, -127, 10, -47, 10, -126, 10, -48, 10, -66, 10, -47, 10, -128, 10, -48, 10, -72, 10, -47, 10, -113, 10, 10, 58, -48, 10, -80, 10, -48, 10, -68, 10, -48, 10, -70, 10, -48, 10, -80, 10, 10, 32, -48, 10, -67, 10, -48, 10, -80, 10, 10, 32, -47, 10, -127, 10, -47, 10, -122, 10, -48, 10, -75, 10, -48, 10, -67, 10, -48, 10, -80, 10, -47, 10, -128, 10, -48, 10, -72, 10, -48, 10, -71, 10, 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, 0 }; static const char _lexer_single_lengths[] = { 0, 9, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 1, 1, 2, 3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 5, 3, 2, 3, 1, 3, 9, 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, 3, 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, 7, 7, 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, 7, 8, 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, 2, 2, 2, 2, 2, 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, 6, 4, 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, 2, 2, 2, 2, 2, 2, 0 }; static const char _lexer_range_lengths[] = { 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1, 1, 1, 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, 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, 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, 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, 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, 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, 11, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 122, 131, 134, 137, 140, 143, 146, 149, 152, 155, 158, 161, 164, 175, 177, 179, 183, 188, 193, 198, 203, 207, 211, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, 234, 236, 238, 240, 242, 247, 254, 259, 263, 268, 270, 275, 286, 289, 292, 295, 298, 301, 304, 307, 310, 313, 316, 319, 322, 325, 328, 331, 334, 337, 340, 343, 346, 349, 352, 355, 358, 361, 364, 367, 370, 373, 376, 379, 382, 385, 388, 391, 394, 397, 400, 403, 406, 409, 412, 415, 418, 421, 424, 427, 430, 433, 436, 439, 442, 445, 447, 449, 451, 453, 455, 457, 459, 461, 463, 465, 467, 472, 474, 476, 478, 480, 482, 484, 486, 488, 490, 492, 494, 496, 498, 500, 502, 504, 506, 508, 510, 512, 514, 516, 518, 520, 522, 524, 526, 528, 530, 532, 534, 536, 538, 547, 555, 558, 561, 564, 567, 570, 573, 576, 579, 582, 585, 588, 591, 594, 597, 600, 603, 606, 609, 612, 615, 618, 621, 624, 627, 630, 633, 636, 639, 642, 645, 648, 651, 654, 657, 660, 663, 666, 669, 672, 675, 678, 681, 684, 687, 690, 693, 696, 699, 701, 703, 705, 707, 709, 711, 713, 715, 717, 719, 721, 723, 725, 727, 729, 731, 733, 742, 751, 754, 757, 760, 763, 766, 769, 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, 865, 868, 871, 874, 877, 880, 883, 886, 889, 892, 895, 898, 901, 904, 907, 910, 913, 916, 919, 922, 925, 928, 931, 934, 937, 940, 943, 945, 947, 949, 951, 953, 955, 957, 959, 961, 963, 965, 967, 969, 971, 973, 975, 977, 979, 981, 983, 985, 987, 989, 991, 993, 995, 997, 999, 1001, 1009, 1014, 1017, 1020, 1023, 1026, 1029, 1032, 1035, 1038, 1041, 1044, 1047, 1050, 1053, 1056, 1059, 1062, 1065, 1068, 1071, 1074, 1077, 1080, 1083, 1086, 1089, 1092, 1095, 1098, 1101, 1104, 1107, 1110, 1113, 1116, 1119, 1122, 1125, 1128, 1131, 1134, 1137, 1140, 1143, 1146, 1149, 1152, 1155, 1158, 1161, 1164, 1167, 1170, 1173, 1176, 1179, 1182, 1185, 1188, 1191, 1194, 1197, 1200, 1203, 1206, 1209 }; static const short _lexer_trans_targs[] = { 2, 1, 1, 62, 71, 72, 13, 86, 89, 1, 0, 3, 13, 17, 11, 25, 159, 242, 11, 325, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 0, 15, 1, 16, 15, 1, 0, 18, 0, 19, 0, 20, 0, 21, 0, 22, 0, 23, 0, 24, 0, 11, 0, 26, 0, 27, 0, 28, 0, 29, 147, 0, 30, 0, 31, 0, 32, 0, 33, 0, 34, 0, 35, 0, 36, 0, 37, 0, 38, 0, 39, 0, 40, 0, 41, 0, 42, 0, 43, 0, 44, 0, 45, 0, 46, 0, 48, 47, 48, 47, 49, 48, 48, 1, 133, 60, 1, 48, 47, 50, 60, 94, 58, 102, 118, 58, 48, 47, 51, 48, 47, 52, 48, 47, 53, 48, 47, 54, 48, 47, 55, 48, 47, 56, 48, 47, 57, 48, 47, 58, 48, 47, 59, 48, 47, 60, 48, 47, 48, 61, 47, 2, 1, 1, 62, 71, 72, 13, 86, 89, 1, 0, 63, 0, 64, 0, 65, 64, 64, 0, 66, 66, 67, 66, 66, 66, 66, 67, 66, 66, 66, 66, 68, 66, 66, 66, 66, 69, 66, 66, 1, 70, 70, 0, 1, 70, 70, 0, 1, 16, 71, 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, 421, 0, 0, 0, 0, 0, 87, 88, 1, 88, 88, 86, 87, 87, 1, 88, 86, 88, 0, 89, 90, 89, 0, 93, 92, 90, 92, 91, 90, 91, 93, 92, 90, 92, 91, 2, 93, 93, 62, 71, 72, 13, 86, 89, 93, 0, 95, 48, 47, 96, 48, 47, 97, 48, 47, 98, 48, 47, 99, 48, 47, 100, 48, 47, 101, 48, 47, 58, 48, 47, 103, 48, 47, 104, 48, 47, 105, 48, 47, 106, 48, 47, 107, 48, 47, 108, 48, 47, 109, 48, 47, 110, 48, 47, 48, 111, 47, 112, 48, 47, 113, 48, 47, 114, 48, 47, 115, 48, 47, 48, 116, 47, 117, 48, 47, 118, 48, 47, 119, 48, 47, 120, 48, 47, 121, 48, 47, 122, 48, 47, 123, 48, 47, 124, 48, 47, 125, 48, 47, 126, 48, 47, 127, 48, 47, 128, 48, 47, 129, 48, 47, 130, 48, 47, 131, 48, 47, 132, 48, 47, 48, 61, 47, 48, 134, 47, 48, 135, 47, 48, 136, 47, 48, 137, 47, 48, 138, 47, 48, 139, 47, 48, 140, 47, 48, 141, 47, 48, 142, 47, 48, 143, 47, 48, 144, 47, 48, 145, 47, 48, 146, 47, 48, 1, 47, 148, 0, 149, 0, 150, 0, 151, 0, 152, 0, 153, 0, 154, 0, 155, 0, 156, 0, 158, 157, 158, 157, 158, 158, 1, 158, 157, 160, 0, 161, 0, 162, 0, 163, 0, 164, 0, 165, 0, 166, 0, 167, 0, 168, 0, 169, 0, 170, 0, 171, 0, 172, 0, 173, 0, 174, 0, 175, 0, 176, 0, 177, 0, 178, 0, 179, 0, 180, 0, 181, 0, 182, 0, 183, 0, 184, 0, 185, 0, 186, 0, 187, 0, 188, 0, 189, 0, 190, 0, 192, 191, 192, 191, 193, 192, 192, 1, 228, 204, 1, 192, 191, 194, 204, 205, 202, 213, 202, 192, 191, 195, 192, 191, 196, 192, 191, 197, 192, 191, 198, 192, 191, 199, 192, 191, 200, 192, 191, 201, 192, 191, 202, 192, 191, 203, 192, 191, 204, 192, 191, 192, 61, 191, 206, 192, 191, 207, 192, 191, 208, 192, 191, 209, 192, 191, 210, 192, 191, 211, 192, 191, 212, 192, 191, 202, 192, 191, 214, 192, 191, 215, 192, 191, 216, 192, 191, 217, 192, 191, 218, 192, 191, 219, 192, 191, 220, 192, 191, 221, 192, 191, 222, 192, 191, 223, 192, 191, 224, 192, 191, 225, 192, 191, 226, 192, 191, 227, 192, 191, 192, 61, 191, 192, 229, 191, 192, 230, 191, 192, 231, 191, 192, 232, 191, 192, 233, 191, 192, 234, 191, 192, 235, 191, 192, 236, 191, 192, 237, 191, 192, 238, 191, 192, 239, 191, 192, 240, 191, 192, 241, 191, 192, 1, 191, 243, 0, 244, 0, 245, 0, 246, 0, 247, 0, 248, 0, 249, 0, 250, 0, 251, 0, 252, 0, 253, 0, 254, 0, 255, 0, 256, 0, 257, 0, 259, 258, 259, 258, 260, 259, 259, 1, 311, 271, 1, 259, 258, 261, 271, 272, 269, 280, 296, 269, 259, 258, 262, 259, 258, 263, 259, 258, 264, 259, 258, 265, 259, 258, 266, 259, 258, 267, 259, 258, 268, 259, 258, 269, 259, 258, 270, 259, 258, 271, 259, 258, 259, 61, 258, 273, 259, 258, 274, 259, 258, 275, 259, 258, 276, 259, 258, 277, 259, 258, 278, 259, 258, 279, 259, 258, 269, 259, 258, 281, 259, 258, 282, 259, 258, 283, 259, 258, 284, 259, 258, 285, 259, 258, 286, 259, 258, 287, 259, 258, 288, 259, 258, 259, 289, 258, 290, 259, 258, 291, 259, 258, 292, 259, 258, 293, 259, 258, 259, 294, 258, 295, 259, 258, 296, 259, 258, 297, 259, 258, 298, 259, 258, 299, 259, 258, 300, 259, 258, 301, 259, 258, 302, 259, 258, 303, 259, 258, 304, 259, 258, 305, 259, 258, 306, 259, 258, 307, 259, 258, 308, 259, 258, 309, 259, 258, 310, 259, 258, 259, 61, 258, 259, 312, 258, 259, 313, 258, 259, 314, 258, 259, 315, 258, 259, 316, 258, 259, 317, 258, 259, 318, 258, 259, 319, 258, 259, 320, 258, 259, 321, 258, 259, 322, 258, 259, 323, 258, 259, 324, 258, 259, 1, 258, 326, 0, 327, 0, 328, 0, 329, 0, 330, 0, 331, 0, 332, 0, 333, 0, 334, 0, 335, 0, 336, 0, 337, 0, 338, 0, 339, 0, 340, 0, 341, 0, 342, 0, 343, 0, 344, 0, 345, 0, 346, 0, 347, 0, 348, 0, 349, 0, 350, 0, 351, 0, 352, 0, 354, 353, 354, 353, 355, 354, 354, 1, 407, 1, 354, 353, 356, 377, 393, 354, 353, 357, 354, 353, 358, 354, 353, 359, 354, 353, 360, 354, 353, 361, 354, 353, 362, 354, 353, 363, 354, 353, 364, 354, 353, 365, 354, 353, 366, 354, 353, 367, 354, 353, 368, 354, 353, 369, 354, 353, 370, 354, 353, 371, 354, 353, 372, 354, 353, 373, 354, 353, 374, 354, 353, 375, 354, 353, 376, 354, 353, 354, 61, 353, 378, 354, 353, 379, 354, 353, 380, 354, 353, 381, 354, 353, 382, 354, 353, 383, 354, 353, 384, 354, 353, 385, 354, 353, 354, 386, 353, 387, 354, 353, 388, 354, 353, 389, 354, 353, 390, 354, 353, 354, 391, 353, 392, 354, 353, 393, 354, 353, 394, 354, 353, 395, 354, 353, 396, 354, 353, 397, 354, 353, 398, 354, 353, 399, 354, 353, 400, 354, 353, 401, 354, 353, 402, 354, 353, 403, 354, 353, 404, 354, 353, 405, 354, 353, 406, 354, 353, 376, 354, 353, 354, 408, 353, 354, 409, 353, 354, 410, 353, 354, 411, 353, 354, 412, 353, 354, 413, 353, 354, 414, 353, 354, 415, 353, 354, 416, 353, 354, 417, 353, 354, 418, 353, 354, 419, 353, 354, 420, 353, 354, 1, 353, 0, 0 }; static const char _lexer_trans_actions[] = { 23, 45, 0, 5, 1, 0, 23, 1, 29, 0, 37, 0, 0, 0, 0, 0, 0, 0, 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, 37, 48, 97, 17, 0, 45, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 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, 0, 37, 0, 37, 0, 37, 122, 48, 45, 0, 75, 45, 0, 63, 27, 75, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 45, 11, 0, 54, 113, 25, 51, 48, 25, 54, 48, 57, 25, 37, 0, 37, 0, 37, 45, 0, 0, 37, 117, 39, 39, 39, 3, 109, 27, 27, 27, 0, 109, 27, 27, 27, 0, 109, 27, 0, 27, 0, 93, 7, 7, 37, 45, 0, 0, 37, 101, 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, 37, 37, 37, 37, 0, 21, 105, 21, 21, 42, 21, 0, 45, 0, 1, 0, 37, 0, 0, 0, 37, 45, 31, 78, 31, 31, 33, 0, 45, 0, 33, 0, 0, 87, 45, 0, 84, 81, 35, 87, 81, 90, 0, 37, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 45, 0, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 45, 0, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 45, 11, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 11, 0, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 122, 48, 45, 0, 45, 0, 72, 0, 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, 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, 122, 48, 45, 0, 75, 45, 0, 69, 27, 75, 69, 0, 0, 0, 0, 0, 0, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 45, 15, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 45, 15, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 15, 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, 122, 48, 45, 0, 75, 45, 0, 66, 27, 75, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 45, 13, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 45, 0, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 45, 0, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 45, 13, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 13, 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, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 0, 37, 122, 48, 45, 0, 75, 45, 0, 60, 27, 60, 0, 0, 0, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 45, 9, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 45, 0, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 45, 0, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 0, 0, 45, 9, 0, 0, 0 }; static const 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, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 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 = 421; static const int lexer_error = 0; static const int lexer_en_main = 1; #line 239 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.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, int eol) { 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( \ eol == CRLF_FLAG ? CRLF : LF )); } 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, int eol) { VALUE con = Qnil, kw = Qnil; kw = ENCODED_STR_NEW(keyword_at, keyword_length); con = ENCODED_STR_NEW(at, length); con = multiline_strip(con, eol); rb_funcall(con, 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, "^[\t ]{0,%d}", start_col); VALUE re = rb_reg_regcomp(rb_str_new2(pat)); VALUE re2 = rb_reg_regcomp(rb_str_new2("\r\\Z")); VALUE unescape_escaped_quotes = rb_reg_regcomp(rb_str_new2("\\\\\"\\\\\"\\\\\"")); rb_funcall(con, rb_intern("gsub!"), 2, re, rb_str_new2("")); rb_funcall(con, rb_intern("sub!"), 2, re2, rb_str_new2("")); rb_funcall(con, rb_intern("gsub!"), 2, unescape_escaped_quotes, rb_str_new2("\"\"\"")); rb_funcall(listener, rb_intern("py_string"), 2, con, INT2FIX(current_line)); } static void raise_lexer_error(const char * at, int line) { rb_raise(rb_eGherkinLexingError, "Lexing error on line %d: '%s'.", line, at); } static int count_char(char char_to_count, char *str) { int count = 0; int i = 0; while(str[i] != '\0') { if(str[i] == char_to_count) { count++; } i++; } return count; } static void lexer_init(lexer_state *lexer) { lexer->content_start = 0; lexer->content_end = 0; lexer->content_len = 0; lexer->mark = 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; lexer->eol = LF_FLAG; } 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); size_t len = RSTRING_LEN(input_copy); if (count_char('\r', data) > (count_char('\n', data) / 2)) { lexer->eol = CRLF_FLAG; } if (len == 0) { rb_raise(rb_eGherkinLexingError, "No content to lex."); } else { const char *p, *pe, *eof; int cs = 0; VALUE listener = rb_iv_get(self, "@listener"); VALUE current_row = Qnil; p = data; pe = data + len; eof = pe; assert(*pe == '\0' && "pointer does not end on NULL"); #line 969 "ext/gherkin_lexer_bg/gherkin_lexer_bg.c" { cs = lexer_start; } #line 393 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.c.rl" #line 976 "ext/gherkin_lexer_bg/gherkin_lexer_bg.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 86 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.c.rl" { MARK(content_start, p); lexer->current_line = lexer->line_number; } break; case 1: #line 91 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.c.rl" { MARK(content_start, p); } break; case 2: #line 95 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.c.rl" { lexer->current_line = lexer->line_number; lexer->start_col = p - data - lexer->last_newline; } break; case 3: #line 100 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.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 108 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.c.rl" { STORE_KW_END_CON(feature); } break; case 5: #line 112 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.c.rl" { STORE_KW_END_CON(background); } break; case 6: #line 116 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.c.rl" { STORE_KW_END_CON(scenario); } break; case 7: #line 120 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.c.rl" { STORE_KW_END_CON(scenario_outline); } break; case 8: #line 124 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.c.rl" { STORE_KW_END_CON(examples); } break; case 9: #line 128 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.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, lexer->eol); } break; case 10: #line 135 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.c.rl" { STORE_ATTR(comment); lexer->mark = 0; } break; case 11: #line 140 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.c.rl" { STORE_ATTR(tag); lexer->mark = 0; } break; case 12: #line 145 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.c.rl" { lexer->line_number += 1; MARK(final_newline, p); } break; case 13: #line 150 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.c.rl" { MARK(last_newline, p + 1); } break; case 14: #line 154 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.c.rl" { if (lexer->mark == 0) { MARK(mark, p); } } break; case 15: #line 160 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.c.rl" { MARK(keyword_end, p); MARK(keyword_start, PTR_TO(mark)); MARK(content_start, p + 1); lexer->mark = 0; } break; case 16: #line 167 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.c.rl" { MARK(content_end, p); } break; case 17: #line 171 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.c.rl" { p = p - 1; lexer->current_line = lexer->line_number; current_row = rb_ary_new(); } break; case 18: #line 177 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.c.rl" { MARK(content_start, p); } break; case 19: #line 181 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.c.rl" { VALUE 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 188 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.c.rl" { rb_funcall(listener, rb_intern("row"), 2, current_row, INT2FIX(lexer->current_line)); } break; case 21: #line 192 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.c.rl" { if (cs < lexer_first_final) { if (raise_lexer_error != NULL) { size_t 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(newstr, line); } } else { rb_funcall(listener, rb_intern("eof"), 0); } } break; #line 1240 "ext/gherkin_lexer_bg/gherkin_lexer_bg.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 21: #line 192 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.c.rl" { if (cs < lexer_first_final) { if (raise_lexer_error != NULL) { size_t 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(newstr, line); } } else { rb_funcall(listener, rb_intern("eof"), 0); } } break; #line 1299 "ext/gherkin_lexer_bg/gherkin_lexer_bg.c" } } } _out: {} } #line 394 "/Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/bg.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"); // Reset lexer by re-initializing the whole thing lexer_init(lexer); if (cs == lexer_error) { rb_raise(rb_eGherkinLexingError, "Invalid format, lexing fails."); } else { return Qtrue; } } } void Init_gherkin_lexer_bg() { mGherkin = rb_define_module("Gherkin"); rb_eGherkinLexingError = rb_const_get(mGherkin, rb_intern("LexingError")); mCLexer = rb_define_module_under(mGherkin, "CLexer"); cI18nLexer = rb_define_class_under(mCLexer, "Bg", 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); }