gherkin.lexer.Gl Maven / Gradle / Ivy
The newest version!
// line 1 "ragel/i18n/gl.java.rl"
package gherkin.lexer;
import java.io.UnsupportedEncodingException;
import java.util.List;
import java.util.ArrayList;
import java.util.regex.Pattern;
import gherkin.lexer.Lexer;
import gherkin.lexer.Listener;
import gherkin.lexer.LexingError;
public class Gl implements Lexer {
// line 150 "ragel/i18n/gl.java.rl"
private final Listener listener;
public Gl(Listener listener) {
this.listener = listener;
}
// line 26 "java/src/main/java/gherkin/lexer/Gl.java"
private static byte[] init__lexer_actions_0()
{
return new byte [] {
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, 2, 18,
2, 3, 4, 2, 13, 0, 2, 14, 15, 2, 17, 0,
2, 17, 1, 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, 1,
2, 22, 16, 2, 22, 19, 3, 4, 14, 15, 3, 5,
14, 15, 3, 11, 14, 15, 3, 12, 14, 15, 3, 13,
14, 15, 3, 14, 15, 18, 3, 17, 0, 11, 3, 17,
14, 15, 4, 2, 14, 15, 18, 4, 3, 4, 14, 15,
4, 17, 0, 14, 15, 5, 17, 0, 11, 14, 15
};
}
private static final byte _lexer_actions[] = init__lexer_actions_0();
private static short[] init__lexer_key_offsets_0()
{
return new short [] {
0, 0, 17, 18, 19, 35, 36, 37, 39, 41, 46, 51,
56, 61, 65, 69, 71, 72, 73, 74, 75, 76, 77, 78,
79, 80, 81, 82, 83, 84, 85, 86, 87, 89, 91, 96,
103, 108, 110, 112, 113, 114, 115, 116, 117, 118, 119, 120,
121, 122, 123, 124, 125, 126, 127, 128, 129, 138, 140, 142,
144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166,
169, 171, 173, 175, 177, 179, 181, 183, 185, 187, 189, 191,
193, 195, 197, 213, 214, 215, 217, 219, 223, 224, 225, 226,
227, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
240, 241, 242, 243, 244, 245, 246, 247, 248, 262, 264, 266,
268, 270, 272, 274, 276, 278, 280, 282, 284, 286, 288, 290,
292, 294, 297, 299, 301, 303, 305, 307, 309, 311, 313, 315,
317, 319, 321, 323, 325, 327, 329, 331, 334, 337, 341, 343,
345, 347, 349, 351, 353, 355, 357, 359, 361, 363, 365, 367,
369, 371, 373, 375, 377, 378, 379, 380, 381, 382, 383, 384,
385, 386, 400, 402, 404, 406, 408, 410, 412, 414, 416, 418,
420, 422, 424, 426, 428, 430, 433, 436, 438, 440, 442, 444,
446, 448, 450, 452, 454, 456, 458, 460, 462, 464, 466, 468,
470, 472, 474, 476, 478, 480, 482, 485, 488, 492, 494, 496,
498, 500, 503, 505, 507, 509, 511, 513, 515, 517, 519, 521,
523, 525, 527, 529, 531, 533, 535, 537, 539, 541, 543, 545,
547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 563, 565,
567, 569, 571, 573, 575, 577, 579, 581, 583, 585, 587, 589,
591, 593, 594, 595, 596, 597, 598, 599, 600, 604, 610, 613,
615, 621, 637, 639, 641, 643, 645, 647, 649, 652, 655, 657,
659, 661, 663, 665, 667, 669, 671, 673, 675, 677, 679, 681,
683, 685, 687, 689, 691, 693, 695, 697, 698, 699, 700, 701,
702, 703, 704, 705, 706, 720, 722, 724, 726, 728, 730, 732,
734, 736, 738, 740, 742, 744, 746, 748, 750, 752, 755, 757,
759, 761, 763, 765, 767, 769, 771, 773, 775, 777, 779, 781,
783, 785, 787, 789, 792, 795, 799, 801, 803, 805, 807, 810,
812, 814, 816, 818, 820, 822, 824, 826, 828, 830, 832, 834,
836, 838, 840, 842, 844, 846, 848, 850, 852, 854, 856
};
}
private static final short _lexer_key_offsets[] = init__lexer_key_offsets_0();
private static byte[] init__lexer_trans_keys_0()
{
return new byte [] {
-17, 10, 32, 34, 35, 37, 42, 64, 67, 68, 69, 76,
77, 80, 124, 9, 13, -69, -65, 10, 32, 34, 35, 37,
42, 64, 67, 68, 69, 76, 77, 80, 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, 13, 10, 13, 13, 32, 64, 9, 10,
9, 10, 13, 32, 64, 11, 12, 10, 32, 64, 9, 13,
97, 111, 110, 114, 100, 111, 97, 99, 116, 101, 114, -61,
-83, 115, 116, 105, 99, 97, 58, 10, 10, 10, 32, 35,
37, 64, 67, 69, 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, 97,
111, 10, 114, 10, 97, 10, 99, 10, 116, 10, 101, 10,
114, -61, 10, -83, 10, 10, 115, 10, 116, 10, 105, 10,
99, 10, 97, 10, 58, 10, 32, 34, 35, 37, 42, 64,
67, 68, 69, 76, 77, 80, 124, 9, 13, 97, 100, 97,
111, 32, 115, 32, 110, 115, 120, 116, -61, -77, 110, 98,
99, 111, 122, 111, 32, 100, 111, 32, 101, 115, 99, 101,
110, 97, 114, 105, 111, 58, 10, 10, 10, 32, 35, 37,
42, 64, 67, 68, 69, 76, 77, 80, 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, 97, 10, 110, 114, 10, 100, 10,
111, 10, 97, 10, 99, 10, 116, 10, 101, 10, 114, -61,
10, -83, 10, 10, 115, 10, 116, 10, 105, 10, 99, 10,
97, 10, 58, 10, 97, 10, 100, 10, 97, 111, 10, 32,
115, 10, 32, 110, 115, 10, 116, -61, 10, -77, 10, 10,
110, 10, 99, 10, 101, 10, 110, 10, 97, 10, 114, 10,
105, 10, 111, 10, 111, 10, 103, 10, 97, 10, 105, 10,
115, 10, 101, 10, 114, 101, 110, 97, 114, 105, 111, 58,
10, 10, 10, 32, 35, 37, 42, 64, 67, 68, 69, 76,
77, 80, 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, 97,
111, 10, 110, 114, 10, 100, 10, 111, 10, 97, 10, 99,
10, 116, 10, 101, 10, 114, -61, 10, -83, 10, 10, 115,
10, 116, 10, 105, 10, 99, 10, 97, 10, 58, 10, 110,
10, 116, 10, 101, 10, 120, 10, 116, 10, 111, 10, 97,
10, 100, 10, 97, 111, 10, 32, 115, 10, 32, 110, 115,
10, 116, -61, 10, -77, 10, 10, 110, 10, 98, 99, 10,
111, 10, 122, 10, 111, 10, 32, 10, 100, 10, 111, 10,
32, 10, 101, 10, 115, 10, 99, 10, 101, 10, 110, 10,
97, 10, 114, 10, 105, 10, 111, 10, 103, 10, 97, 10,
105, 10, 115, 10, 101, 10, 114, 101, 109, 112, 108, 111,
115, 58, 10, 10, 10, 32, 35, 67, 124, 9, 13, 10,
97, 10, 114, 10, 97, 10, 99, 10, 116, 10, 101, 10,
114, -61, 10, -83, 10, 10, 115, 10, 116, 10, 105, 10,
99, 10, 97, 10, 58, 111, 103, 97, 105, 115, 101, 114,
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, 67, 68, 69, 76, 77, 80, 124, 9,
13, 10, 110, 10, 116, 10, 101, 10, 120, 10, 116, 10,
111, 10, 115, 120, 10, 98, 99, 10, 111, 10, 122, 10,
111, 10, 32, 10, 100, 10, 111, 10, 32, 10, 101, 10,
115, 10, 99, 10, 101, 10, 110, 10, 97, 10, 114, 10,
105, 10, 101, 10, 109, 10, 112, 10, 108, 10, 111, 10,
115, 110, 116, 101, 120, 116, 111, 58, 10, 10, 10, 32,
35, 37, 42, 64, 67, 68, 69, 76, 77, 80, 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, 97, 10, 110, 114, 10,
100, 10, 111, 10, 97, 10, 99, 10, 116, 10, 101, 10,
114, -61, 10, -83, 10, 10, 115, 10, 116, 10, 105, 10,
99, 10, 97, 10, 58, 10, 97, 10, 100, 10, 97, 111,
10, 32, 115, 10, 32, 110, 115, 10, 116, -61, 10, -77,
10, 10, 110, 10, 98, 99, 10, 111, 10, 122, 10, 111,
10, 32, 10, 100, 10, 111, 10, 32, 10, 101, 10, 115,
10, 99, 10, 101, 10, 110, 10, 97, 10, 114, 10, 105,
10, 111, 10, 111, 10, 103, 10, 97, 10, 105, 10, 115,
10, 101, 10, 114, 0
};
}
private static final byte _lexer_trans_keys[] = init__lexer_trans_keys_0();
private static byte[] init__lexer_single_lengths_0()
{
return new byte [] {
0, 15, 1, 1, 14, 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, 2, 2, 3, 5,
3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 7, 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,
2, 2, 14, 1, 1, 2, 2, 4, 1, 1, 1, 1,
2, 1, 1, 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,
2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 3, 3, 4, 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, 12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 3, 3, 4, 2, 2, 2,
2, 3, 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, 5, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 1, 1, 1, 1, 1, 1, 1, 2, 4, 3, 2,
4, 14, 2, 2, 2, 2, 2, 2, 3, 3, 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, 12, 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, 2, 2,
2, 2, 2, 3, 3, 4, 2, 2, 2, 2, 3, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0
};
}
private static final byte _lexer_single_lengths[] = init__lexer_single_lengths_0();
private static byte[] init__lexer_range_lengths_0()
{
return new byte [] {
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, 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, 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, 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, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 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, 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
};
}
private static final byte _lexer_range_lengths[] = init__lexer_range_lengths_0();
private static short[] init__lexer_index_offsets_0()
{
return new short [] {
0, 0, 17, 19, 21, 37, 39, 41, 44, 47, 52, 57,
62, 67, 71, 75, 78, 80, 82, 84, 86, 88, 90, 92,
94, 96, 98, 100, 102, 104, 106, 108, 110, 113, 116, 121,
128, 133, 136, 139, 141, 143, 145, 147, 149, 151, 153, 155,
157, 159, 161, 163, 165, 167, 169, 171, 173, 182, 185, 188,
191, 194, 197, 200, 203, 206, 209, 212, 215, 218, 221, 224,
228, 231, 234, 237, 240, 243, 246, 249, 252, 255, 258, 261,
264, 267, 270, 286, 288, 290, 293, 296, 301, 303, 305, 307,
309, 312, 314, 316, 318, 320, 322, 324, 326, 328, 330, 332,
334, 336, 338, 340, 342, 344, 346, 348, 350, 364, 367, 370,
373, 376, 379, 382, 385, 388, 391, 394, 397, 400, 403, 406,
409, 412, 416, 419, 422, 425, 428, 431, 434, 437, 440, 443,
446, 449, 452, 455, 458, 461, 464, 467, 471, 475, 480, 483,
486, 489, 492, 495, 498, 501, 504, 507, 510, 513, 516, 519,
522, 525, 528, 531, 534, 536, 538, 540, 542, 544, 546, 548,
550, 552, 566, 569, 572, 575, 578, 581, 584, 587, 590, 593,
596, 599, 602, 605, 608, 611, 615, 619, 622, 625, 628, 631,
634, 637, 640, 643, 646, 649, 652, 655, 658, 661, 664, 667,
670, 673, 676, 679, 682, 685, 688, 692, 696, 701, 704, 707,
710, 713, 717, 720, 723, 726, 729, 732, 735, 738, 741, 744,
747, 750, 753, 756, 759, 762, 765, 768, 771, 774, 777, 780,
783, 785, 787, 789, 791, 793, 795, 797, 799, 801, 808, 811,
814, 817, 820, 823, 826, 829, 832, 835, 838, 841, 844, 847,
850, 853, 855, 857, 859, 861, 863, 865, 867, 871, 877, 881,
884, 890, 906, 909, 912, 915, 918, 921, 924, 928, 932, 935,
938, 941, 944, 947, 950, 953, 956, 959, 962, 965, 968, 971,
974, 977, 980, 983, 986, 989, 992, 995, 997, 999, 1001, 1003,
1005, 1007, 1009, 1011, 1013, 1027, 1030, 1033, 1036, 1039, 1042, 1045,
1048, 1051, 1054, 1057, 1060, 1063, 1066, 1069, 1072, 1075, 1079, 1082,
1085, 1088, 1091, 1094, 1097, 1100, 1103, 1106, 1109, 1112, 1115, 1118,
1121, 1124, 1127, 1130, 1134, 1138, 1143, 1146, 1149, 1152, 1155, 1159,
1162, 1165, 1168, 1171, 1174, 1177, 1180, 1183, 1186, 1189, 1192, 1195,
1198, 1201, 1204, 1207, 1210, 1213, 1216, 1219, 1222, 1225, 1228
};
}
private static final short _lexer_index_offsets[] = init__lexer_index_offsets_0();
private static short[] init__lexer_indicies_0()
{
return new short [] {
1, 3, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 2, 0, 16, 0, 2, 0, 3, 2, 4,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 2,
0, 17, 0, 18, 0, 20, 21, 19, 23, 24, 22, 27,
26, 28, 26, 25, 31, 30, 32, 30, 29, 31, 30, 33,
30, 29, 31, 30, 34, 30, 29, 36, 35, 35, 0, 3,
37, 37, 0, 39, 40, 38, 3, 0, 41, 0, 42, 0,
43, 0, 44, 0, 45, 0, 46, 0, 47, 0, 48, 0,
49, 0, 50, 0, 51, 0, 52, 0, 53, 0, 54, 0,
55, 0, 57, 58, 56, 60, 61, 59, 0, 0, 0, 0,
62, 63, 64, 63, 63, 66, 65, 62, 3, 67, 8, 67,
0, 68, 69, 0, 70, 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, 88, 87, 90, 89, 90, 91, 92, 93, 92, 94, 95,
91, 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, 105, 89, 90, 106, 89, 90,
107, 89, 90, 108, 89, 90, 109, 89, 90, 110, 111, 89,
90, 112, 89, 90, 113, 89, 90, 114, 89, 90, 115, 89,
90, 116, 89, 90, 117, 89, 118, 90, 89, 119, 90, 89,
90, 120, 89, 90, 121, 89, 90, 122, 89, 90, 123, 89,
90, 124, 89, 90, 125, 89, 127, 126, 128, 129, 130, 131,
132, 133, 134, 135, 136, 137, 138, 139, 126, 0, 140, 0,
141, 0, 142, 142, 0, 55, 73, 0, 55, 143, 144, 145,
0, 146, 0, 147, 0, 148, 0, 73, 0, 149, 150, 0,
151, 0, 152, 0, 153, 0, 154, 0, 155, 0, 156, 0,
157, 0, 158, 0, 159, 0, 160, 0, 161, 0, 162, 0,
163, 0, 164, 0, 165, 0, 166, 0, 167, 0, 169, 168,
171, 170, 171, 172, 173, 174, 175, 173, 176, 177, 178, 179,
180, 181, 172, 170, 171, 182, 170, 171, 183, 170, 171, 184,
170, 171, 185, 170, 171, 186, 170, 171, 187, 170, 171, 188,
170, 171, 189, 170, 171, 190, 170, 171, 191, 170, 171, 192,
170, 171, 193, 170, 171, 194, 170, 171, 195, 170, 171, 196,
170, 171, 197, 170, 171, 198, 199, 170, 171, 200, 170, 171,
201, 170, 171, 202, 170, 171, 203, 170, 171, 204, 170, 171,
205, 170, 171, 206, 170, 207, 171, 170, 208, 171, 170, 171,
209, 170, 171, 210, 170, 171, 211, 170, 171, 212, 170, 171,
213, 170, 171, 196, 170, 171, 214, 170, 171, 215, 170, 171,
216, 216, 170, 171, 196, 201, 170, 171, 196, 217, 218, 170,
171, 219, 170, 220, 171, 170, 221, 171, 170, 171, 201, 170,
171, 222, 170, 171, 223, 170, 171, 224, 170, 171, 225, 170,
171, 226, 170, 171, 227, 170, 171, 213, 170, 171, 228, 170,
171, 200, 170, 171, 229, 170, 171, 230, 170, 171, 201, 170,
171, 231, 170, 171, 200, 170, 232, 0, 233, 0, 234, 0,
235, 0, 236, 0, 237, 0, 238, 0, 240, 239, 242, 241,
242, 243, 244, 245, 246, 244, 247, 248, 249, 250, 251, 252,
243, 241, 242, 253, 241, 242, 254, 241, 242, 255, 241, 242,
256, 241, 242, 257, 241, 242, 258, 241, 242, 259, 241, 242,
260, 241, 242, 261, 241, 242, 262, 241, 242, 263, 241, 242,
264, 241, 242, 265, 241, 242, 266, 241, 242, 267, 241, 242,
268, 269, 241, 242, 270, 271, 241, 242, 272, 241, 242, 273,
241, 242, 274, 241, 242, 275, 241, 242, 276, 241, 242, 277,
241, 242, 278, 241, 279, 242, 241, 280, 242, 241, 242, 281,
241, 242, 282, 241, 242, 283, 241, 242, 284, 241, 242, 285,
241, 242, 267, 241, 242, 286, 241, 242, 287, 241, 242, 288,
241, 242, 289, 241, 242, 290, 241, 242, 285, 241, 242, 291,
241, 242, 292, 241, 242, 293, 293, 241, 242, 267, 273, 241,
242, 267, 294, 295, 241, 242, 296, 241, 297, 242, 241, 298,
242, 241, 242, 273, 241, 242, 299, 300, 241, 242, 301, 241,
242, 302, 241, 242, 303, 241, 242, 304, 241, 242, 305, 241,
242, 306, 241, 242, 307, 241, 242, 308, 241, 242, 309, 241,
242, 300, 241, 242, 310, 241, 242, 311, 241, 242, 312, 241,
242, 313, 241, 242, 290, 241, 242, 314, 241, 242, 272, 241,
242, 315, 241, 242, 316, 241, 242, 273, 241, 242, 317, 241,
242, 272, 241, 318, 0, 319, 0, 320, 0, 321, 0, 322,
0, 323, 0, 324, 0, 326, 325, 328, 327, 328, 329, 330,
331, 330, 329, 327, 328, 332, 327, 328, 333, 327, 328, 334,
327, 328, 335, 327, 328, 336, 327, 328, 337, 327, 328, 338,
327, 339, 328, 327, 340, 328, 327, 328, 341, 327, 328, 342,
327, 328, 343, 327, 328, 344, 327, 328, 345, 327, 328, 346,
327, 347, 0, 72, 0, 348, 0, 349, 0, 73, 0, 350,
0, 72, 0, 351, 352, 351, 0, 355, 354, 356, 357, 354,
353, 0, 359, 360, 358, 0, 359, 358, 355, 361, 359, 360,
361, 358, 355, 362, 363, 364, 365, 366, 367, 368, 369, 370,
371, 372, 373, 374, 362, 0, 90, 375, 89, 90, 376, 89,
90, 377, 89, 90, 378, 89, 90, 379, 89, 90, 124, 89,
90, 380, 381, 89, 90, 382, 383, 89, 90, 384, 89, 90,
385, 89, 90, 386, 89, 90, 387, 89, 90, 388, 89, 90,
389, 89, 90, 390, 89, 90, 391, 89, 90, 392, 89, 90,
383, 89, 90, 393, 89, 90, 394, 89, 90, 395, 89, 90,
396, 89, 90, 379, 89, 90, 397, 89, 90, 398, 89, 90,
399, 89, 90, 400, 89, 90, 401, 89, 90, 124, 89, 402,
0, 403, 0, 404, 0, 405, 0, 406, 0, 407, 0, 408,
0, 410, 409, 412, 411, 412, 413, 414, 415, 416, 414, 417,
418, 419, 420, 421, 422, 413, 411, 412, 423, 411, 412, 424,
411, 412, 425, 411, 412, 426, 411, 412, 427, 411, 412, 428,
411, 412, 429, 411, 412, 430, 411, 412, 431, 411, 412, 432,
411, 412, 433, 411, 412, 434, 411, 412, 435, 411, 412, 436,
411, 412, 437, 411, 412, 438, 411, 412, 439, 440, 411, 412,
441, 411, 412, 442, 411, 412, 443, 411, 412, 444, 411, 412,
445, 411, 412, 446, 411, 412, 447, 411, 448, 412, 411, 449,
412, 411, 412, 450, 411, 412, 451, 411, 412, 452, 411, 412,
453, 411, 412, 454, 411, 412, 437, 411, 412, 455, 411, 412,
456, 411, 412, 457, 457, 411, 412, 437, 442, 411, 412, 437,
458, 459, 411, 412, 460, 411, 461, 412, 411, 462, 412, 411,
412, 442, 411, 412, 463, 464, 411, 412, 465, 411, 412, 466,
411, 412, 467, 411, 412, 468, 411, 412, 469, 411, 412, 470,
411, 412, 471, 411, 412, 472, 411, 412, 473, 411, 412, 464,
411, 412, 474, 411, 412, 475, 411, 412, 476, 411, 412, 477,
411, 412, 478, 411, 412, 454, 411, 412, 479, 411, 412, 441,
411, 412, 480, 411, 412, 481, 411, 412, 442, 411, 412, 482,
411, 412, 441, 411, 483, 0
};
}
private static final short _lexer_indicies[] = init__lexer_indicies_0();
private static short[] init__lexer_trans_targs_0()
{
return new short [] {
0, 2, 4, 4, 5, 15, 17, 31, 34, 37, 87, 91,
277, 279, 282, 284, 3, 6, 7, 8, 9, 8, 8, 9,
8, 10, 10, 10, 11, 10, 10, 10, 11, 12, 13, 14,
4, 14, 15, 4, 16, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 394, 32, 33, 4, 16, 33,
4, 16, 35, 36, 4, 35, 34, 36, 38, 319, 39, 41,
40, 31, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
52, 53, 54, 55, 56, 55, 56, 56, 4, 57, 71, 296,
58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
70, 4, 72, 290, 73, 74, 75, 76, 77, 78, 79, 80,
81, 82, 83, 84, 85, 86, 4, 4, 5, 15, 17, 31,
34, 37, 87, 91, 277, 279, 282, 284, 88, 89, 90, 92,
96, 252, 93, 94, 95, 97, 172, 98, 99, 100, 101, 102,
103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
115, 116, 115, 116, 116, 4, 117, 131, 132, 149, 153, 165,
167, 170, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
128, 129, 130, 4, 86, 133, 134, 136, 135, 131, 137, 138,
139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 150, 151,
152, 154, 158, 155, 156, 157, 159, 160, 161, 162, 163, 164,
166, 168, 169, 171, 173, 174, 175, 176, 177, 178, 179, 180,
181, 180, 181, 181, 4, 182, 196, 197, 220, 224, 245, 247,
250, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
194, 195, 4, 86, 198, 214, 199, 201, 200, 196, 202, 203,
204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 215, 216,
217, 218, 219, 221, 222, 223, 225, 229, 226, 227, 228, 230,
240, 231, 232, 233, 234, 235, 236, 237, 238, 239, 241, 242,
243, 244, 246, 248, 249, 251, 253, 254, 255, 256, 257, 258,
259, 260, 261, 260, 261, 261, 4, 262, 263, 264, 265, 266,
267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 86, 278,
280, 281, 283, 284, 285, 286, 288, 289, 287, 285, 286, 287,
285, 288, 289, 5, 15, 17, 31, 34, 37, 87, 91, 277,
279, 282, 284, 291, 292, 293, 294, 295, 297, 313, 298, 308,
299, 300, 301, 302, 303, 304, 305, 306, 307, 309, 310, 311,
312, 314, 315, 316, 317, 318, 320, 321, 322, 323, 324, 325,
326, 327, 328, 327, 328, 328, 4, 329, 343, 344, 361, 365,
387, 389, 392, 330, 331, 332, 333, 334, 335, 336, 337, 338,
339, 340, 341, 342, 4, 86, 345, 346, 348, 347, 343, 349,
350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 362,
363, 364, 366, 370, 367, 368, 369, 371, 381, 372, 373, 374,
375, 376, 377, 378, 379, 380, 382, 383, 384, 385, 386, 388,
390, 391, 393, 0
};
}
private static final short _lexer_trans_targs[] = init__lexer_trans_targs_0();
private static short[] init__lexer_trans_actions_0()
{
return new short [] {
43, 0, 0, 54, 3, 1, 0, 29, 1, 29, 29, 29,
29, 29, 29, 35, 0, 0, 0, 7, 139, 48, 0, 102,
9, 5, 45, 134, 45, 0, 33, 122, 33, 33, 0, 11,
106, 0, 0, 114, 25, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 57, 149, 126, 0,
110, 23, 0, 27, 118, 27, 51, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 57, 144, 0, 54, 0, 69, 33, 84, 84,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 13, 31, 130, 60, 57, 31, 63,
57, 63, 63, 63, 63, 63, 63, 66, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
57, 144, 0, 54, 0, 78, 33, 84, 84, 84, 84, 84,
84, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 19, 19, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 57,
144, 0, 54, 0, 75, 33, 84, 84, 84, 84, 84, 84,
84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 57, 144, 0, 54, 0, 81, 84, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0,
0, 0, 0, 0, 0, 37, 37, 54, 37, 87, 0, 0,
39, 0, 0, 93, 90, 41, 96, 90, 96, 96, 96, 96,
96, 96, 99, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 57, 144, 0, 54, 0, 72, 33, 84, 84, 84, 84,
84, 84, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 15, 15, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0
};
}
private static final short _lexer_trans_actions[] = init__lexer_trans_actions_0();
private static short[] init__lexer_eof_actions_0()
{
return new short [] {
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
};
}
private static final short _lexer_eof_actions[] = init__lexer_eof_actions_0();
static final int lexer_start = 1;
static final int lexer_first_final = 394;
static final int lexer_en_main = 1;
// line 159 "ragel/i18n/gl.java.rl"
public void scan(String source) {
String input = source + "\n%_FEATURE_END_%";
byte[] data = null;
try {
data = input.getBytes("UTF-8");
} catch(UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
int cs, p = 0, pe = data.length;
int eof = pe;
int lineNumber = 1;
int lastNewline = 0;
int contentStart = -1;
int currentLine = -1;
int docstringContentTypeStart = -1;
int docstringContentTypeEnd = -1;
int startCol = -1;
int nextKeywordStart = -1;
int keywordStart = -1;
String keyword = null;
List currentRow = null;
// line 585 "java/src/main/java/gherkin/lexer/Gl.java"
{
cs = lexer_start;
}
// line 185 "ragel/i18n/gl.java.rl"
// line 592 "java/src/main/java/gherkin/lexer/Gl.java"
{
int _klen;
int _trans = 0;
int _acts;
int _nacts;
int _keys;
int _goto_targ = 0;
_goto: while (true) {
switch ( _goto_targ ) {
case 0:
if ( p == pe ) {
_goto_targ = 4;
continue _goto;
}
if ( cs == 0 ) {
_goto_targ = 5;
continue _goto;
}
case 1:
_match: do {
_keys = _lexer_key_offsets[cs];
_trans = _lexer_index_offsets[cs];
_klen = _lexer_single_lengths[cs];
if ( _klen > 0 ) {
int _lower = _keys;
int _mid;
int _upper = _keys + _klen - 1;
while (true) {
if ( _upper < _lower )
break;
_mid = _lower + ((_upper-_lower) >> 1);
if ( data[p] < _lexer_trans_keys[_mid] )
_upper = _mid - 1;
else if ( data[p] > _lexer_trans_keys[_mid] )
_lower = _mid + 1;
else {
_trans += (_mid - _keys);
break _match;
}
}
_keys += _klen;
_trans += _klen;
}
_klen = _lexer_range_lengths[cs];
if ( _klen > 0 ) {
int _lower = _keys;
int _mid;
int _upper = _keys + (_klen<<1) - 2;
while (true) {
if ( _upper < _lower )
break;
_mid = _lower + (((_upper-_lower) >> 1) & ~1);
if ( data[p] < _lexer_trans_keys[_mid] )
_upper = _mid - 2;
else if ( data[p] > _lexer_trans_keys[_mid+1] )
_lower = _mid + 2;
else {
_trans += ((_mid - _keys)>>1);
break _match;
}
}
_trans += _klen;
}
} while (false);
_trans = _lexer_indicies[_trans];
cs = _lexer_trans_targs[_trans];
if ( _lexer_trans_actions[_trans] != 0 ) {
_acts = _lexer_trans_actions[_trans];
_nacts = (int) _lexer_actions[_acts++];
while ( _nacts-- > 0 )
{
switch ( _lexer_actions[_acts++] )
{
case 0:
// line 16 "ragel/i18n/gl.java.rl"
{
contentStart = p;
currentLine = lineNumber;
if(keyword != null) {
startCol = p - lastNewline - (keyword.length() + 1);
}
}
break;
case 1:
// line 24 "ragel/i18n/gl.java.rl"
{
currentLine = lineNumber;
startCol = p - lastNewline;
}
break;
case 2:
// line 29 "ragel/i18n/gl.java.rl"
{
contentStart = p;
}
break;
case 3:
// line 33 "ragel/i18n/gl.java.rl"
{
docstringContentTypeStart = p;
}
break;
case 4:
// line 37 "ragel/i18n/gl.java.rl"
{
docstringContentTypeEnd = p;
}
break;
case 5:
// line 41 "ragel/i18n/gl.java.rl"
{
String con = unindent(startCol, substring(data, contentStart, nextKeywordStart-1).replaceFirst("(\\r?\\n)?([\\t ])*\\Z", "").replace("\\\"\\\"\\\"", "\"\"\""));
String conType = substring(data, docstringContentTypeStart, docstringContentTypeEnd).trim();
listener.docString(conType, con, currentLine);
}
break;
case 6:
// line 47 "ragel/i18n/gl.java.rl"
{
String[] nameDescription = nameAndUnindentedDescription(startCol, keywordContent(data, p, eof, nextKeywordStart, contentStart));
listener.feature(keyword, nameDescription[0], nameDescription[1], currentLine);
if(nextKeywordStart != -1) p = nextKeywordStart - 1;
nextKeywordStart = -1;
}
break;
case 7:
// line 54 "ragel/i18n/gl.java.rl"
{
String[] nameDescription = nameAndUnindentedDescription(startCol, keywordContent(data, p, eof, nextKeywordStart, contentStart));
listener.background(keyword, nameDescription[0], nameDescription[1], currentLine);
if(nextKeywordStart != -1) p = nextKeywordStart - 1;
nextKeywordStart = -1;
}
break;
case 8:
// line 61 "ragel/i18n/gl.java.rl"
{
String[] nameDescription = nameAndUnindentedDescription(startCol, keywordContent(data, p, eof, nextKeywordStart, contentStart));
listener.scenario(keyword, nameDescription[0], nameDescription[1], currentLine);
if(nextKeywordStart != -1) p = nextKeywordStart - 1;
nextKeywordStart = -1;
}
break;
case 9:
// line 68 "ragel/i18n/gl.java.rl"
{
String[] nameDescription = nameAndUnindentedDescription(startCol, keywordContent(data, p, eof, nextKeywordStart, contentStart));
listener.scenarioOutline(keyword, nameDescription[0], nameDescription[1], currentLine);
if(nextKeywordStart != -1) p = nextKeywordStart - 1;
nextKeywordStart = -1;
}
break;
case 10:
// line 75 "ragel/i18n/gl.java.rl"
{
String[] nameDescription = nameAndUnindentedDescription(startCol, keywordContent(data, p, eof, nextKeywordStart, contentStart));
listener.examples(keyword, nameDescription[0], nameDescription[1], currentLine);
if(nextKeywordStart != -1) p = nextKeywordStart - 1;
nextKeywordStart = -1;
}
break;
case 11:
// line 82 "ragel/i18n/gl.java.rl"
{
listener.step(keyword, substring(data, contentStart, p).trim(), currentLine);
}
break;
case 12:
// line 86 "ragel/i18n/gl.java.rl"
{
listener.comment(substring(data, contentStart, p).trim(), lineNumber);
keywordStart = -1;
}
break;
case 13:
// line 91 "ragel/i18n/gl.java.rl"
{
listener.tag(substring(data, contentStart, p).trim(), currentLine);
keywordStart = -1;
}
break;
case 14:
// line 96 "ragel/i18n/gl.java.rl"
{
lineNumber++;
}
break;
case 15:
// line 100 "ragel/i18n/gl.java.rl"
{
lastNewline = p + 1;
}
break;
case 16:
// line 104 "ragel/i18n/gl.java.rl"
{
if(keywordStart == -1) keywordStart = p;
}
break;
case 17:
// line 108 "ragel/i18n/gl.java.rl"
{
keyword = substring(data, keywordStart, p).replaceFirst(":$","");
keywordStart = -1;
}
break;
case 18:
// line 113 "ragel/i18n/gl.java.rl"
{
nextKeywordStart = p;
}
break;
case 19:
// line 117 "ragel/i18n/gl.java.rl"
{
p = p - 1;
currentRow = new ArrayList();
currentLine = lineNumber;
}
break;
case 20:
// line 123 "ragel/i18n/gl.java.rl"
{
contentStart = p;
}
break;
case 21:
// line 127 "ragel/i18n/gl.java.rl"
{
String con = substring(data, contentStart, p).trim();
currentRow.add(con
.replace("\\|", "|")
.replace("\\n", "\n")
.replace("\\\\", "\\")
);
}
break;
case 22:
// line 136 "ragel/i18n/gl.java.rl"
{
listener.row(currentRow, currentLine);
}
break;
case 23:
// line 140 "ragel/i18n/gl.java.rl"
{
if(cs < lexer_first_final) {
String content = currentLineContent(data, lastNewline);
throw new LexingError("Lexing error on line " + lineNumber + ": '" + content + "'. See http://wiki.github.com/cucumber/gherkin/lexingerror for more information.");
} else {
listener.eof();
}
}
break;
// line 853 "java/src/main/java/gherkin/lexer/Gl.java"
}
}
}
case 2:
if ( cs == 0 ) {
_goto_targ = 5;
continue _goto;
}
if ( ++p != pe ) {
_goto_targ = 1;
continue _goto;
}
case 4:
if ( p == eof )
{
int __acts = _lexer_eof_actions[cs];
int __nacts = (int) _lexer_actions[__acts++];
while ( __nacts-- > 0 ) {
switch ( _lexer_actions[__acts++] ) {
case 23:
// line 140 "ragel/i18n/gl.java.rl"
{
if(cs < lexer_first_final) {
String content = currentLineContent(data, lastNewline);
throw new LexingError("Lexing error on line " + lineNumber + ": '" + content + "'. See http://wiki.github.com/cucumber/gherkin/lexingerror for more information.");
} else {
listener.eof();
}
}
break;
// line 885 "java/src/main/java/gherkin/lexer/Gl.java"
}
}
}
case 5:
}
break; }
}
// line 186 "ragel/i18n/gl.java.rl"
}
private String keywordContent(byte[] data, int p, int eof, int nextKeywordStart, int contentStart) {
int endPoint = (nextKeywordStart == -1 || (p == eof)) ? p : nextKeywordStart;
return substring(data, contentStart, endPoint);
}
private String[] nameAndUnindentedDescription(int startCol, String text) {
String[] lines = text.split("\n");
String name = lines.length > 0 ? lines[0].trim() : "";
StringBuffer description = new StringBuffer();
for(int i = 1; i < lines.length; i++) {
description.append(lines[i]);
description.append("\n");
}
return new String[]{name, unindent(startCol+2, description.toString()).replaceAll("\\s+$", "")};
}
private String unindent(int startCol, String text) {
return Pattern.compile("^[\t ]{0," + startCol + "}", Pattern.MULTILINE).matcher(text).replaceAll("");
}
private String currentLineContent(byte[] data, int lastNewline) {
return substring(data, lastNewline, data.length).trim();
}
private String substring(byte[] data, int start, int end) {
try {
return new String(data, start, end-start, "utf-8");
} catch(java.io.UnsupportedEncodingException e) {
throw new RuntimeException("Internal error", e);
}
}
}