/* #line 1 "NanorexMMPImportExport.rl" */ // *********************** GENERATED BY RAGEL 6.0 ******************* // ** Do not edit directly. Edit NanorexMMPImportExport.rl instead ** // ****************************************************************** // Copyright 2008 Nanorex, Inc. See LICENSE file for details. #include "NanorexMMPImportExport.h" #include #include #include #define VERBOSE #if defined(VERBOSE) #if 0 #define CDEBUG(s) DEBUG_MSG(inputFilename, lineNum, s) inline void DEBUG_MSG(string const& filename, int line, string const& s) { NXLOG_DEBUG(filename, NXUtility::itos(line)+": "+s); /* Nanorex::NXLogger* logger = Nanorex::NXLogger::Instance(); if (logger != 0) logger->log(Nanorex::NXLogLevel_Info, filename, msg.str());*/ } #endif #define CERR(s) { cerr << inputFilename << ": " << NXUtility::itos(lineNum) \ << ": " << s << endl; } // #define CDEBUG(s) NXLOG_DEBUG(inputFilename, NXUtility::itos(lineNum)+": "+s) #define CDEBUG(s) { cerr << inputFilename << ": " << NXUtility::itos(lineNum) \ << ": " << s << endl; } #define CLOG(s) NXLOG_INFO(inputFilename, NXUtility::itos(lineNum)+": "+s) #else #define CDEBUG(s) #define CLOG(s) #endif #define CSEVERE(s) NXLOG_SEVERE(inputFilename, NXUtility::itos(lineNum)+": "+s) /* #line 103 "NanorexMMPImportExport.rl" */ /* #line 107 "NanorexMMPImportExport.rl" */ // static data from Ragel /* #line 53 "NanorexMMPImportExport.cpp" */ static const char _mmp_parser_actions[] = { 0, 1, 0, 1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 7, 1, 8, 1, 9, 1, 10, 1, 11, 1, 12, 1, 13, 1, 14, 1, 15, 1, 16, 1, 17, 1, 20, 1, 21, 1, 24, 1, 25, 1, 29, 1, 31, 1, 32, 1, 33, 1, 34, 1, 35, 1, 36, 1, 37, 1, 38, 1, 39, 1, 40, 1, 42, 1, 45, 1, 47, 1, 48, 1, 52, 1, 56, 1, 58, 1, 73, 1, 74, 2, 0, 44, 2, 0, 69, 2, 0, 71, 2, 0, 72, 2, 5, 15, 2, 5, 16, 2, 5, 17, 2, 6, 7, 2, 8, 32, 2, 8, 33, 2, 8, 34, 2, 8, 35, 2, 8, 36, 2, 8, 37, 2, 8, 38, 2, 8, 39, 2, 8, 40, 2, 11, 18, 2, 11, 31, 2, 50, 27, 2, 52, 0, 2, 56, 57, 3, 0, 19, 67, 3, 0, 22, 70, 3, 0, 23, 68, 3, 0, 26, 65, 3, 0, 28, 66, 3, 0, 30, 53, 3, 0, 41, 61, 3, 0, 43, 54, 3, 0, 43, 62, 3, 0, 46, 55, 3, 0, 49, 64, 3, 0, 51, 63, 3, 20, 0, 69, 3, 59, 0, 60, 4, 12, 0, 23, 68, 4, 12, 0, 26, 65, 4, 12, 0, 28, 66, 4, 12, 0, 43, 54, 4, 12, 0, 43, 62, 4, 12, 0, 51, 63, 4, 48, 0, 49, 64, 5, 11, 18, 0, 19, 67 }; static const short _mmp_parser_key_offsets[] = { 0, 0, 6, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 25, 31, 33, 35, 37, 39, 41, 45, 50, 51, 52, 53, 54, 55, 56, 57, 63, 69, 70, 71, 72, 73, 78, 83, 88, 89, 90, 91, 95, 100, 101, 102, 103, 108, 113, 118, 119, 120, 121, 122, 127, 132, 143, 157, 171, 176, 188, 193, 194, 195, 196, 201, 206, 207, 208, 209, 210, 215, 220, 221, 222, 223, 224, 225, 226, 227, 228, 233, 238, 243, 244, 245, 249, 251, 253, 255, 269, 283, 296, 309, 311, 312, 313, 314, 315, 316, 320, 326, 333, 338, 343, 345, 352, 354, 358, 364, 366, 368, 370, 372, 374, 378, 383, 384, 385, 386, 387, 388, 389, 390, 391, 396, 398, 410, 413, 416, 419, 424, 431, 438, 444, 451, 459, 465, 470, 476, 485, 489, 497, 503, 512, 516, 524, 530, 539, 543, 551, 557, 563, 576, 578, 593, 608, 622, 630, 634, 642, 650, 658, 662, 670, 678, 686, 690, 698, 706, 714, 721, 724, 727, 730, 738, 743, 750, 758, 766, 768, 776, 779, 782, 785, 788, 791, 794, 797, 800, 803, 808, 815, 822, 829, 837, 843, 845, 853, 860, 863, 866, 869, 875, 887, 902, 917, 923, 932, 936, 945, 951, 960, 964, 973, 979, 988, 992, 1001, 1007, 1016, 1020, 1029, 1035, 1041, 1050, 1054, 1063, 1069, 1075, 1084, 1088, 1097, 1103, 1112, 1116, 1125, 1131, 1140, 1144, 1153, 1159, 1165, 1174, 1178, 1187, 1193, 1199, 1201, 1211, 1217, 1221, 1229, 1239, 1245, 1249, 1257, 1267, 1273, 1277, 1285, 1295, 1301, 1305, 1313, 1323, 1329, 1333, 1341, 1351, 1357, 1361, 1369, 1379, 1385, 1389, 1397, 1407, 1413, 1417, 1425, 1435, 1441, 1445, 1453, 1467, 1470, 1473, 1476, 1479, 1482, 1489, 1496, 1498, 1511, 1523, 1538, 1553, 1559, 1573, 1576, 1579, 1582, 1585, 1591, 1597, 1609, 1624, 1639, 1645, 1658, 1660, 1675, 1690, 1704, 1718, 1721, 1724, 1727, 1732, 1740, 1743, 1746, 1749, 1754, 1766, 1781, 1796, 1810, 1822, 1837, 1852, 1854, 1868, 1871, 1874, 1877, 1880, 1885, 1897, 1912, 1927, 1941, 1953, 1968, 1983, 1985, 1999, 2002, 2005, 2008, 2011, 2014, 2017, 2020, 2023, 2028, 2040, 2055, 2070, 2084, 2096, 2111, 2126, 2128, 2142, 2145, 2148, 2153, 2159, 2171, 2186, 2201, 2207, 2220, 2222, 2237, 2252, 2266, 2280, 2282, 2282, 2295 }; static const char _mmp_parser_trans_keys[] = { 10, 32, 35, 109, 9, 13, 10, 32, 35, 9, 13, -1, 10, 109, 112, 102, 111, 114, 109, 97, 116, 9, 32, 11, 13, 9, 32, 11, 13, 48, 57, 48, 57, 48, 57, 48, 57, 48, 57, 48, 57, 9, 32, 11, 13, 9, 32, 114, 11, 13, 101, 113, 117, 105, 114, 101, 100, 10, 32, 35, 59, 9, 13, 10, 32, 103, 107, 9, 13, 114, 111, 117, 112, 9, 32, 40, 11, 13, 9, 32, 40, 11, 13, 9, 32, 86, 11, 13, 105, 101, 119, 9, 32, 11, 13, 9, 32, 68, 11, 13, 97, 116, 97, 9, 32, 41, 11, 13, 10, 32, 35, 9, 13, 10, 32, 103, 9, 13, 114, 111, 117, 112, 9, 32, 40, 11, 13, 9, 32, 40, 11, 13, 9, 32, 95, 11, 13, 48, 57, 65, 90, 97, 122, 9, 32, 41, 95, 11, 13, 45, 46, 48, 57, 65, 90, 97, 122, 9, 32, 41, 95, 11, 13, 45, 46, 48, 57, 65, 90, 97, 122, 10, 32, 35, 9, 13, 10, 32, 35, 95, 9, 13, 48, 57, 65, 90, 97, 122, 10, 32, 101, 9, 13, 110, 100, 49, 10, 32, 35, 9, 13, 10, 32, 103, 9, 13, 114, 111, 117, 112, 9, 32, 40, 11, 13, 9, 32, 67, 11, 13, 108, 105, 112, 98, 111, 97, 114, 100, 9, 32, 41, 11, 13, 10, 32, 35, 9, 13, 10, 32, 101, 9, 13, 110, 100, 9, 32, 11, 13, -1, 10, -1, 10, -1, 10, 10, 32, 35, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, 10, 32, 35, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, 9, 32, 95, 11, 13, 45, 46, 48, 57, 65, 90, 97, 122, 9, 32, 95, 11, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 101, 108, 118, 105, 110, 9, 32, 11, 13, 9, 32, 11, 13, 48, 57, 10, 32, 35, 9, 13, 48, 57, 10, 32, 35, 9, 13, 10, 32, 103, 9, 13, -1, 10, 10, 32, 35, 9, 13, 48, 57, -1, 10, 9, 32, 11, 13, 9, 32, 11, 13, 48, 57, 48, 57, 48, 57, 48, 57, 48, 57, 48, 57, 9, 32, 11, 13, 9, 32, 112, 11, 13, 114, 101, 102, 101, 114, 114, 101, 100, 10, 32, 35, 9, 13, -1, 10, -1, 10, 32, 97, 98, 99, 101, 103, 105, 109, 9, 13, -1, 10, 116, -1, 10, 111, -1, 10, 109, -1, 10, 32, 9, 13, -1, 10, 32, 9, 13, 48, 57, -1, 10, 32, 9, 13, 48, 57, -1, 10, 32, 40, 9, 13, -1, 10, 32, 9, 13, 48, 57, -1, 10, 32, 41, 9, 13, 48, 57, -1, 10, 32, 41, 9, 13, -1, 10, 32, 9, 13, -1, 10, 32, 40, 9, 13, -1, 10, 32, 43, 45, 9, 13, 48, 57, -1, 10, 48, 57, -1, 10, 32, 44, 9, 13, 48, 57, -1, 10, 32, 44, 9, 13, -1, 10, 32, 43, 45, 9, 13, 48, 57, -1, 10, 48, 57, -1, 10, 32, 44, 9, 13, 48, 57, -1, 10, 32, 44, 9, 13, -1, 10, 32, 43, 45, 9, 13, 48, 57, -1, 10, 48, 57, -1, 10, 32, 41, 9, 13, 48, 57, -1, 10, 32, 41, 9, 13, -1, 10, 32, 35, 9, 13, -1, 10, 32, 35, 95, 9, 13, 48, 57, 65, 90, 97, 122, -1, 10, -1, 10, 32, 35, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 35, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 41, 9, 13, 48, 57, -1, 10, 48, 57, -1, 10, 32, 41, 9, 13, 48, 57, -1, 10, 32, 41, 9, 13, 48, 57, -1, 10, 32, 44, 9, 13, 48, 57, -1, 10, 48, 57, -1, 10, 32, 44, 9, 13, 48, 57, -1, 10, 32, 44, 9, 13, 48, 57, -1, 10, 32, 44, 9, 13, 48, 57, -1, 10, 48, 57, -1, 10, 32, 44, 9, 13, 48, 57, -1, 10, 32, 44, 9, 13, 48, 57, -1, 10, 32, 41, 9, 13, 48, 57, -1, 10, 32, 9, 13, 48, 57, -1, 10, 111, -1, 10, 110, -1, 10, 100, -1, 10, 95, 97, 99, 103, 49, 51, -1, 10, 32, 9, 13, -1, 10, 32, 9, 13, 48, 57, -1, 10, 32, 35, 9, 13, 48, 57, -1, 10, 32, 35, 9, 13, 48, 57, -1, 10, -1, 10, 32, 35, 9, 13, 48, 57, -1, 10, 100, -1, 10, 105, -1, 10, 114, -1, 10, 101, -1, 10, 99, -1, 10, 116, -1, 10, 105, -1, 10, 111, -1, 10, 110, -1, 10, 32, 9, 13, -1, 10, 32, 9, 13, 48, 57, -1, 10, 32, 9, 13, 48, 57, -1, 10, 32, 9, 13, 48, 57, -1, 10, 32, 35, 9, 13, 48, 57, -1, 10, 32, 35, 9, 13, -1, 10, -1, 10, 32, 35, 9, 13, 48, 57, -1, 10, 32, 9, 13, 48, 57, -1, 10, 115, -1, 10, 121, -1, 10, 115, -1, 10, 32, 40, 9, 13, -1, 10, 32, 95, 9, 13, 48, 57, 65, 90, 97, 122, -1, 10, 32, 41, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 41, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 40, 9, 13, -1, 10, 32, 43, 45, 9, 13, 48, 57, -1, 10, 48, 57, -1, 10, 32, 44, 46, 9, 13, 48, 57, -1, 10, 32, 44, 9, 13, -1, 10, 32, 43, 45, 9, 13, 48, 57, -1, 10, 48, 57, -1, 10, 32, 44, 46, 9, 13, 48, 57, -1, 10, 32, 44, 9, 13, -1, 10, 32, 43, 45, 9, 13, 48, 57, -1, 10, 48, 57, -1, 10, 32, 44, 46, 9, 13, 48, 57, -1, 10, 32, 44, 9, 13, -1, 10, 32, 43, 45, 9, 13, 48, 57, -1, 10, 48, 57, -1, 10, 32, 41, 46, 9, 13, 48, 57, -1, 10, 32, 41, 9, 13, -1, 10, 32, 40, 9, 13, -1, 10, 32, 43, 45, 9, 13, 48, 57, -1, 10, 48, 57, -1, 10, 32, 41, 46, 9, 13, 48, 57, -1, 10, 32, 41, 9, 13, -1, 10, 32, 40, 9, 13, -1, 10, 32, 43, 45, 9, 13, 48, 57, -1, 10, 48, 57, -1, 10, 32, 44, 46, 9, 13, 48, 57, -1, 10, 32, 44, 9, 13, -1, 10, 32, 43, 45, 9, 13, 48, 57, -1, 10, 48, 57, -1, 10, 32, 44, 46, 9, 13, 48, 57, -1, 10, 32, 44, 9, 13, -1, 10, 32, 43, 45, 9, 13, 48, 57, -1, 10, 48, 57, -1, 10, 32, 41, 46, 9, 13, 48, 57, -1, 10, 32, 41, 9, 13, -1, 10, 32, 40, 9, 13, -1, 10, 32, 43, 45, 9, 13, 48, 57, -1, 10, 48, 57, -1, 10, 32, 41, 46, 9, 13, 48, 57, -1, 10, 32, 41, 9, 13, -1, 10, 32, 35, 9, 13, -1, 10, -1, 10, 32, 41, 69, 101, 9, 13, 48, 57, -1, 10, 43, 45, 48, 57, -1, 10, 48, 57, -1, 10, 32, 41, 9, 13, 48, 57, -1, 10, 32, 41, 69, 101, 9, 13, 48, 57, -1, 10, 43, 45, 48, 57, -1, 10, 48, 57, -1, 10, 32, 41, 9, 13, 48, 57, -1, 10, 32, 44, 69, 101, 9, 13, 48, 57, -1, 10, 43, 45, 48, 57, -1, 10, 48, 57, -1, 10, 32, 44, 9, 13, 48, 57, -1, 10, 32, 44, 69, 101, 9, 13, 48, 57, -1, 10, 43, 45, 48, 57, -1, 10, 48, 57, -1, 10, 32, 44, 9, 13, 48, 57, -1, 10, 32, 41, 69, 101, 9, 13, 48, 57, -1, 10, 43, 45, 48, 57, -1, 10, 48, 57, -1, 10, 32, 41, 9, 13, 48, 57, -1, 10, 32, 41, 69, 101, 9, 13, 48, 57, -1, 10, 43, 45, 48, 57, -1, 10, 48, 57, -1, 10, 32, 41, 9, 13, 48, 57, -1, 10, 32, 44, 69, 101, 9, 13, 48, 57, -1, 10, 43, 45, 48, 57, -1, 10, 48, 57, -1, 10, 32, 44, 9, 13, 48, 57, -1, 10, 32, 44, 69, 101, 9, 13, 48, 57, -1, 10, 43, 45, 48, 57, -1, 10, 48, 57, -1, 10, 32, 44, 9, 13, 48, 57, -1, 10, 32, 44, 69, 101, 9, 13, 48, 57, -1, 10, 43, 45, 48, 57, -1, 10, 48, 57, -1, 10, 32, 44, 9, 13, 48, 57, -1, 10, 32, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 103, -1, 10, 114, -1, 10, 111, -1, 10, 117, -1, 10, 112, -1, 10, 32, 35, 40, 9, 13, -1, 10, 32, 35, 40, 9, 13, -1, 10, -1, 10, 32, 41, 95, 9, 13, 48, 57, 65, 90, 97, 122, -1, 10, 32, 95, 9, 13, 48, 57, 65, 90, 97, 122, -1, 10, 32, 41, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 41, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 35, 9, 13, -1, 10, 32, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 114, -1, 10, 111, -1, 10, 117, -1, 10, 112, -1, 10, 32, 40, 9, 13, -1, 10, 32, 40, 9, 13, -1, 10, 32, 95, 9, 13, 48, 57, 65, 90, 97, 122, -1, 10, 32, 41, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 41, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 35, 9, 13, -1, 10, 32, 35, 95, 9, 13, 48, 57, 65, 90, 97, 122, -1, 10, -1, 10, 32, 35, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 35, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 110, -1, 10, 102, -1, 10, 111, -1, 10, 32, 9, 13, -1, 10, 32, 97, 99, 111, 9, 13, -1, 10, 116, -1, 10, 111, -1, 10, 109, -1, 10, 32, 9, 13, -1, 10, 32, 95, 9, 13, 48, 57, 65, 90, 97, 122, -1, 10, 32, 61, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 61, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 95, 9, 13, 48, 57, 65, 90, 97, 122, -1, 10, 32, 35, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 35, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, -1, 10, 32, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 104, -1, 10, 117, -1, 10, 110, -1, 10, 107, -1, 10, 32, 9, 13, -1, 10, 32, 95, 9, 13, 48, 57, 65, 90, 97, 122, -1, 10, 32, 61, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 61, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 95, 9, 13, 48, 57, 65, 90, 97, 122, -1, 10, 32, 35, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 35, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, -1, 10, 32, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 112, -1, 10, 101, -1, 10, 110, -1, 10, 103, -1, 10, 114, -1, 10, 111, -1, 10, 117, -1, 10, 112, -1, 10, 32, 9, 13, -1, 10, 32, 95, 9, 13, 48, 57, 65, 90, 97, 122, -1, 10, 32, 61, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 61, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 95, 9, 13, 48, 57, 65, 90, 97, 122, -1, 10, 32, 35, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 35, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, -1, 10, 32, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 111, -1, 10, 108, -1, 10, 32, 9, 13, -1, 10, 32, 40, 9, 13, -1, 10, 32, 95, 9, 13, 48, 57, 65, 90, 97, 122, -1, 10, 32, 41, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 41, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 35, 9, 13, -1, 10, 32, 35, 95, 9, 13, 48, 57, 65, 90, 97, 122, -1, 10, -1, 10, 32, 35, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 35, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, 32, 95, 9, 13, 45, 46, 48, 57, 65, 90, 97, 122, -1, 10, -1, 10, 32, 35, 97, 98, 99, 101, 103, 105, 109, 9, 13, -1, 10, 32, 97, 98, 99, 101, 103, 105, 109, 9, 13, 0 }; static const char _mmp_parser_single_lengths[] = { 0, 4, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 2, 3, 1, 1, 1, 1, 1, 1, 1, 4, 4, 1, 1, 1, 1, 3, 3, 3, 1, 1, 1, 2, 3, 1, 1, 1, 3, 3, 3, 1, 1, 1, 1, 3, 3, 3, 4, 4, 3, 4, 3, 1, 1, 1, 3, 3, 1, 1, 1, 1, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 1, 1, 2, 2, 2, 2, 4, 4, 3, 3, 2, 1, 1, 1, 1, 1, 2, 2, 3, 3, 3, 2, 3, 2, 2, 2, 0, 0, 0, 0, 0, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 3, 2, 10, 3, 3, 3, 3, 3, 3, 4, 3, 4, 4, 3, 4, 5, 2, 4, 4, 5, 2, 4, 4, 5, 2, 4, 4, 4, 5, 2, 5, 5, 4, 4, 2, 4, 4, 4, 2, 4, 4, 4, 2, 4, 4, 4, 3, 3, 3, 3, 6, 3, 3, 4, 4, 2, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 2, 4, 3, 3, 3, 3, 4, 4, 5, 5, 4, 5, 2, 5, 4, 5, 2, 5, 4, 5, 2, 5, 4, 5, 2, 5, 4, 4, 5, 2, 5, 4, 4, 5, 2, 5, 4, 5, 2, 5, 4, 5, 2, 5, 4, 4, 5, 2, 5, 4, 4, 2, 6, 4, 2, 4, 6, 4, 2, 4, 6, 4, 2, 4, 6, 4, 2, 4, 6, 4, 2, 4, 6, 4, 2, 4, 6, 4, 2, 4, 6, 4, 2, 4, 6, 4, 2, 4, 4, 3, 3, 3, 3, 3, 5, 5, 2, 5, 4, 5, 5, 4, 4, 3, 3, 3, 3, 4, 4, 4, 5, 5, 4, 5, 2, 5, 5, 4, 4, 3, 3, 3, 3, 6, 3, 3, 3, 3, 4, 5, 5, 4, 4, 5, 5, 2, 4, 3, 3, 3, 3, 3, 4, 5, 5, 4, 4, 5, 5, 2, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 5, 5, 4, 4, 5, 5, 2, 4, 3, 3, 3, 4, 4, 5, 5, 4, 5, 2, 5, 5, 4, 4, 2, 0, 11, 10 }; static const char _mmp_parser_range_lengths[] = { 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 4, 5, 5, 1, 4, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 1, 2, 2, 1, 1, 0, 2, 0, 1, 2, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 2, 2, 1, 2, 2, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 4, 0, 5, 5, 5, 2, 1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 0, 0, 0, 1, 1, 2, 2, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 1, 0, 2, 2, 0, 0, 0, 1, 4, 5, 5, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 0, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 5, 0, 0, 0, 0, 0, 1, 1, 0, 4, 4, 5, 5, 1, 5, 0, 0, 0, 0, 1, 1, 4, 5, 5, 1, 4, 0, 5, 5, 5, 5, 0, 0, 0, 1, 1, 0, 0, 0, 1, 4, 5, 5, 5, 4, 5, 5, 0, 5, 0, 0, 0, 0, 1, 4, 5, 5, 5, 4, 5, 5, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 1, 4, 5, 5, 5, 4, 5, 5, 0, 5, 0, 0, 1, 1, 4, 5, 5, 1, 4, 0, 5, 5, 5, 5, 0, 0, 1, 1 }; static const short _mmp_parser_index_offsets[] = { 0, 0, 6, 11, 14, 16, 18, 20, 22, 24, 26, 28, 30, 34, 39, 41, 43, 45, 47, 49, 53, 58, 60, 62, 64, 66, 68, 70, 72, 78, 84, 86, 88, 90, 92, 97, 102, 107, 109, 111, 113, 117, 122, 124, 126, 128, 133, 138, 143, 145, 147, 149, 151, 156, 161, 169, 179, 189, 194, 203, 208, 210, 212, 214, 219, 224, 226, 228, 230, 232, 237, 242, 244, 246, 248, 250, 252, 254, 256, 258, 263, 268, 273, 275, 277, 281, 284, 287, 290, 300, 310, 319, 328, 331, 333, 335, 337, 339, 341, 345, 350, 356, 361, 366, 369, 375, 378, 382, 387, 389, 391, 393, 395, 397, 401, 406, 408, 410, 412, 414, 416, 418, 420, 422, 427, 430, 442, 446, 450, 454, 459, 465, 471, 477, 483, 490, 496, 501, 507, 515, 519, 526, 532, 540, 544, 551, 557, 565, 569, 576, 582, 588, 598, 601, 612, 623, 633, 640, 644, 651, 658, 665, 669, 676, 683, 690, 694, 701, 708, 715, 721, 725, 729, 733, 741, 746, 752, 759, 766, 769, 776, 780, 784, 788, 792, 796, 800, 804, 808, 812, 817, 823, 829, 835, 842, 848, 851, 858, 864, 868, 872, 876, 882, 891, 902, 913, 919, 927, 931, 939, 945, 953, 957, 965, 971, 979, 983, 991, 997, 1005, 1009, 1017, 1023, 1029, 1037, 1041, 1049, 1055, 1061, 1069, 1073, 1081, 1087, 1095, 1099, 1107, 1113, 1121, 1125, 1133, 1139, 1145, 1153, 1157, 1165, 1171, 1177, 1180, 1189, 1195, 1199, 1206, 1215, 1221, 1225, 1232, 1241, 1247, 1251, 1258, 1267, 1273, 1277, 1284, 1293, 1299, 1303, 1310, 1319, 1325, 1329, 1336, 1345, 1351, 1355, 1362, 1371, 1377, 1381, 1388, 1397, 1403, 1407, 1414, 1424, 1428, 1432, 1436, 1440, 1444, 1451, 1458, 1461, 1471, 1480, 1491, 1502, 1508, 1518, 1522, 1526, 1530, 1534, 1540, 1546, 1555, 1566, 1577, 1583, 1593, 1596, 1607, 1618, 1628, 1638, 1642, 1646, 1650, 1655, 1663, 1667, 1671, 1675, 1680, 1689, 1700, 1711, 1721, 1730, 1741, 1752, 1755, 1765, 1769, 1773, 1777, 1781, 1786, 1795, 1806, 1817, 1827, 1836, 1847, 1858, 1861, 1871, 1875, 1879, 1883, 1887, 1891, 1895, 1899, 1903, 1908, 1917, 1928, 1939, 1949, 1958, 1969, 1980, 1983, 1993, 1997, 2001, 2006, 2012, 2021, 2032, 2043, 2049, 2059, 2062, 2073, 2084, 2094, 2104, 2107, 2108, 2121 }; static const short _mmp_parser_indicies[] = { 2, 0, 3, 4, 0, 1, 2, 0, 3, 0, 1, 1, 2, 3, 5, 1, 6, 1, 7, 1, 8, 1, 9, 1, 10, 1, 11, 1, 12, 1, 13, 13, 13, 1, 13, 13, 13, 14, 1, 15, 1, 16, 1, 17, 1, 18, 1, 19, 1, 20, 20, 20, 1, 20, 20, 21, 20, 1, 22, 1, 23, 1, 24, 1, 25, 1, 26, 1, 27, 1, 28, 1, 29, 28, 30, 31, 28, 1, 29, 32, 33, 34, 32, 1, 35, 1, 36, 1, 37, 1, 38, 1, 39, 39, 40, 39, 1, 41, 41, 42, 41, 1, 42, 42, 43, 42, 1, 44, 1, 45, 1, 46, 1, 47, 47, 47, 1, 47, 47, 48, 47, 1, 49, 1, 50, 1, 51, 1, 51, 51, 52, 51, 1, 53, 52, 54, 52, 1, 56, 55, 57, 55, 1, 58, 1, 59, 1, 60, 1, 61, 1, 62, 62, 63, 62, 1, 64, 64, 65, 64, 1, 65, 65, 66, 65, 66, 66, 66, 1, 67, 67, 68, 70, 67, 69, 70, 70, 70, 1, 71, 71, 72, 70, 71, 69, 70, 70, 70, 1, 74, 73, 75, 73, 1, 74, 73, 75, 76, 73, 76, 76, 76, 1, 78, 77, 79, 77, 1, 80, 1, 81, 1, 82, 1, 83, 82, 84, 82, 1, 86, 85, 87, 85, 1, 88, 1, 89, 1, 90, 1, 91, 1, 91, 91, 92, 91, 1, 92, 92, 93, 92, 1, 94, 1, 95, 1, 96, 1, 97, 1, 98, 1, 99, 1, 100, 1, 101, 1, 101, 101, 102, 101, 1, 103, 102, 104, 102, 1, 106, 105, 107, 105, 1, 108, 1, 109, 1, 110, 110, 110, 1, 1, 103, 104, 1, 83, 84, 1, 74, 75, 112, 111, 113, 115, 111, 114, 115, 115, 115, 1, 74, 116, 75, 115, 116, 114, 115, 115, 115, 1, 114, 114, 115, 114, 114, 115, 115, 115, 1, 69, 69, 70, 69, 69, 70, 70, 70, 1, 1, 53, 54, 117, 1, 118, 1, 119, 1, 120, 1, 121, 1, 122, 122, 122, 1, 122, 122, 122, 123, 1, 125, 124, 126, 124, 127, 1, 129, 128, 130, 128, 1, 129, 131, 33, 131, 1, 1, 129, 130, 125, 124, 126, 124, 127, 1, 1, 29, 30, 132, 132, 132, 1, 132, 132, 132, 133, 1, 134, 1, 135, 1, 136, 1, 137, 1, 138, 1, 139, 139, 139, 1, 139, 139, 140, 139, 1, 141, 1, 142, 1, 143, 1, 144, 1, 145, 1, 146, 1, 147, 1, 148, 1, 29, 148, 30, 148, 1, 149, 151, 150, 149, 153, 152, 154, 155, 156, 157, 158, 159, 160, 152, 150, 149, 151, 161, 150, 149, 151, 162, 150, 149, 151, 163, 150, 149, 151, 164, 164, 150, 149, 151, 164, 164, 165, 150, 149, 151, 166, 166, 167, 150, 149, 151, 168, 169, 168, 150, 149, 151, 169, 169, 170, 150, 149, 151, 171, 172, 171, 173, 150, 149, 151, 171, 172, 171, 150, 149, 151, 174, 174, 150, 149, 151, 175, 176, 175, 150, 149, 151, 176, 177, 178, 176, 179, 150, 149, 151, 179, 150, 149, 151, 180, 181, 180, 182, 150, 149, 151, 180, 181, 180, 150, 149, 151, 183, 184, 185, 183, 186, 150, 149, 151, 186, 150, 149, 151, 187, 188, 187, 189, 150, 149, 151, 187, 188, 187, 150, 149, 151, 190, 191, 192, 190, 193, 150, 149, 151, 193, 150, 149, 151, 194, 195, 194, 196, 150, 149, 151, 194, 195, 194, 150, 149, 198, 197, 199, 197, 150, 149, 198, 197, 199, 200, 197, 200, 200, 200, 150, 149, 198, 199, 149, 202, 201, 203, 205, 201, 204, 205, 205, 205, 150, 149, 198, 206, 199, 205, 206, 204, 205, 205, 205, 150, 149, 151, 204, 205, 204, 204, 205, 205, 205, 150, 149, 151, 194, 195, 194, 196, 150, 149, 151, 207, 150, 149, 151, 208, 209, 208, 210, 150, 149, 151, 208, 209, 208, 210, 150, 149, 151, 187, 188, 187, 189, 150, 149, 151, 211, 150, 149, 151, 212, 213, 212, 214, 150, 149, 151, 212, 213, 212, 214, 150, 149, 151, 180, 181, 180, 182, 150, 149, 151, 215, 150, 149, 151, 216, 217, 216, 218, 150, 149, 151, 216, 217, 216, 218, 150, 149, 151, 171, 172, 171, 173, 150, 149, 151, 166, 166, 167, 150, 149, 151, 219, 150, 149, 151, 220, 150, 149, 151, 221, 150, 149, 151, 223, 222, 222, 222, 222, 150, 149, 151, 224, 224, 150, 149, 151, 224, 224, 225, 150, 149, 227, 226, 228, 226, 229, 150, 149, 231, 230, 232, 230, 225, 150, 149, 231, 232, 149, 227, 226, 228, 226, 229, 150, 149, 151, 233, 150, 149, 151, 234, 150, 149, 151, 235, 150, 149, 151, 236, 150, 149, 151, 237, 150, 149, 151, 238, 150, 149, 151, 239, 150, 149, 151, 240, 150, 149, 151, 241, 150, 149, 151, 242, 242, 150, 149, 151, 242, 242, 243, 150, 149, 151, 244, 244, 245, 150, 149, 151, 244, 244, 246, 150, 149, 248, 247, 249, 247, 250, 150, 149, 248, 247, 249, 247, 150, 149, 248, 249, 149, 248, 247, 249, 247, 250, 150, 149, 151, 244, 244, 245, 150, 149, 151, 251, 150, 149, 151, 252, 150, 149, 151, 253, 150, 149, 151, 253, 254, 253, 150, 149, 151, 254, 255, 254, 255, 255, 255, 150, 149, 151, 256, 257, 259, 256, 258, 259, 259, 259, 150, 149, 151, 260, 261, 259, 260, 258, 259, 259, 259, 150, 149, 151, 262, 263, 262, 150, 149, 151, 263, 264, 264, 263, 265, 150, 149, 151, 266, 150, 149, 151, 267, 268, 269, 267, 266, 150, 149, 151, 270, 271, 270, 150, 149, 151, 272, 273, 273, 272, 274, 150, 149, 151, 275, 150, 149, 151, 276, 277, 278, 276, 275, 150, 149, 151, 279, 280, 279, 150, 149, 151, 281, 282, 282, 281, 283, 150, 149, 151, 284, 150, 149, 151, 285, 286, 287, 285, 284, 150, 149, 151, 288, 289, 288, 150, 149, 151, 290, 291, 291, 290, 292, 150, 149, 151, 293, 150, 149, 151, 294, 295, 296, 294, 293, 150, 149, 151, 297, 298, 297, 150, 149, 151, 299, 300, 299, 150, 149, 151, 300, 301, 301, 300, 302, 150, 149, 151, 303, 150, 149, 151, 304, 305, 306, 304, 303, 150, 149, 151, 307, 308, 307, 150, 149, 151, 309, 310, 309, 150, 149, 151, 310, 311, 311, 310, 312, 150, 149, 151, 313, 150, 149, 151, 314, 315, 316, 314, 313, 150, 149, 151, 317, 318, 317, 150, 149, 151, 319, 320, 320, 319, 321, 150, 149, 151, 322, 150, 149, 151, 323, 324, 325, 323, 322, 150, 149, 151, 326, 327, 326, 150, 149, 151, 328, 329, 329, 328, 330, 150, 149, 151, 331, 150, 149, 151, 332, 333, 334, 332, 331, 150, 149, 151, 335, 336, 335, 150, 149, 151, 337, 338, 337, 150, 149, 151, 338, 339, 339, 338, 340, 150, 149, 151, 341, 150, 149, 151, 342, 343, 344, 342, 341, 150, 149, 151, 345, 346, 345, 150, 149, 348, 347, 349, 347, 150, 149, 348, 349, 149, 151, 342, 343, 350, 350, 342, 344, 150, 149, 151, 351, 351, 352, 150, 149, 151, 352, 150, 149, 151, 342, 343, 342, 352, 150, 149, 151, 332, 333, 353, 353, 332, 334, 150, 149, 151, 354, 354, 355, 150, 149, 151, 355, 150, 149, 151, 332, 333, 332, 355, 150, 149, 151, 323, 324, 356, 356, 323, 325, 150, 149, 151, 357, 357, 358, 150, 149, 151, 358, 150, 149, 151, 323, 324, 323, 358, 150, 149, 151, 314, 315, 359, 359, 314, 316, 150, 149, 151, 360, 360, 361, 150, 149, 151, 361, 150, 149, 151, 314, 315, 314, 361, 150, 149, 151, 304, 305, 362, 362, 304, 306, 150, 149, 151, 363, 363, 364, 150, 149, 151, 364, 150, 149, 151, 304, 305, 304, 364, 150, 149, 151, 294, 295, 365, 365, 294, 296, 150, 149, 151, 366, 366, 367, 150, 149, 151, 367, 150, 149, 151, 294, 295, 294, 367, 150, 149, 151, 285, 286, 368, 368, 285, 287, 150, 149, 151, 369, 369, 370, 150, 149, 151, 370, 150, 149, 151, 285, 286, 285, 370, 150, 149, 151, 276, 277, 371, 371, 276, 278, 150, 149, 151, 372, 372, 373, 150, 149, 151, 373, 150, 149, 151, 276, 277, 276, 373, 150, 149, 151, 267, 268, 374, 374, 267, 269, 150, 149, 151, 375, 375, 376, 150, 149, 151, 376, 150, 149, 151, 267, 268, 267, 376, 150, 149, 151, 258, 259, 258, 258, 259, 259, 259, 150, 149, 151, 377, 150, 149, 151, 378, 150, 149, 151, 379, 150, 149, 151, 380, 150, 149, 151, 381, 150, 149, 383, 382, 384, 385, 382, 150, 149, 387, 386, 388, 389, 386, 150, 149, 387, 388, 149, 151, 390, 391, 392, 390, 392, 392, 392, 150, 149, 151, 390, 392, 390, 392, 392, 392, 150, 149, 151, 393, 394, 396, 393, 395, 396, 396, 396, 150, 149, 151, 397, 391, 396, 397, 395, 396, 396, 396, 150, 149, 387, 391, 388, 391, 150, 149, 151, 395, 396, 395, 395, 396, 396, 396, 150, 149, 151, 398, 150, 149, 151, 399, 150, 149, 151, 400, 150, 149, 151, 401, 150, 149, 151, 402, 403, 402, 150, 149, 151, 404, 405, 404, 150, 149, 151, 405, 406, 405, 406, 406, 406, 150, 149, 151, 407, 408, 410, 407, 409, 410, 410, 410, 150, 149, 151, 411, 412, 410, 411, 409, 410, 410, 410, 150, 149, 414, 413, 415, 413, 150, 149, 414, 413, 415, 416, 413, 416, 416, 416, 150, 149, 414, 415, 149, 418, 417, 419, 421, 417, 420, 421, 421, 421, 150, 149, 414, 422, 415, 421, 422, 420, 421, 421, 421, 150, 149, 151, 420, 421, 420, 420, 421, 421, 421, 150, 149, 151, 409, 410, 409, 409, 410, 410, 410, 150, 149, 151, 423, 150, 149, 151, 424, 150, 149, 151, 425, 150, 149, 151, 426, 426, 150, 149, 151, 426, 427, 428, 429, 426, 150, 149, 151, 430, 150, 149, 151, 431, 150, 149, 151, 432, 150, 149, 151, 433, 433, 150, 149, 151, 433, 434, 433, 434, 434, 434, 150, 149, 151, 435, 438, 437, 435, 436, 437, 437, 437, 150, 149, 151, 439, 440, 437, 439, 436, 437, 437, 437, 150, 149, 151, 436, 437, 436, 436, 437, 437, 437, 150, 149, 151, 440, 441, 440, 441, 441, 441, 150, 149, 443, 442, 444, 446, 442, 445, 446, 446, 446, 150, 149, 448, 447, 449, 446, 447, 445, 446, 446, 446, 150, 149, 448, 449, 149, 151, 445, 446, 445, 445, 446, 446, 446, 150, 149, 151, 450, 150, 149, 151, 451, 150, 149, 151, 452, 150, 149, 151, 453, 150, 149, 151, 454, 454, 150, 149, 151, 454, 455, 454, 455, 455, 455, 150, 149, 151, 456, 459, 458, 456, 457, 458, 458, 458, 150, 149, 151, 460, 461, 458, 460, 457, 458, 458, 458, 150, 149, 151, 457, 458, 457, 457, 458, 458, 458, 150, 149, 151, 461, 462, 461, 462, 462, 462, 150, 149, 464, 463, 465, 467, 463, 466, 467, 467, 467, 150, 149, 469, 468, 470, 467, 468, 466, 467, 467, 467, 150, 149, 469, 470, 149, 151, 466, 467, 466, 466, 467, 467, 467, 150, 149, 151, 471, 150, 149, 151, 472, 150, 149, 151, 473, 150, 149, 151, 474, 150, 149, 151, 475, 150, 149, 151, 476, 150, 149, 151, 477, 150, 149, 151, 478, 150, 149, 151, 479, 479, 150, 149, 151, 479, 480, 479, 480, 480, 480, 150, 149, 151, 481, 484, 483, 481, 482, 483, 483, 483, 150, 149, 151, 485, 486, 483, 485, 482, 483, 483, 483, 150, 149, 151, 482, 483, 482, 482, 483, 483, 483, 150, 149, 151, 486, 487, 486, 487, 487, 487, 150, 149, 489, 488, 490, 492, 488, 491, 492, 492, 492, 150, 149, 494, 493, 495, 492, 493, 491, 492, 492, 492, 150, 149, 494, 495, 149, 151, 491, 492, 491, 491, 492, 492, 492, 150, 149, 151, 496, 150, 149, 151, 497, 150, 149, 151, 498, 498, 150, 149, 151, 498, 499, 498, 150, 149, 151, 499, 500, 499, 500, 500, 500, 150, 149, 151, 501, 502, 504, 501, 503, 504, 504, 504, 150, 149, 151, 505, 506, 504, 505, 503, 504, 504, 504, 150, 149, 508, 507, 509, 507, 150, 149, 508, 507, 509, 510, 507, 510, 510, 510, 150, 149, 508, 509, 149, 512, 511, 513, 515, 511, 514, 515, 515, 515, 150, 149, 508, 516, 509, 515, 516, 514, 515, 515, 515, 150, 149, 151, 514, 515, 514, 514, 515, 515, 515, 150, 149, 151, 503, 504, 503, 503, 504, 504, 504, 150, 1, 518, 517, 110, 1, 153, 152, 517, 154, 155, 156, 157, 158, 159, 160, 152, 150, 519, 153, 152, 154, 155, 156, 157, 158, 159, 160, 152, 150, 0 }; static const short _mmp_parser_trans_targs_wi[] = { 2, 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 105, 106, 29, 30, 93, 31, 32, 33, 34, 35, 36, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 92, 47, 47, 48, 49, 50, 51, 52, 53, 54, 53, 54, 55, 56, 57, 91, 55, 56, 57, 58, 59, 87, 88, 59, 59, 60, 61, 62, 63, 64, 86, 64, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 85, 81, 81, 82, 83, 84, 379, 89, 59, 87, 90, 88, 89, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 101, 102, 103, 102, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 380, 124, 380, 125, 381, 126, 170, 198, 284, 298, 314, 364, 127, 128, 129, 130, 131, 132, 169, 132, 133, 134, 135, 136, 168, 137, 137, 138, 139, 165, 140, 141, 142, 164, 142, 143, 161, 144, 145, 146, 160, 146, 147, 157, 148, 149, 150, 156, 151, 380, 152, 153, 154, 380, 152, 155, 153, 154, 158, 149, 150, 159, 162, 145, 146, 163, 166, 141, 142, 167, 171, 172, 173, 174, 180, 175, 176, 177, 380, 178, 179, 177, 380, 178, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 197, 193, 194, 380, 195, 196, 199, 200, 201, 202, 203, 204, 205, 283, 203, 204, 205, 205, 206, 207, 208, 208, 209, 210, 279, 209, 210, 210, 211, 212, 212, 213, 214, 275, 213, 214, 214, 215, 216, 216, 217, 218, 271, 217, 218, 218, 219, 220, 220, 221, 222, 267, 221, 222, 222, 223, 224, 225, 225, 226, 227, 263, 226, 227, 227, 228, 229, 230, 230, 231, 232, 259, 231, 232, 232, 233, 234, 234, 235, 236, 255, 235, 236, 236, 237, 238, 238, 239, 240, 251, 239, 240, 240, 241, 242, 243, 243, 244, 245, 247, 244, 245, 245, 380, 246, 248, 249, 250, 252, 253, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 268, 269, 270, 272, 273, 274, 276, 277, 278, 280, 281, 282, 285, 286, 287, 288, 289, 290, 380, 291, 292, 290, 380, 291, 292, 293, 296, 294, 295, 296, 297, 294, 295, 299, 300, 301, 302, 303, 304, 303, 304, 305, 306, 307, 313, 305, 306, 307, 308, 380, 309, 310, 311, 380, 309, 312, 310, 311, 315, 316, 317, 318, 319, 332, 346, 320, 321, 322, 323, 324, 325, 326, 324, 327, 325, 327, 328, 329, 380, 330, 331, 328, 329, 380, 330, 333, 334, 335, 336, 337, 338, 339, 340, 338, 341, 339, 341, 342, 343, 380, 344, 345, 342, 343, 380, 344, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 356, 359, 357, 359, 360, 361, 380, 362, 363, 360, 361, 380, 362, 365, 366, 367, 368, 369, 370, 371, 377, 369, 370, 371, 372, 380, 373, 374, 375, 380, 373, 376, 374, 375, 378, 380, 380 }; static const unsigned char _mmp_parser_trans_actions_wi[] = { 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, 43, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 169, 0, 0, 1, 0, 0, 0, 0, 0, 65, 65, 0, 0, 17, 21, 21, 0, 19, 0, 0, 0, 177, 0, 17, 0, 1, 0, 0, 0, 0, 83, 0, 0, 1, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 185, 0, 0, 1, 0, 0, 0, 0, 23, 220, 23, 0, 19, 0, 0, 0, 0, 0, 0, 0, 0, 73, 143, 73, 5, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 0, 92, 0, 201, 0, 0, 0, 69, 0, 140, 39, 0, 0, 0, 0, 0, 25, 5, 0, 0, 0, 0, 0, 5, 27, 0, 0, 0, 0, 0, 0, 29, 5, 0, 0, 0, 0, 0, 31, 5, 0, 0, 0, 0, 0, 33, 5, 0, 149, 0, 17, 134, 240, 134, 0, 19, 0, 0, 11, 101, 5, 0, 11, 98, 5, 0, 11, 95, 5, 0, 0, 0, 37, 0, 0, 0, 35, 197, 35, 5, 0, 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 153, 0, 9, 0, 0, 0, 0, 17, 21, 137, 0, 19, 0, 45, 0, 0, 104, 104, 13, 15, 107, 13, 0, 47, 0, 104, 104, 13, 15, 110, 13, 0, 49, 0, 104, 104, 13, 15, 113, 13, 0, 51, 0, 104, 104, 13, 15, 116, 13, 0, 53, 0, 0, 104, 104, 13, 15, 119, 13, 0, 55, 0, 0, 104, 104, 13, 15, 122, 13, 0, 57, 0, 104, 104, 13, 15, 125, 13, 0, 59, 0, 104, 104, 13, 15, 128, 13, 0, 61, 0, 0, 104, 104, 13, 15, 131, 13, 0, 63, 0, 173, 0, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 0, 0, 0, 0, 0, 71, 235, 71, 71, 0, 189, 0, 0, 0, 0, 17, 21, 21, 0, 19, 0, 0, 0, 0, 0, 65, 65, 0, 0, 17, 21, 21, 0, 19, 0, 0, 0, 181, 0, 17, 23, 225, 23, 0, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 21, 0, 19, 21, 0, 0, 17, 23, 205, 23, 0, 19, 0, 157, 0, 0, 0, 0, 0, 0, 17, 21, 0, 19, 21, 0, 0, 17, 23, 215, 23, 0, 19, 0, 165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 21, 0, 19, 21, 0, 0, 17, 23, 230, 23, 0, 19, 0, 193, 0, 0, 0, 0, 0, 17, 21, 21, 0, 19, 0, 0, 0, 161, 0, 17, 23, 210, 23, 0, 19, 0, 0, 89, 79 }; static const unsigned char _mmp_parser_to_state_actions[] = { 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 3, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 146, 0 }; static const unsigned char _mmp_parser_from_state_actions[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 0 }; static const short _mmp_parser_eof_trans[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 0, 0, 0, 520 }; static const int mmp_parser_start = 1; static const int mmp_parser_first_final = 379; static const int mmp_parser_error = 0; static const int mmp_parser_en_group_scanner = 380; static const int mmp_parser_en_main = 1; /* #line 111 "NanorexMMPImportExport.rl" */ // static data from class NanorexMMPImportExport char const NanorexMMPImportExport::_s_bondOrderString[NUM_BOND_TYPES] = { '1', '2', '3', 'a', 'g', 'c' }; char const NanorexMMPImportExport::_s_bondOrderNameString[NUM_BOND_TYPES][16] = { "single", "double", "triple", "aromatic", "graphitic", "carbomeric" }; char const NanorexMMPImportExport::_s_hybridizationName[8][8] = { "none", "sp", "sp2", "sp3", "X-hyb4", "X-hyb5", "X-hyb6", "X-hyb7" }; /*static*/ void NanorexMMPImportExport::SetResult(NXCommandResult& commandResult, int errCode, string const& errMsg) { commandResult.setResult(errCode); vector message; message.push_back(QObject::tr(errMsg.c_str())); commandResult.setParamVector(message); } // ............................................................................. /* static */ void NanorexMMPImportExport::ClearResult(NXCommandResult& commandResult) { commandResult.setResult((int) NX_CMD_SUCCESS); vector message; commandResult.setParamVector(message); } /* CONSTRUCTOR */ NanorexMMPImportExport::NanorexMMPImportExport() { reset(); } /* DESTRUCTOR */ NanorexMMPImportExport::~NanorexMMPImportExport() { } /* FUNCTION: reset */ void NanorexMMPImportExport::reset(void) { inputFilename.clear(); dataStoreInfo = (NXDataStoreInfo*) NULL; lineNum = 0; insideViewDataGroup = false; insideClipboardGroup = false; atomPtr = NULL; bondPtr = NULL; foundAtomList.clear(); targetAtomList.clear(); molPtr = NULL; molSetPtr = NULL; molSetPtrStack.clear(); molStyle = "def"; clipboardGroup = NULL; // defaultAtomStyle = "def"; // defaultAtomStyleStack.clear(); // ragel stack stackSize = 2; stack.clear(); stack.resize(stackSize, 0); // initialize the ragel engine /* #line 1234 "NanorexMMPImportExport.cpp" */ { cs = mmp_parser_start; top = 0; ts = 0; te = 0; act = 0; } /* #line 194 "NanorexMMPImportExport.rl" */ } /* FUNCTION: importFromFile */ NXCommandResult* NanorexMMPImportExport:: importFromFile(NXMoleculeSet *rootMoleculeSetPtr, NXDataStoreInfo *dsInfo, const std::string& theFilename, int /*frameSetId*/, int /*frameIndex*/) { reset(); bool success = true; ClearResult(commandResult); ifstream mmpfile(theFilename.c_str(), ios::in); if(!mmpfile) { populateCommandResult(&commandResult, (string("Couldn't open file: ") + theFilename) .c_str()); success = false; } else { inputFilename = theFilename; dataStoreInfo = dsInfo; success = readMMP(mmpfile, rootMoleculeSetPtr); } // Set the meta information about the data store. if (success) { dataStoreInfo->setIsSingleStructure(true); } return &commandResult; } /* FUNCTION: readMMP */ bool NanorexMMPImportExport::readMMP(istream& instream, NXMoleculeSet *rootMoleculeSetPtr) { p = RagelIstreamPtr(instream); pe = RagelIstreamPtr(instream, 0, ios::end); eof = pe; this->rootMoleculeSetPtr = rootMoleculeSetPtr; molSetPtr = NULL; // molSetPtrStack.push(molSetPtr); /// @todo handle first 'group' statement and molSetPtrStack initialization // Ragel parser implementation bool success = true; /* #line 1298 "NanorexMMPImportExport.cpp" */ { 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: _acts = _mmp_parser_actions + _mmp_parser_from_state_actions[cs]; _nacts = (unsigned int) *_acts++; while ( _nacts-- > 0 ) { switch ( *_acts++ ) { case 58: /* #line 1 "NanorexMMPImportExport.rl" */ {ts = p;} break; /* #line 1319 "NanorexMMPImportExport.cpp" */ } } _keys = _mmp_parser_trans_keys + _mmp_parser_key_offsets[cs]; _trans = _mmp_parser_index_offsets[cs]; _klen = _mmp_parser_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 = _mmp_parser_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: _trans = _mmp_parser_indicies[_trans]; _eof_trans: cs = _mmp_parser_trans_targs_wi[_trans]; if ( _mmp_parser_trans_actions_wi[_trans] == 0 ) goto _again; _acts = _mmp_parser_actions + _mmp_parser_trans_actions_wi[_trans]; _nacts = (unsigned int) *_acts++; while ( _nacts-- > 0 ) { switch ( *_acts++ ) { case 0: /* #line 24 "NanorexMMPImportExport.rl" */ {++lineNum;} break; case 2: /* #line 41 "NanorexMMPImportExport.rl" */ {intVal = intVal*10 + ((*p)-'0');} break; case 4: /* #line 46 "NanorexMMPImportExport.rl" */ {intVal2 = intVal2*10 + ((*p)-'0');} break; case 5: /* #line 49 "NanorexMMPImportExport.rl" */ {intVal=-intVal;} break; case 6: /* #line 53 "NanorexMMPImportExport.rl" */ {stringVal.clear(); /*stringVal = stringVal + fc;*/ doubleVal = HUGE_VAL;} break; case 7: /* #line 54 "NanorexMMPImportExport.rl" */ {stringVal = stringVal + (*p);} break; case 8: /* #line 55 "NanorexMMPImportExport.rl" */ {doubleVal = atof(stringVal.c_str());} break; case 9: /* #line 72 "NanorexMMPImportExport.rl" */ { charStringWithSpaceStart = p; charStringWithSpaceStop = p;} break; case 10: /* #line 74 "NanorexMMPImportExport.rl" */ { charStringWithSpaceStop = p; } break; case 11: /* #line 83 "NanorexMMPImportExport.rl" */ { int stringVal_newSize = charStringWithSpaceStop - charStringWithSpaceStart + 1; assert(stringVal_newSize >= 0); stringVal.resize(stringVal_newSize); std::copy(charStringWithSpaceStart, charStringWithSpaceStop+1, stringVal.begin()); } break; case 12: /* #line 96 "NanorexMMPImportExport.rl" */ { int stringVal2_newSize = charStringWithSpaceStop - charStringWithSpaceStart + 1; // cerr << "stringVal2_newSize = " << stringVal2_newSize << endl; if(stringVal2_newSize < 0) { cerr << "*charStringWithSpaceStart = " << *charStringWithSpaceStart << ", *charStringWithSpaceStop = " << *charStringWithSpaceStop << endl; assert(0); } stringVal2.resize(stringVal2_newSize); std::copy(charStringWithSpaceStart, charStringWithSpaceStop+1, stringVal2.begin()); } break; case 13: /* #line 29 "NanorexMMPImportExport.rl" */ { atomId = intVal; /*cerr << "atomId = " << atomId << endl;*/ } break; case 14: /* #line 34 "NanorexMMPImportExport.rl" */ { atomicNum = intVal; /*cerr << "atomId = " << atomId << endl;*/} break; case 15: /* #line 37 "NanorexMMPImportExport.rl" */ {x = intVal; } break; case 16: /* #line 38 "NanorexMMPImportExport.rl" */ {y = intVal; } break; case 17: /* #line 39 "NanorexMMPImportExport.rl" */ {z = intVal; } break; case 18: /* #line 50 "NanorexMMPImportExport.rl" */ { atomStyle = stringVal; /*cerr << "atom_style = " << stringVal << endl;*/ } break; case 19: /* #line 67 "NanorexMMPImportExport.rl" */ { newAtom(atomId, atomicNum, x, y, z, atomStyle); } break; case 20: /* #line 71 "NanorexMMPImportExport.rl" */ { newBond(stringVal, intVal); } break; case 21: /* #line 77 "NanorexMMPImportExport.rl" */ { stringVal = *p; } break; case 22: /* #line 87 "NanorexMMPImportExport.rl" */ { newBondDirection(intVal, intVal2); } break; case 23: /* #line 102 "NanorexMMPImportExport.rl" */ { // stripTrailingWhiteSpaces(stringVal); // stripTrailingWhiteSpaces(stringVal2); newAtomInfo(stringVal, stringVal2); } break; case 24: /* #line 9 "NanorexMMPImportExport.rl" */ {lineStart=p;} break; case 26: /* #line 16 "NanorexMMPImportExport.rl" */ { if(stringVal2 == "") stringVal2 = "def"; newMolecule(stringVal, stringVal2); } break; case 27: /* #line 24 "NanorexMMPImportExport.rl" */ {lineStart=p;} break; case 28: /* #line 35 "NanorexMMPImportExport.rl" */ { newChunkInfo(stringVal, stringVal2); } break; case 29: /* #line 26 "NanorexMMPImportExport.rl" */ { lineStart = p; } break; case 30: /* #line 30 "NanorexMMPImportExport.rl" */ { newViewDataGroup(); } break; case 31: /* #line 37 "NanorexMMPImportExport.rl" */ {csysViewName = stringVal;} break; case 32: /* #line 40 "NanorexMMPImportExport.rl" */ {csysQw=doubleVal;} break; case 33: /* #line 41 "NanorexMMPImportExport.rl" */ {csysQx=doubleVal;} break; case 34: /* #line 42 "NanorexMMPImportExport.rl" */ {csysQy=doubleVal;} break; case 35: /* #line 43 "NanorexMMPImportExport.rl" */ {csysQz=doubleVal;} break; case 36: /* #line 45 "NanorexMMPImportExport.rl" */ {csysScale=doubleVal;} break; case 37: /* #line 47 "NanorexMMPImportExport.rl" */ {csysPovX=doubleVal;} break; case 38: /* #line 48 "NanorexMMPImportExport.rl" */ {csysPovY=doubleVal;} break; case 39: /* #line 49 "NanorexMMPImportExport.rl" */ {csysPovZ=doubleVal;} break; case 40: /* #line 51 "NanorexMMPImportExport.rl" */ {csysZoomFactor=doubleVal;} break; case 41: /* #line 54 "NanorexMMPImportExport.rl" */ { newNamedView(csysViewName, csysQw, csysQx, csysQy, csysQz, csysScale, csysPovX, csysPovY, csysPovZ, csysZoomFactor); } break; case 42: /* #line 61 "NanorexMMPImportExport.rl" */ { stringVal2.clear(); } break; case 43: /* #line 67 "NanorexMMPImportExport.rl" */ { newMolStructGroup(stringVal, stringVal2); } break; case 44: /* #line 74 "NanorexMMPImportExport.rl" */ { end1(); } break; case 45: /* #line 78 "NanorexMMPImportExport.rl" */ { lineStart = p; } break; case 46: /* #line 83 "NanorexMMPImportExport.rl" */ { newClipboardGroup(); } break; case 47: /* #line 87 "NanorexMMPImportExport.rl" */ {lineStart=p;} break; case 48: /* #line 88 "NanorexMMPImportExport.rl" */ { stringVal.clear(); } break; case 49: /* #line 94 "NanorexMMPImportExport.rl" */ { endGroup(stringVal); } break; case 50: /* #line 98 "NanorexMMPImportExport.rl" */ {lineStart=p;} break; case 51: /* #line 108 "NanorexMMPImportExport.rl" */ { newOpenGroupInfo(stringVal, stringVal2); } break; case 52: /* #line 65 "NanorexMMPImportExport.rl" */ { kelvinTemp = intVal; } break; case 53: /* #line 79 "NanorexMMPImportExport.rl" */ { p--; { cerr << "Ragel stack prepush: top = " << top << ", stackSize = " << stackSize << endl; if(top == stackSize) { stackSize += stackSize; stack.resize(stackSize, 0); cerr << "Resized stack to " << stackSize << endl; } {stack[top++] = cs; cs = 380; goto _again;}} } break; case 54: /* #line 82 "NanorexMMPImportExport.rl" */ { p--; { cerr << "Ragel stack prepush: top = " << top << ", stackSize = " << stackSize << endl; if(top == stackSize) { stackSize += stackSize; stack.resize(stackSize, 0); cerr << "Resized stack to " << stackSize << endl; } {stack[top++] = cs; cs = 380; goto _again;}} } break; case 55: /* #line 87 "NanorexMMPImportExport.rl" */ { p--; { cerr << "Ragel stack prepush: top = " << top << ", stackSize = " << stackSize << endl; if(top == stackSize) { stackSize += stackSize; stack.resize(stackSize, 0); cerr << "Resized stack to " << stackSize << endl; } {stack[top++] = cs; cs = 380; goto _again;}} } break; case 59: /* #line 1 "NanorexMMPImportExport.rl" */ {te = p+1;} break; case 60: /* #line 131 "NanorexMMPImportExport.rl" */ {act = 12;} break; case 61: /* #line 116 "NanorexMMPImportExport.rl" */ {te = p+1;} break; case 62: /* #line 118 "NanorexMMPImportExport.rl" */ {te = p+1;{ p--; { cerr << "Ragel stack prepush: top = " << top << ", stackSize = " << stackSize << endl; if(top == stackSize) { stackSize += stackSize; stack.resize(stackSize, 0); cerr << "Resized stack to " << stackSize << endl; } {stack[top++] = cs; cs = 380; goto _again;}} }} break; case 63: /* #line 119 "NanorexMMPImportExport.rl" */ {te = p+1;} break; case 64: /* #line 120 "NanorexMMPImportExport.rl" */ {te = p+1;{{cs = stack[--top]; goto _again;}}} break; case 65: /* #line 121 "NanorexMMPImportExport.rl" */ {te = p+1;} break; case 66: /* #line 122 "NanorexMMPImportExport.rl" */ {te = p+1;} break; case 67: /* #line 123 "NanorexMMPImportExport.rl" */ {te = p+1;} break; case 68: /* #line 124 "NanorexMMPImportExport.rl" */ {te = p+1;} break; case 69: /* #line 125 "NanorexMMPImportExport.rl" */ {te = p+1;} break; case 70: /* #line 126 "NanorexMMPImportExport.rl" */ {te = p+1;} break; case 71: /* #line 129 "NanorexMMPImportExport.rl" */ {te = p+1;} break; case 72: /* #line 131 "NanorexMMPImportExport.rl" */ {te = p+1;{ cerr << lineNum << ": Syntax error or unsupported statement:\n\t"; std::copy(ts, te, std::ostream_iterator(cerr)); cerr << endl; }} break; case 73: /* #line 131 "NanorexMMPImportExport.rl" */ {te = p;p--;{ cerr << lineNum << ": Syntax error or unsupported statement:\n\t"; std::copy(ts, te, std::ostream_iterator(cerr)); cerr << endl; }} break; case 74: /* #line 1 "NanorexMMPImportExport.rl" */ { switch( act ) { case 0: {{cs = 0; goto _again;}} break; case 12: {{p = ((te))-1;} cerr << lineNum << ": Syntax error or unsupported statement:\n\t"; std::copy(ts, te, std::ostream_iterator(cerr)); cerr << endl; } break; default: break; } } break; /* #line 1736 "NanorexMMPImportExport.cpp" */ } } _again: _acts = _mmp_parser_actions + _mmp_parser_to_state_actions[cs]; _nacts = (unsigned int) *_acts++; while ( _nacts-- > 0 ) { switch ( *_acts++ ) { case 1: /* #line 40 "NanorexMMPImportExport.rl" */ {intVal=(*p)-'0';} break; case 3: /* #line 45 "NanorexMMPImportExport.rl" */ {intVal2=(*p)-'0';} break; case 25: /* #line 11 "NanorexMMPImportExport.rl" */ { stringVal2.clear(); /* 'style' string optional */ } break; case 56: /* #line 1 "NanorexMMPImportExport.rl" */ {ts = 0;} break; case 57: /* #line 1 "NanorexMMPImportExport.rl" */ {act = 0;} break; /* #line 1765 "NanorexMMPImportExport.cpp" */ } } if ( cs == 0 ) goto _out; if ( ++p != pe ) goto _resume; _test_eof: {} if ( p == eof ) { if ( _mmp_parser_eof_trans[cs] > 0 ) { _trans = _mmp_parser_eof_trans[cs] - 1; goto _eof_trans; } } _out: {} } /* #line 249 "NanorexMMPImportExport.rl" */ // End-of-parsing sanity checks if(molSetPtrStack.size() != 0) { NXLOG_WARNING("NanorexMMPImportExport", "At least one group has no matching egroup statement"); } return success; } /* FUNCTION newAtom */ void NanorexMMPImportExport::newAtom(int id, int atomicNum, int x, int y, int z, string const& style) { if(molPtr == NULL) { CSEVERE("No parent molecule for atom"); return; } // error if id was previously specified map::const_iterator atomExistsQuery = foundAtomList.find(id); if(atomExistsQuery != foundAtomList.end()) { NXLOG_SEVERE("NanorexMMPImportExport", "Atom-id " + NXUtility::itos(id) + " is repeated"); return; } atomPtr = molPtr->NewAtom(); /// @note OpenBabel assigns atomicNum to a 'char' variable so modulo 256 atomPtr->SetAtomicNum(atomicNum); /// @todo set implicit valence based on role (axis, strand etc) if(atomicNum >= 200) atomPtr->SetImplicitValence(4); NXAtomData *atomDataPtr = new NXAtomData(atomicNum); atomDataPtr->setIdx(id); atomDataPtr->setRenderStyleCode(style); assert(atomDataPtr->GetDataType() == NXAtomDataType); atomPtr->SetData(atomDataPtr); // atomic number assert(atomPtr->HasData(NXAtomDataType)); // convert to Angstroms double const LENGTH_SCALE = 1.0e-3; atomPtr->SetVector(double(x) * LENGTH_SCALE, double(y) * LENGTH_SCALE, double(z) * LENGTH_SCALE); foundAtomList[id] = atomPtr; bondPtr = NULL; CDEBUG("atom " + NXUtility::itos(atomId) + " (" + NXUtility::itos(atomicNum) + ") (" + NXUtility::itos(x) + ',' + NXUtility::itos(y) + ',' + NXUtility::itos(z) + ") " + atomStyle); } /* FUNCTION: newAtomInfo*/ void NanorexMMPImportExport::newAtomInfo(string const& key, string const& value) { if(insideViewDataGroup) return; if(atomPtr != NULL) { if(key == "atomtype") { // hybridization info if(value == "sp") atomPtr->SetHyb(1); else if(value == "sp2") atomPtr->SetHyb(2); else if(value == "sp2_g") atomPtr->SetHyb(2); else if(value == "sp3") atomPtr->SetHyb(3); else if(value == "sp3d") atomPtr->SetHyb(3); // else ignore } } CDEBUG("info atom '" + key + "' = '" + value + "'"); } /* FUNCTION: newBond */ void NanorexMMPImportExport::newBond(string const& bondType, int targetAtomId) { if(insideViewDataGroup) return; assert(molPtr != NULL && atomPtr != NULL); map::iterator targetAtomExistsQuery = foundAtomList.find(targetAtomId); if(targetAtomExistsQuery == foundAtomList.end()) { CSEVERE("**ERROR** attempting to bond to non-existent atomID " + NXUtility::itos(targetAtomId)); } else { OBAtom *const targetAtomPtr = targetAtomExistsQuery->second; // guard against duplicates // also a hack to protect against Ragel's duplicate parsing // when encountering a blank line if(molPtr->GetBond(atomPtr, targetAtomPtr) == NULL) { // bond was not previously encountered, include int atomId = ((NXAtomData*)(atomPtr->GetData(NXAtomDataType)))->getIdx(); CDEBUG("bonding atom #" + NXUtility::itos(atomId) + " to atom #" + NXUtility::itos(targetAtomId)); bondPtr = molPtr->NewBond(); bondOrder = GetBondOrderFromType(bondType); bondPtr->SetBondOrder(bondOrder); atomPtr->AddBond(bondPtr); targetAtomPtr->AddBond(bondPtr); bondPtr->SetBegin(atomPtr); bondPtr->SetEnd(targetAtomPtr); CDEBUG("bond" + bondType + " " + NXUtility::itos(targetAtomId)); } else { CSEVERE("bond to atom #" + NXUtility::itos(targetAtomId) + " already exists"); } } } /* FUNCTION: GetBondOrderFromType */ int NanorexMMPImportExport::GetBondOrderFromType(string const& type) { if(type == "1") return 1; else if(type == "2") return 2; else if(type == "3") return 3; else if(type == "a") return 4; else if(type == "c") return 5; else if (type == "g") return 6; else { return -1; } } /* FUNCTION: newBondDirection */ void NanorexMMPImportExport::newBondDirection(int atomId1, int atomId2) { /// @todo Implement post-FNANO08 // no-op for FNANO08 } /* FUNCTION: newMolecule */ void NanorexMMPImportExport::newMolecule(string const& name, string const& style) { if(insideViewDataGroup) return; atomPtr = NULL; bondPtr = NULL; molPtr = molSetPtr->newMolecule(); molPtr->SetTitle(name.c_str()); if(style == "") molStyle = "def"; else molStyle = style; CDEBUG("mol (" + name + ") " + style); } /* FUNCTION: newViewDataGroup */ void NanorexMMPImportExport::newViewDataGroup(void) { insideViewDataGroup = true; CDEBUG("[special] group (View Data)"); } void NanorexMMPImportExport:: newNamedView(std::string const& name, double const& qw, double const& qx, double const& qy, double const& qz, double const& scale, double const& povX, double const& povY, double const& povZ, double const& zoomFactor) { // No need to convert to Angstroms - already NV1's internal units double const TO_ANG = 1.0 /*1.0e-10*/; if(insideViewDataGroup) { NXNamedView view(name, NXQuaternion(qw, qx*TO_ANG, qy*TO_ANG, qz*TO_ANG), scale*TO_ANG, NXVector3d(povX*TO_ANG, povY*TO_ANG, povZ*TO_ANG), zoomFactor); if(name == "HomeView") dataStoreInfo->setHomeView(view); else if(name == "LastView") dataStoreInfo->setLastView(view); else dataStoreInfo->addOtherView(view); } CDEBUG("csys (" + name + ") " + '(' + NXUtility::dtos(qw) + ',' + NXUtility::dtos(qx) + ',' + NXUtility::dtos(qz) + ',' + NXUtility::dtos(qz) + ") " + '(' + NXUtility::dtos(scale) + ") " + '(' + NXUtility::dtos(povX) + ',' + NXUtility::dtos(povY) + ',' + NXUtility::dtos(povZ) + ") " + '(' + NXUtility::dtos(zoomFactor) + ')'); } /* FUNCTION: newMolStructGroup */ void NanorexMMPImportExport::newMolStructGroup(string const& name, string const& classification) { // if(insideClipboardGroup && molSetPtr == NULL) { // // no active top-level group // molSetPtr = new NXMoleculeSet; // molSetPtr->setTitle(name); // // dataStoreInfo->addClipboardStructure(molSetPtr); // } // if in "View Data" group, ignore // if(molSetPtr != NULL) { /*else*/ if(!insideViewDataGroup) { // if in principal molecule-set group or active clipboard group if(molSetPtr == NULL) { // must be inside principal structure group assert(!insideClipboardGroup); molSetPtr = rootMoleculeSetPtr; } // else if(!insideClipboardGroup && molSetPtr == NULL) { // // entering principal structure group // // all changes should go to supplied pointer // molSetPtr = rootMoleculeSetPtr; // } else { // If not at top-level inside principal structure group or // clipboard group, allocate new structure NXMoleculeSet *newMolSetPtr = new NXMoleculeSet; molSetPtr->addChild(newMolSetPtr); molSetPtrStack.push_back(molSetPtr); molSetPtr = newMolSetPtr; } molSetPtr->setTitle(name); molSetPtr->setGroupClassificationString(classification); } // ++molStructGroupLevel; CDEBUG("group (" + name + ") " + classification); } /* FUNCTION: newClipboardGroup */ void NanorexMMPImportExport::newClipboardGroup(void) { assert(molSetPtr == NULL); assert(molSetPtrStack.size() == 0); if(!insideClipboardGroup && clipboardGroup == (NXMoleculeSet*) NULL) { clipboardGroup = new NXMoleculeSet; clipboardGroup->setTitle("Clipboard"); molSetPtr = clipboardGroup; insideClipboardGroup = true; dataStoreInfo->setClipboardStructure(clipboardGroup); CDEBUG("[special] group (Clipboard)"); } else { CSEVERE("Redefinition of 'Clipboard' group"); } } /* FUNCTION: endGroup */ void NanorexMMPImportExport::endGroup(string const& name) { // Must ensure that molSetPtr = NULL between top-level structure groups // Top-level structure groups are defined as the principal structure group // that occurs between the "View Data" and the "Clipboard" groups in the MMP // file, and those from various top-level 'group' statements in the // "Clipboard" group string groupName; if(insideViewDataGroup) groupName = "View Data"; else if(insideClipboardGroup) groupName = (molSetPtr == NULL) ? "Clipboard" : molSetPtr->getTitle(); else groupName = molSetPtr->getTitle(); if(name != groupName) { NXLOG_WARNING("NanorexMMPImportExport", "egroup (" + name + ") attempting to close " "group (" + groupName + ')'); } if(insideViewDataGroup) { insideViewDataGroup = false; molSetPtr = NULL; } else { // non top-level structure groups in clipboard or in the // principal structure group if(molSetPtrStack.size() == 0) { molSetPtr = NULL; if(insideClipboardGroup) insideClipboardGroup = false; } else { molSetPtr = molSetPtrStack.back(); molSetPtrStack.pop_back(); } } CDEBUG("egroup (" + groupName + ')'); } /* FUNCTION: newOpenGroupInfo */ void NanorexMMPImportExport::newOpenGroupInfo(std::string const& key, std::string const& value) { /// @todo CDEBUG("info opengroup " + key + " = " + value); } /* FUNCTION: newChunkInfo */ void NanorexMMPImportExport::newChunkInfo(std::string const& key, std::string const& value) { CDEBUG("info chunk " + key + " = " + value); if(insideViewDataGroup) return; /// @todo } /* FUNCTION: end1 */ void NanorexMMPImportExport::end1(void) { /// @todo CDEBUG("end1"); } /* FUNCTION: exportToFile */ NXCommandResult* NanorexMMPImportExport:: exportToFile(NXMoleculeSet *molSetPtr, NXDataStoreInfo */*dataStoreInfo*/, const std::string& theFilename, int /*frameSetId*/, int /*frameIndex*/) { NXCommandResult *result = new NXCommandResult(); result->setResult(NX_CMD_SUCCESS); ofstream mmpfile(theFilename.c_str(), ios::out); if(!mmpfile) { populateCommandResult(result, (string("Couldn't open file: ") + theFilename) .c_str()); } else { PrintMoleculeSet(mmpfile, molSetPtr); mmpfile.close(); } return result; } /* FUNCTION: GetAtomID */ /* static */ int NanorexMMPImportExport::GetAtomID(OBAtom *atomPtr) { NXAtomData *atomIDData = dynamic_cast(atomPtr->GetData(NXAtomDataType)); int atomID = atomIDData->getIdx(); return atomID; } /* FUNCTION: GetAtomRenderStyleCode */ /* static */ string const& NanorexMMPImportExport::GetAtomRenderStyleCode(OBAtom *const atomPtr) { NXAtomData *atomDataPtr = dynamic_cast(atomPtr->GetData(NXAtomDataType)); string const& atomStyle = atomDataPtr->getRenderStyleCode(); return atomStyle; } /* FUNCTION: PrintMolecule */ /* static */ void NanorexMMPImportExport::PrintMolecule(ostream& o, OBMol *const molPtr) { set prevAtomIdx; set prevBondIdx; /// @todo - replace with simple bond count o << "mol (" << molPtr->GetTitle() << ')' << endl; OBAtomIterator atomIter; OBAtom *atomPtr = NULL; // For each atom ... for(atomPtr = molPtr->BeginAtom(atomIter); atomPtr != NULL; atomPtr = molPtr->NextAtom(atomIter)) { // ... write the 'atom' line ... int atomID = GetAtomID(atomPtr); o << "atom " << atomID << " (" << atomPtr->GetAtomicNum() << ") " << '(' << atomPtr->x() << ',' << atomPtr->y() << ',' << atomPtr->z() << ") " << GetAtomRenderStyleCode(atomPtr) << endl; if(atomPtr->GetHyb() != 0) { o << "info atom atomtype = " << _s_hybridizationName[atomPtr->GetHyb()]; } // ... write the 'bond' lines for this atom ... // ... first sort bonds by type ... OBBondIterator bondIter; OBBond *bondPtr = NULL; vector bondCategories[6]; for(bondPtr = atomPtr->BeginBond(bondIter); bondPtr != NULL; bondPtr = atomPtr->NextBond(bondIter)) { // write bond statement only if target atom was previously written OBAtom *nbrAtomPtr = bondPtr->GetNbrAtom(atomPtr); int nbrAtomID = GetAtomID(nbrAtomPtr); if(prevAtomIdx.find(nbrAtomID) != prevAtomIdx.end()) { int bondOrder = bondPtr->GetBondOrder(); bondCategories[bondOrder-1].push_back(nbrAtomID); // record bond for sanity check at end prevBondIdx.insert(bondPtr->GetIdx()); } } // ... write the bonds, one line per type ... for(int i=0; i<6; ++i) { int J = bondCategories[i].size(); if(J > 0) { o << "bond" << _s_bondOrderString[i]; for(int j=0; jNumAtoms() == prevAtomIdx.size()) debugMsg << "PASS (" << molPtr->NumAtoms() << ')' << endl; else debugMsg << "FAIL: " << molPtr->NumAtoms() << " != " << prevAtomIdx.size()<< endl; debugMsg << "# bonds check "; if(molPtr->NumBonds() == prevBondIdx.size()) debugMsg << "PASS (" << molPtr->NumBonds() << ')' << endl; else debugMsg << "FAIL: " << molPtr->NumBonds() << " != " << prevBondIdx.size()<< endl; debugMsg.flush(); NXLOG_DEBUG("NanorexMMPImportExport::PrintMoleculeSet", debugMsg.str().c_str()); } /* FUNCTION: PrintMoleculeSet */ /* static */ void NanorexMMPImportExport::PrintMoleculeSet(ostream& o, NXMoleculeSet *const molSetPtr) { // Iterate over all child molecules OBMolIterator molIter; for(molIter = molSetPtr->moleculesBegin(); molIter != molSetPtr->moleculesEnd(); ++molIter) { PrintMolecule(o, *molIter); } // Iterate over all child molecule sets NXMoleculeSetIterator molSetIter; for(molSetIter = molSetPtr->childrenBegin(); molSetIter != molSetPtr->childrenEnd(); ++molSetIter) { PrintMoleculeSet(o, *molSetIter); } } /* FUNCTION: populateCommandResult */ void NanorexMMPImportExport::populateCommandResult (NXCommandResult* result, const string& message) { result->setResult(NX_PLUGIN_REPORTS_ERROR); vector resultVector; resultVector.push_back("OpenBabelImportExport"); resultVector.push_back(message.c_str()); result->setParamVector(resultVector); } Q_EXPORT_PLUGIN2 (NanorexMMPImportExport, NanorexMMPImportExport)