#line 1 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.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 docstring_content_type_start; size_t docstring_content_type_end; size_t query_start; size_t last_newline; size_t final_newline; } lexer_state; static VALUE mGherkin; static VALUE mGherkinLexer; 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_multiline_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->start_col); \ 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 254 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.c.rl" /** Data **/ #line 89 "ext/gherkin_lexer_en_pirate/gherkin_lexer_en_pirate.c" static const char _lexer_actions[] = { 0, 1, 0, 1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 1, 10, 1, 11, 1, 12, 1, 13, 1, 16, 1, 17, 1, 18, 1, 19, 1, 20, 1, 21, 1, 22, 1, 23, 2, 1, 18, 2, 4, 5, 2, 13, 0, 2, 14, 15, 2, 17, 0, 2, 17, 2, 2, 17, 16, 2, 17, 19, 2, 18, 6, 2, 18, 7, 2, 18, 8, 2, 18, 9, 2, 18, 10, 2, 18, 16, 2, 20, 21, 2, 22, 0, 2, 22, 2, 2, 22, 16, 2, 22, 19, 3, 3, 14, 15, 3, 5, 14, 15, 3, 11, 14, 15, 3, 12, 14, 15, 3, 13, 14, 15, 3, 14, 15, 18, 3, 17, 14, 15, 4, 1, 14, 15, 18, 4, 4, 5, 14, 15, 4, 17, 0, 14, 15 }; static const short _lexer_key_offsets[] = { 0, 0, 19, 20, 21, 39, 40, 41, 43, 45, 50, 55, 60, 65, 69, 73, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 94, 99, 106, 111, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 243, 245, 247, 249, 251, 253, 255, 257, 259, 261, 263, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 295, 297, 299, 301, 303, 305, 307, 309, 311, 313, 315, 317, 319, 321, 323, 325, 329, 331, 333, 335, 337, 339, 341, 343, 345, 347, 349, 351, 353, 355, 357, 359, 361, 363, 365, 367, 369, 371, 373, 375, 377, 379, 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, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 511, 513, 515, 517, 519, 521, 523, 525, 527, 529, 531, 533, 535, 537, 539, 541, 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, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 661, 663, 665, 667, 669, 671, 673, 675, 677, 679, 681, 683, 685, 687, 689, 691, 695, 697, 699, 701, 703, 705, 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, 769, 771, 773, 775, 777, 779, 781, 783, 785, 787, 789, 791, 793, 795, 797, 799, 801, 803, 805, 807, 809, 811, 813, 815, 817, 819, 823, 829, 832, 834, 840, 858, 860, 862, 864, 866, 868, 870, 872, 874, 876, 878, 880, 882, 884, 886, 888, 890, 892, 894, 896, 898, 900, 902, 904, 906, 908, 910, 912, 914, 916, 918, 920, 922, 924, 926, 928, 930, 932, 934, 936, 938, 940, 942, 944, 946, 948, 950, 952, 954, 956, 957, 958, 959, 960 }; static const char _lexer_trans_keys[] = { -17, 10, 32, 34, 35, 37, 42, 64, 65, 66, 68, 71, 72, 76, 83, 89, 124, 9, 13, -69, -65, 10, 32, 34, 35, 37, 42, 64, 65, 66, 68, 71, 72, 76, 83, 89, 124, 9, 13, 34, 34, 10, 13, 10, 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, 10, 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, 104, 118, 121, 111, 121, 32, 109, 97, 116, 101, 121, 33, 58, 10, 10, 10, 32, 35, 37, 64, 65, 68, 72, 83, 89, 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, 104, 10, 111, 10, 121, 10, 32, 10, 109, 10, 97, 10, 116, 10, 101, 10, 121, 10, 33, 10, 58, 10, 32, 34, 35, 37, 42, 64, 65, 66, 68, 71, 72, 76, 83, 89, 124, 9, 13, 108, 105, 109, 101, 121, 33, 101, 97, 100, 32, 109, 101, 110, 32, 116, 101, 108, 108, 32, 110, 111, 32, 116, 97, 108, 101, 115, 58, 10, 10, 10, 32, 35, 65, 124, 9, 13, 10, 104, 10, 111, 10, 121, 10, 32, 10, 109, 10, 97, 10, 116, 10, 101, 10, 121, 10, 33, 10, 58, 97, 110, 103, 119, 97, 101, 97, 118, 101, 32, 116, 111, 58, 10, 10, 10, 32, 35, 37, 42, 64, 65, 66, 71, 72, 76, 83, 89, 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, 104, 118, 121, 10, 111, 10, 121, 10, 32, 10, 109, 10, 97, 10, 116, 10, 101, 10, 121, 10, 33, 10, 58, 10, 97, 10, 115, 10, 116, 10, 33, 10, 101, 10, 108, 10, 105, 10, 109, 10, 101, 10, 121, 10, 97, 10, 110, 10, 103, 10, 119, 10, 97, 10, 101, 10, 97, 10, 118, 10, 101, 10, 32, 10, 116, 10, 111, 10, 101, 10, 116, 10, 32, 10, 103, 10, 111, 10, 32, 10, 97, 10, 110, 10, 100, 10, 32, 10, 104, 10, 97, 10, 117, 10, 108, 10, 104, 10, 105, 10, 118, 10, 101, 10, 114, 10, 32, 10, 109, 10, 101, 10, 32, 10, 116, 10, 105, 10, 109, 10, 98, 10, 101, 10, 114, 10, 115, 10, 111, 10, 45, 10, 104, 10, 111, 10, 45, 10, 104, 101, 116, 32, 103, 111, 32, 97, 110, 100, 32, 104, 97, 117, 108, 104, 105, 118, 101, 114, 32, 109, 101, 32, 116, 105, 109, 98, 101, 114, 115, 58, 10, 10, 10, 32, 35, 37, 42, 64, 65, 66, 71, 72, 76, 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, 104, 118, 121, 10, 111, 10, 121, 10, 32, 10, 109, 10, 97, 10, 116, 10, 101, 10, 121, 10, 33, 10, 58, 10, 97, 10, 115, 10, 116, 10, 33, 10, 101, 10, 108, 10, 105, 10, 109, 10, 101, 10, 121, 10, 97, 10, 110, 10, 103, 10, 119, 10, 97, 10, 101, 10, 97, 10, 118, 10, 101, 10, 32, 10, 116, 10, 111, 10, 101, 10, 116, 10, 32, 10, 103, 10, 111, 10, 32, 10, 97, 10, 110, 10, 100, 10, 32, 10, 104, 10, 97, 10, 117, 10, 108, 111, 45, 104, 111, 45, 104, 111, 58, 10, 10, 10, 32, 35, 37, 42, 64, 65, 66, 71, 72, 76, 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, 104, 118, 121, 10, 111, 10, 121, 10, 32, 10, 109, 10, 97, 10, 116, 10, 101, 10, 121, 10, 33, 10, 58, 10, 97, 10, 115, 10, 116, 10, 33, 10, 101, 10, 108, 10, 105, 10, 109, 10, 101, 10, 121, 10, 97, 10, 110, 10, 103, 10, 119, 10, 97, 10, 101, 10, 97, 10, 118, 10, 101, 10, 32, 10, 116, 10, 111, 10, 101, 10, 116, 10, 32, 10, 103, 10, 111, 10, 32, 10, 97, 10, 110, 10, 100, 10, 32, 10, 104, 10, 97, 10, 117, 10, 108, 10, 104, 10, 105, 10, 118, 10, 101, 10, 114, 10, 32, 10, 109, 10, 101, 10, 32, 10, 116, 10, 105, 10, 109, 10, 98, 10, 101, 10, 114, 10, 115, 32, 124, 9, 13, 10, 32, 92, 124, 9, 13, 10, 92, 124, 10, 92, 10, 32, 92, 124, 9, 13, 10, 32, 34, 35, 37, 42, 64, 65, 66, 68, 71, 72, 76, 83, 89, 124, 9, 13, 10, 101, 10, 97, 10, 100, 10, 32, 10, 109, 10, 101, 10, 110, 10, 32, 10, 116, 10, 101, 10, 108, 10, 108, 10, 32, 10, 110, 10, 111, 10, 32, 10, 116, 10, 97, 10, 108, 10, 101, 10, 115, 10, 101, 10, 97, 10, 118, 10, 101, 10, 32, 10, 116, 10, 111, 10, 104, 10, 105, 10, 118, 10, 101, 10, 114, 10, 32, 10, 109, 10, 101, 10, 32, 10, 116, 10, 105, 10, 109, 10, 98, 10, 101, 10, 114, 10, 111, 10, 45, 10, 104, 10, 111, 10, 45, 10, 104, 97, 115, 116, 101, 0 }; static const char _lexer_single_lengths[] = { 0, 17, 1, 1, 16, 1, 1, 2, 2, 3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 5, 3, 3, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 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, 5, 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, 13, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 1, 1, 1, 1, 11, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 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, 4, 3, 2, 4, 16, 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, 0 }; static const char _lexer_range_lengths[] = { 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 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, 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, 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, 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, 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, 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, 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, 1, 1, 0, 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 }; static const short _lexer_index_offsets[] = { 0, 0, 19, 21, 23, 41, 43, 45, 48, 51, 56, 61, 66, 71, 75, 79, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 119, 124, 131, 136, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 176, 179, 182, 185, 188, 191, 194, 197, 200, 203, 206, 209, 212, 215, 218, 221, 224, 227, 230, 233, 236, 239, 242, 245, 248, 251, 269, 271, 273, 275, 277, 279, 281, 283, 285, 287, 289, 291, 293, 295, 297, 299, 301, 303, 305, 307, 309, 311, 313, 315, 317, 319, 321, 323, 325, 327, 329, 336, 339, 342, 345, 348, 351, 354, 357, 360, 363, 366, 369, 371, 373, 375, 377, 379, 381, 383, 385, 387, 389, 391, 393, 395, 397, 399, 414, 417, 420, 423, 426, 429, 432, 435, 438, 441, 444, 447, 450, 453, 456, 459, 464, 467, 470, 473, 476, 479, 482, 485, 488, 491, 494, 497, 500, 503, 506, 509, 512, 515, 518, 521, 524, 527, 530, 533, 536, 539, 542, 545, 548, 551, 554, 557, 560, 563, 566, 569, 572, 575, 578, 581, 584, 587, 590, 593, 596, 599, 602, 605, 608, 611, 614, 617, 620, 623, 626, 629, 632, 635, 638, 641, 644, 647, 650, 653, 656, 659, 662, 665, 668, 670, 672, 674, 676, 678, 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, 747, 750, 753, 756, 759, 762, 765, 768, 771, 774, 777, 780, 783, 786, 789, 792, 797, 800, 803, 806, 809, 812, 815, 818, 821, 824, 827, 830, 833, 836, 839, 842, 845, 848, 851, 854, 857, 860, 863, 866, 869, 872, 875, 878, 881, 884, 887, 890, 893, 896, 899, 902, 905, 908, 911, 914, 917, 920, 923, 926, 929, 932, 935, 937, 939, 941, 943, 945, 947, 949, 951, 953, 955, 969, 972, 975, 978, 981, 984, 987, 990, 993, 996, 999, 1002, 1005, 1008, 1011, 1014, 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, 1094, 1097, 1100, 1103, 1106, 1109, 1112, 1115, 1118, 1121, 1124, 1127, 1130, 1133, 1136, 1139, 1142, 1145, 1148, 1151, 1154, 1157, 1160, 1163, 1166, 1169, 1172, 1175, 1178, 1181, 1184, 1187, 1190, 1193, 1196, 1199, 1202, 1205, 1209, 1215, 1219, 1222, 1228, 1246, 1249, 1252, 1255, 1258, 1261, 1264, 1267, 1270, 1273, 1276, 1279, 1282, 1285, 1288, 1291, 1294, 1297, 1300, 1303, 1306, 1309, 1312, 1315, 1318, 1321, 1324, 1327, 1330, 1333, 1336, 1339, 1342, 1345, 1348, 1351, 1354, 1357, 1360, 1363, 1366, 1369, 1372, 1375, 1378, 1381, 1384, 1387, 1390, 1393, 1395, 1397, 1399, 1401 }; static const short _lexer_trans_targs[] = { 2, 4, 4, 5, 15, 17, 31, 34, 37, 77, 83, 119, 124, 219, 233, 315, 404, 4, 0, 3, 0, 4, 0, 4, 4, 5, 15, 17, 31, 34, 37, 77, 83, 119, 124, 219, 233, 315, 404, 4, 0, 6, 0, 7, 0, 9, 8, 8, 9, 8, 8, 10, 10, 11, 10, 10, 10, 10, 11, 10, 10, 10, 10, 12, 10, 10, 10, 10, 13, 10, 10, 4, 14, 14, 0, 4, 14, 14, 0, 4, 16, 15, 4, 0, 18, 0, 19, 0, 20, 0, 21, 0, 22, 0, 23, 0, 24, 0, 25, 0, 26, 0, 27, 0, 28, 0, 29, 0, 30, 0, 463, 0, 32, 0, 0, 33, 4, 16, 33, 0, 0, 0, 0, 35, 36, 4, 36, 36, 34, 35, 35, 4, 36, 34, 36, 0, 38, 459, 462, 0, 39, 0, 40, 0, 41, 0, 42, 0, 43, 0, 44, 0, 45, 0, 46, 0, 47, 0, 48, 0, 50, 49, 50, 49, 50, 50, 4, 51, 4, 65, 410, 431, 438, 453, 50, 49, 50, 52, 49, 50, 53, 49, 50, 54, 49, 50, 55, 49, 50, 56, 49, 50, 57, 49, 50, 58, 49, 50, 59, 49, 50, 60, 49, 50, 61, 49, 50, 62, 49, 50, 63, 49, 50, 64, 49, 50, 4, 49, 50, 66, 49, 50, 67, 49, 50, 68, 49, 50, 69, 49, 50, 70, 49, 50, 71, 49, 50, 72, 49, 50, 73, 49, 50, 74, 49, 50, 75, 49, 50, 76, 49, 4, 4, 5, 15, 17, 31, 34, 37, 77, 83, 119, 124, 219, 233, 315, 404, 4, 0, 78, 0, 79, 0, 80, 0, 81, 0, 82, 0, 31, 0, 84, 0, 85, 0, 86, 0, 87, 0, 88, 0, 89, 0, 90, 0, 91, 0, 92, 0, 93, 0, 94, 0, 95, 0, 96, 0, 97, 0, 98, 0, 99, 0, 100, 0, 101, 0, 102, 0, 103, 0, 104, 0, 105, 0, 107, 106, 107, 106, 107, 107, 4, 108, 4, 107, 106, 107, 109, 106, 107, 110, 106, 107, 111, 106, 107, 112, 106, 107, 113, 106, 107, 114, 106, 107, 115, 106, 107, 116, 106, 107, 117, 106, 107, 118, 106, 107, 76, 106, 120, 0, 121, 0, 122, 0, 123, 0, 81, 0, 125, 0, 126, 0, 127, 0, 128, 0, 129, 0, 130, 0, 131, 0, 132, 0, 134, 133, 134, 133, 134, 134, 4, 135, 149, 4, 150, 166, 171, 176, 183, 197, 213, 134, 133, 134, 136, 133, 134, 137, 133, 134, 138, 133, 134, 139, 133, 134, 140, 133, 134, 141, 133, 134, 142, 133, 134, 143, 133, 134, 144, 133, 134, 145, 133, 134, 146, 133, 134, 147, 133, 134, 148, 133, 134, 4, 133, 134, 76, 133, 134, 151, 161, 165, 133, 134, 152, 133, 134, 153, 133, 134, 154, 133, 134, 155, 133, 134, 156, 133, 134, 157, 133, 134, 158, 133, 134, 159, 133, 134, 160, 133, 134, 76, 133, 134, 162, 133, 134, 163, 133, 134, 164, 133, 134, 149, 133, 134, 149, 133, 134, 167, 133, 134, 168, 133, 134, 169, 133, 134, 170, 133, 134, 164, 133, 134, 172, 133, 134, 173, 133, 134, 174, 133, 134, 175, 133, 134, 170, 133, 134, 177, 133, 134, 178, 133, 134, 179, 133, 134, 180, 133, 134, 181, 133, 134, 182, 133, 134, 160, 133, 134, 184, 133, 134, 185, 133, 134, 186, 133, 134, 187, 133, 134, 188, 133, 134, 189, 133, 134, 190, 133, 134, 191, 133, 134, 192, 133, 134, 193, 133, 134, 194, 133, 134, 195, 133, 134, 196, 133, 134, 149, 133, 134, 198, 133, 134, 199, 133, 134, 200, 133, 134, 201, 133, 134, 202, 133, 134, 203, 133, 134, 204, 133, 134, 205, 133, 134, 206, 133, 134, 207, 133, 134, 208, 133, 134, 209, 133, 134, 210, 133, 134, 211, 133, 134, 212, 133, 134, 160, 133, 134, 214, 133, 134, 215, 133, 134, 216, 133, 134, 217, 133, 134, 218, 133, 134, 182, 133, 220, 0, 221, 0, 222, 0, 223, 0, 224, 0, 225, 0, 226, 0, 227, 0, 228, 0, 229, 0, 230, 0, 231, 0, 232, 0, 31, 0, 234, 0, 235, 0, 236, 0, 237, 0, 238, 0, 239, 0, 240, 0, 241, 0, 242, 0, 243, 0, 244, 0, 245, 0, 246, 0, 247, 0, 248, 0, 249, 0, 250, 0, 252, 251, 252, 251, 252, 252, 4, 253, 267, 4, 268, 284, 289, 294, 301, 252, 251, 252, 254, 251, 252, 255, 251, 252, 256, 251, 252, 257, 251, 252, 258, 251, 252, 259, 251, 252, 260, 251, 252, 261, 251, 252, 262, 251, 252, 263, 251, 252, 264, 251, 252, 265, 251, 252, 266, 251, 252, 4, 251, 252, 76, 251, 252, 269, 279, 283, 251, 252, 270, 251, 252, 271, 251, 252, 272, 251, 252, 273, 251, 252, 274, 251, 252, 275, 251, 252, 276, 251, 252, 277, 251, 252, 278, 251, 252, 76, 251, 252, 280, 251, 252, 281, 251, 252, 282, 251, 252, 267, 251, 252, 267, 251, 252, 285, 251, 252, 286, 251, 252, 287, 251, 252, 288, 251, 252, 282, 251, 252, 290, 251, 252, 291, 251, 252, 292, 251, 252, 293, 251, 252, 288, 251, 252, 295, 251, 252, 296, 251, 252, 297, 251, 252, 298, 251, 252, 299, 251, 252, 300, 251, 252, 278, 251, 252, 302, 251, 252, 303, 251, 252, 304, 251, 252, 305, 251, 252, 306, 251, 252, 307, 251, 252, 308, 251, 252, 309, 251, 252, 310, 251, 252, 311, 251, 252, 312, 251, 252, 313, 251, 252, 314, 251, 252, 267, 251, 316, 0, 317, 0, 318, 0, 319, 0, 320, 0, 321, 0, 322, 0, 323, 0, 325, 324, 325, 324, 325, 325, 4, 326, 340, 4, 341, 357, 362, 367, 374, 388, 325, 324, 325, 327, 324, 325, 328, 324, 325, 329, 324, 325, 330, 324, 325, 331, 324, 325, 332, 324, 325, 333, 324, 325, 334, 324, 325, 335, 324, 325, 336, 324, 325, 337, 324, 325, 338, 324, 325, 339, 324, 325, 4, 324, 325, 76, 324, 325, 342, 352, 356, 324, 325, 343, 324, 325, 344, 324, 325, 345, 324, 325, 346, 324, 325, 347, 324, 325, 348, 324, 325, 349, 324, 325, 350, 324, 325, 351, 324, 325, 76, 324, 325, 353, 324, 325, 354, 324, 325, 355, 324, 325, 340, 324, 325, 340, 324, 325, 358, 324, 325, 359, 324, 325, 360, 324, 325, 361, 324, 325, 355, 324, 325, 363, 324, 325, 364, 324, 325, 365, 324, 325, 366, 324, 325, 361, 324, 325, 368, 324, 325, 369, 324, 325, 370, 324, 325, 371, 324, 325, 372, 324, 325, 373, 324, 325, 351, 324, 325, 375, 324, 325, 376, 324, 325, 377, 324, 325, 378, 324, 325, 379, 324, 325, 380, 324, 325, 381, 324, 325, 382, 324, 325, 383, 324, 325, 384, 324, 325, 385, 324, 325, 386, 324, 325, 387, 324, 325, 340, 324, 325, 389, 324, 325, 390, 324, 325, 391, 324, 325, 392, 324, 325, 393, 324, 325, 394, 324, 325, 395, 324, 325, 396, 324, 325, 397, 324, 325, 398, 324, 325, 399, 324, 325, 400, 324, 325, 401, 324, 325, 402, 324, 325, 403, 324, 325, 351, 324, 404, 405, 404, 0, 409, 408, 407, 405, 408, 406, 0, 407, 405, 406, 0, 407, 406, 409, 408, 407, 405, 408, 406, 409, 409, 5, 15, 17, 31, 34, 37, 77, 83, 119, 124, 219, 233, 315, 404, 409, 0, 50, 411, 49, 50, 412, 49, 50, 413, 49, 50, 414, 49, 50, 415, 49, 50, 416, 49, 50, 417, 49, 50, 418, 49, 50, 419, 49, 50, 420, 49, 50, 421, 49, 50, 422, 49, 50, 423, 49, 50, 424, 49, 50, 425, 49, 50, 426, 49, 50, 427, 49, 50, 428, 49, 50, 429, 49, 50, 430, 49, 50, 75, 49, 50, 432, 49, 50, 433, 49, 50, 434, 49, 50, 435, 49, 50, 436, 49, 50, 437, 49, 50, 75, 49, 50, 439, 49, 50, 440, 49, 50, 441, 49, 50, 442, 49, 50, 443, 49, 50, 444, 49, 50, 445, 49, 50, 446, 49, 50, 447, 49, 50, 448, 49, 50, 449, 49, 50, 450, 49, 50, 451, 49, 50, 452, 49, 50, 430, 49, 50, 454, 49, 50, 455, 49, 50, 456, 49, 50, 457, 49, 50, 458, 49, 50, 437, 49, 460, 0, 461, 0, 82, 0, 31, 0, 0, 0 }; static const unsigned char _lexer_trans_actions[] = { 0, 54, 0, 5, 1, 0, 29, 1, 29, 29, 29, 29, 29, 29, 29, 29, 35, 0, 43, 0, 43, 0, 43, 54, 0, 5, 1, 0, 29, 1, 29, 29, 29, 29, 29, 29, 29, 29, 35, 0, 43, 0, 43, 0, 43, 135, 48, 9, 106, 11, 0, 130, 45, 45, 45, 3, 122, 33, 33, 33, 0, 122, 33, 33, 33, 0, 122, 33, 0, 33, 0, 102, 7, 7, 43, 54, 0, 0, 43, 114, 25, 0, 54, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 43, 57, 110, 23, 0, 43, 43, 43, 43, 0, 27, 118, 27, 27, 51, 27, 0, 54, 0, 1, 0, 43, 0, 0, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 140, 57, 54, 0, 54, 0, 69, 33, 69, 84, 84, 84, 84, 84, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 13, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 13, 0, 126, 31, 60, 57, 31, 63, 57, 63, 63, 63, 63, 63, 63, 63, 63, 66, 31, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 140, 57, 54, 0, 54, 0, 81, 84, 81, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 21, 0, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 140, 57, 54, 0, 54, 0, 75, 33, 84, 75, 84, 84, 84, 84, 84, 84, 84, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 17, 0, 54, 17, 0, 54, 0, 0, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 17, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 140, 57, 54, 0, 54, 0, 78, 33, 84, 78, 84, 84, 84, 84, 84, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 19, 0, 54, 19, 0, 54, 0, 0, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 19, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 140, 57, 54, 0, 54, 0, 72, 33, 84, 72, 84, 84, 84, 84, 84, 84, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 15, 0, 54, 15, 0, 54, 0, 0, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 15, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 0, 0, 0, 43, 54, 37, 37, 87, 37, 37, 43, 0, 39, 0, 43, 0, 0, 54, 0, 0, 39, 0, 0, 54, 0, 93, 90, 41, 96, 90, 96, 96, 96, 96, 96, 96, 96, 96, 99, 0, 43, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 54, 0, 0, 0, 43, 0, 43, 0, 43, 0, 43, 0, 0 }; static const unsigned char _lexer_eof_actions[] = { 0, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43 }; static const int lexer_start = 1; static const int lexer_first_final = 463; static const int lexer_error = 0; static const int lexer_en_main = 1; #line 258 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.c.rl" static VALUE unindent(VALUE con, int start_col) { VALUE re; // 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); re = rb_reg_regcomp(rb_str_new2(pat)); rb_funcall(con, rb_intern("gsub!"), 2, re, rb_str_new2("")); return Qnil; } 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); rb_funcall(con, rb_intern("strip!"), 0); rb_funcall(listener, rb_intern(event_name), 3, kw, con, INT2FIX(current_line)); } static void store_multiline_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 start_col) { VALUE split; VALUE con = Qnil, kw = Qnil, name = Qnil, desc = Qnil; kw = ENCODED_STR_NEW(keyword_at, keyword_length); con = ENCODED_STR_NEW(at, length); unindent(con, start_col); split = rb_str_split(con, "\n"); name = rb_funcall(split, rb_intern("shift"), 0); desc = rb_ary_join(split, rb_str_new2( "\n" )); if( name == Qnil ) { name = rb_str_new2(""); } if( rb_funcall(desc, rb_intern("size"), 0) == 0) { desc = rb_str_new2(""); } rb_funcall(name, rb_intern("strip!"), 0); rb_funcall(desc, rb_intern("rstrip!"), 0); rb_funcall(listener, rb_intern(event_name), 4, kw, name, desc, 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_docstring_content(VALUE listener, int start_col, const char *type_at, size_t type_length, const char *at, size_t length, int current_line) { VALUE re2; VALUE unescape_escaped_quotes; VALUE con = ENCODED_STR_NEW(at, length); VALUE con_type = ENCODED_STR_NEW(type_at, type_length); unindent(con, start_col); re2 = rb_reg_regcomp(rb_str_new2("\r\\Z")); unescape_escaped_quotes = rb_reg_regcomp(rb_str_new2("\\\\\"\\\\\"\\\\\"")); rb_funcall(con, rb_intern("sub!"), 2, re2, rb_str_new2("")); rb_funcall(con_type, rb_intern("strip!"), 0); rb_funcall(con, rb_intern("gsub!"), 2, unescape_escaped_quotes, rb_str_new2("\"\"\"")); rb_funcall(listener, rb_intern("doc_string"), 3, con_type, con, INT2FIX(current_line)); } static void raise_lexer_error(const char * at, int line) { rb_raise(rb_eGherkinLexingError, "Lexing error on line %d: '%s'. See http://wiki.github.com/cucumber/gherkin/lexingerror for more information.", line, at); } static void lexer_init(lexer_state *lexer) { lexer->content_start = 0; lexer->content_end = 0; lexer->content_len = 0; lexer->docstring_content_type_start = 0; lexer->docstring_content_type_end = 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; } 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) { lexer_state *lxr; rb_iv_set(self, "@listener", listener); lxr = NULL; DATA_GET(self, lexer_state, lxr); lexer_init(lxr); return self; } static VALUE CLexer_scan(VALUE self, VALUE input) { VALUE input_copy; char *data; size_t len; VALUE listener = rb_iv_get(self, "@listener"); lexer_state *lexer; lexer = NULL; DATA_GET(self, lexer_state, lexer); input_copy = rb_str_dup(input); rb_str_append(input_copy, rb_str_new2("\n%_FEATURE_END_%")); data = RSTRING_PTR(input_copy); len = RSTRING_LEN(input_copy); if (len == 0) { rb_raise(rb_eGherkinLexingError, "No content to lex."); } else { const char *p, *pe, *eof; int cs = 0; VALUE current_row = Qnil; p = data; pe = data + len; eof = pe; assert(*pe == '\0' && "pointer does not end on NULL"); #line 1074 "ext/gherkin_lexer_en_pirate/gherkin_lexer_en_pirate.c" { cs = lexer_start; } #line 425 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.c.rl" #line 1081 "ext/gherkin_lexer_en_pirate/gherkin_lexer_en_pirate.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 83 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.c.rl" { MARK(content_start, p); lexer->current_line = lexer->line_number; lexer->start_col = lexer->content_start - lexer->last_newline - (lexer->keyword_end - lexer->keyword_start) + 2; } break; case 1: #line 89 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.c.rl" { MARK(content_start, p); } break; case 2: #line 93 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.c.rl" { lexer->current_line = lexer->line_number; lexer->start_col = p - data - lexer->last_newline; } break; case 3: #line 98 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.c.rl" { int len = LEN(content_start, PTR_TO(final_newline)); int type_len = LEN(docstring_content_type_start, PTR_TO(docstring_content_type_end)); if (len < 0) len = 0; if (type_len < 0) len = 0; store_docstring_content(listener, lexer->start_col, PTR_TO(docstring_content_type_start), type_len, PTR_TO(content_start), len, lexer->current_line); } break; case 4: #line 108 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.c.rl" { MARK(docstring_content_type_start, p); } break; case 5: #line 112 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.c.rl" { MARK(docstring_content_type_end, p); } break; case 6: #line 116 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.c.rl" { STORE_KW_END_CON(feature); } break; case 7: #line 120 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.c.rl" { STORE_KW_END_CON(background); } break; case 8: #line 124 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.c.rl" { STORE_KW_END_CON(scenario); } break; case 9: #line 128 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.c.rl" { STORE_KW_END_CON(scenario_outline); } break; case 10: #line 132 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.c.rl" { STORE_KW_END_CON(examples); } break; case 11: #line 136 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.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 12: #line 143 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.c.rl" { STORE_ATTR(comment); lexer->mark = 0; } break; case 13: #line 148 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.c.rl" { STORE_ATTR(tag); lexer->mark = 0; } break; case 14: #line 153 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.c.rl" { lexer->line_number += 1; MARK(final_newline, p); } break; case 15: #line 158 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.c.rl" { MARK(last_newline, p + 1); } break; case 16: #line 162 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.c.rl" { if (lexer->mark == 0) { MARK(mark, p); } } break; case 17: #line 168 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.c.rl" { MARK(keyword_end, p); MARK(keyword_start, PTR_TO(mark)); MARK(content_start, p + 1); lexer->mark = 0; } break; case 18: #line 175 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.c.rl" { MARK(content_end, p); } break; case 19: #line 179 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.c.rl" { p = p - 1; lexer->current_line = lexer->line_number; current_row = rb_ary_new(); } break; case 20: #line 185 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.c.rl" { MARK(content_start, p); } break; case 21: #line 189 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.c.rl" { VALUE re_pipe, re_newline, re_backslash; VALUE con = ENCODED_STR_NEW(PTR_TO(content_start), LEN(content_start, p)); rb_funcall(con, rb_intern("strip!"), 0); re_pipe = rb_reg_regcomp(rb_str_new2("\\\\\\|")); re_newline = rb_reg_regcomp(rb_str_new2("\\\\n")); re_backslash = rb_reg_regcomp(rb_str_new2("\\\\\\\\")); rb_funcall(con, rb_intern("gsub!"), 2, re_pipe, rb_str_new2("|")); rb_funcall(con, rb_intern("gsub!"), 2, re_newline, rb_str_new2("\n")); rb_funcall(con, rb_intern("gsub!"), 2, re_backslash, rb_str_new2("\\")); rb_ary_push(current_row, con); } break; case 22: #line 203 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.c.rl" { rb_funcall(listener, rb_intern("row"), 2, current_row, INT2FIX(lexer->current_line)); } break; case 23: #line 207 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.c.rl" { int line; if (cs < lexer_first_final) { size_t count = 0; VALUE newstr_val; char *newstr; 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; } // Allocate as a ruby string so that it gets cleaned up by GC newstr_val = rb_str_new(buff, len); newstr = RSTRING_PTR(newstr_val); 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++; } 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 1371 "ext/gherkin_lexer_en_pirate/gherkin_lexer_en_pirate.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 207 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.c.rl" { int line; if (cs < lexer_first_final) { size_t count = 0; VALUE newstr_val; char *newstr; 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; } // Allocate as a ruby string so that it gets cleaned up by GC newstr_val = rb_str_new(buff, len); newstr = RSTRING_PTR(newstr_val); 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++; } 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 1434 "ext/gherkin_lexer_en_pirate/gherkin_lexer_en_pirate.c" } } } _out: {} } #line 426 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en_pirate.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_en_pirate() { mGherkin = rb_define_module("Gherkin"); mGherkinLexer = rb_define_module_under(mGherkin, "Lexer"); rb_eGherkinLexingError = rb_const_get(mGherkinLexer, rb_intern("LexingError")); mCLexer = rb_define_module_under(mGherkin, "CLexer"); cI18nLexer = rb_define_class_under(mCLexer, "En_pirate", 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); }