1 module ddparser.gramgram; 2 3 import ddparser.gram; 4 import ddparser.write_tables; 5 import ddparser.dparse; 6 import ddparser.dparse_tables; 7 import ddparser.util; 8 import ddparser.parse; 9 import core.stdc.string; 10 import core.stdc.stdlib; 11 import std.json; 12 import std.stdio; 13 import ddparser.serialize; 14 import std.string; 15 16 17 struct GramGramParseNode_User 18 { 19 Production *p; 20 Rule *r; 21 Elem *e; 22 uint kind; 23 } 24 25 private enum commonValues = q{ 26 auto g = (cast(Grammar*)(D_PN(new_ps, pn_offset).globals)); 27 auto n0 = n_children > 0 ? ((D_PN(children[0], pn_offset))) : null; 28 auto n1 = n_children > 1 ? ((D_PN(children[1], pn_offset))) : null; 29 auto n2 = n_children > 2 ? ((D_PN(children[2], pn_offset))) : null; 30 auto n3 = n_children > 3 ? ((D_PN(children[3], pn_offset))) : null; 31 auto u0 = cast(GramGramParseNode_User*)(n_children > 0 ? &((D_PN(children[0], pn_offset)).user) : null); 32 auto u1 = cast(GramGramParseNode_User*)(n_children > 1 ? &((D_PN(children[1], pn_offset)).user) : null); 33 auto u2 = cast(GramGramParseNode_User*)(n_children > 2 ? &((D_PN(children[2], pn_offset)).user) : null); 34 auto uu = cast(GramGramParseNode_User*)&(D_PN(new_ps, pn_offset)).user; 35 }; 36 37 string dup_code(string c) 38 { 39 return c; 40 /* return cast(char*)c.toStringz(); */ 41 } 42 43 string dup_code(const char* s, const char* e) 44 { 45 return dup_str(s, e); 46 } 47 48 Grammar* createEmptyGrammar() 49 { 50 Grammar *g = new_D_Grammar(); 51 /* grammar construction options */ 52 g.set_op_priority_from_rule = 0; 53 g.right_recursive_BNF = 0; 54 g.states_for_whitespace = 1; 55 g.states_for_all_nterms = 0; 56 g.tokenizer = 0; 57 g.longest_match = 0; 58 /* grammar writing options */ 59 g.scanner_blocks = 4; 60 g.scanner_block_size = 0; 61 return g; 62 } 63 64 Grammar* grammarGrammar() 65 { 66 Grammar *g = createEmptyGrammar(); 67 68 69 initialize_productions(g); 70 71 72 // return g; 73 74 // TRACE 28 75 // add_global_code(g, _c0.start_loc.s+1, _c0.end-1, _c0.start_loc.line); 76 // TRACE 87 77 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 78 g.p = new_production(g, "grammar"); // : 0x10FC84300 79 // TRACE 95 80 g.r = new_rule(g, g.p); 81 // new_elem: 0x10FC86E40 82 // g.r = new_rule(g, g.p); // : 0x10FC84200 83 // TRACE 101 84 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 85 g.e = new_ident("top_level_statement", g.r); // new_elem: 0x10FC86DA0 86 // TRACE 159 87 star_EBNF(g); 88 // g.p = new_production(g, "grammar__2"); // : 0x10FC84100 89 // new_elem: 0x10FC86D20 90 // g.r = new_rule(g, g.p); // : 0x10FC84000 91 // new_elem: 0x10FC86D00 92 // new_elem: 0x10FC86CE0 93 // new_elem: 0x10FC86CC0 94 // g.r = new_rule(g, g.p); // : 0x10FC87F00 95 // TRACE 93 96 g.p.rules ~= g.r; 97 // TRACE 87 98 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 99 g.p = new_production(g, "top_level_statement"); // : 0x10FC87E00 100 // TRACE 95 101 g.r = new_rule(g, g.p); 102 // new_elem: 0x10FC86AC0 103 // g.r = new_rule(g, g.p); // : 0x10FC87D00 104 // TRACE 101 105 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 106 g.e = new_ident("global_code", g.r); // new_elem: 0x10FC86A20 107 // TRACE 93 108 g.p.rules ~= g.r; 109 // TRACE 95 110 g.r = new_rule(g, g.p); 111 // new_elem: 0x10FC86900 112 // g.r = new_rule(g, g.p); // : 0x10FC87C00 113 // TRACE 101 114 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 115 g.e = new_ident("production", g.r); // new_elem: 0x10FC86860 116 // TRACE 93 117 g.p.rules ~= g.r; 118 // TRACE 95 119 g.r = new_rule(g, g.p); 120 // new_elem: 0x10FC86740 121 // g.r = new_rule(g, g.p); // : 0x10FC87B00 122 // TRACE 101 123 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 124 g.e = new_ident("include_statement", g.r); // new_elem: 0x10FC866A0 125 // TRACE 93 126 g.p.rules ~= g.r; 127 // TRACE 87 128 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 129 g.p = new_production(g, "include_statement"); // : 0x10FC87A00 130 // TRACE 95 131 g.r = new_rule(g, g.p); 132 // new_elem: 0x10FC86480 133 // g.r = new_rule(g, g.p); // : 0x10FC87900 134 // TRACE 98 135 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 136 g.e = new_string(g, `'include'`, g.r); 137 // new_elem: 0x10FC863C0 138 // TRACE 101 139 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 140 g.e = new_ident("regex", g.r); // new_elem: 0x10FC86320 141 // TRACE 200 142 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 143 144 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 145 { 146 mixin(commonValues); 147 string grammar_pathname = n1.matchedString[1 .. $ - 1]; 148 if (parse_grammar(g, grammar_pathname, null) < 0) 149 d_fail("unable to parse grammar '%s'", grammar_pathname); 150 //FREE(grammar_pathname); 151 return 0; 152 }; 153 154 // TRACE 93 155 g.p.rules ~= g.r; 156 // TRACE 87 157 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 158 g.p = new_production(g, "global_code"); // : 0x10FC87500 159 // TRACE 95 160 g.r = new_rule(g, g.p); 161 // new_elem: 0x10FC860E0 162 // g.r = new_rule(g, g.p); // : 0x10FC87400 163 // TRACE 98 164 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 165 g.e = new_string(g, `'%<'`, g.r); 166 // new_elem: 0x10FC86020 167 // TRACE 101 168 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 169 g.e = new_ident("balanced_code", g.r); // new_elem: 0x10FC89F80 170 // TRACE 159 171 star_EBNF(g); 172 // g.p = new_production(g, "global_code__6"); // : 0x10FC87300 173 // new_elem: 0x10FC89F20 174 // g.r = new_rule(g, g.p); // : 0x10FC87200 175 // new_elem: 0x10FC89F00 176 // new_elem: 0x10FC89EE0 177 // new_elem: 0x10FC89EC0 178 // g.r = new_rule(g, g.p); // : 0x10FC87100 179 // TRACE 98 180 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 181 g.e = new_string(g, `'%>'`, g.r); 182 // new_elem: 0x10FC89E00 183 // TRACE 200 184 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 185 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 186 { 187 mixin(commonValues); 188 /* add_global_code(g, n0.start_loc.s+2, n2.end-2, n0.start_loc.line); */ 189 return 0; 190 }; 191 192 // TRACE 93 193 g.p.rules ~= g.r; 194 // TRACE 95 195 g.r = new_rule(g, g.p); 196 // new_elem: 0x10FC89C60 197 // g.r = new_rule(g, g.p); // : 0x10FC8B600 198 // TRACE 101 199 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 200 g.e = new_ident("curly_code", g.r); // new_elem: 0x10FC89BC0 201 // TRACE 200 202 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 203 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 204 { 205 mixin(commonValues); 206 /* add_global_code(g, n0.start_loc.s+1, n0.end-1, n0.start_loc.line); */ 207 return 0; 208 }; 209 210 // TRACE 93 211 g.p.rules ~= g.r; 212 // TRACE 95 213 g.r = new_rule(g, g.p); 214 // new_elem: 0x10FC89A20 215 // g.r = new_rule(g, g.p); // : 0x10FC8DB00 216 // TRACE 98 217 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 218 g.e = new_string(g, `'${scanner'`, g.r); 219 // new_elem: 0x10FC89960 220 // TRACE 101 221 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 222 g.e = new_ident("balanced_code", g.r); // new_elem: 0x10FC898C0 223 // TRACE 160 224 plus_EBNF(g); 225 // g.p = new_production(g, "global_code__7"); // : 0x10FC8DA00 226 // new_elem: 0x10FC89860 227 // g.r = new_rule(g, g.p); // : 0x10FC8D900 228 // new_elem: 0x10FC89840 229 // new_elem: 0x10FC89800 230 // new_elem: 0x10FC897E0 231 // g.r = new_rule(g, g.p); // : 0x10FC8D800 232 // TRACE 98 233 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 234 g.e = new_string(g, `'}'`, g.r); 235 // new_elem: 0x10FC89720 236 // TRACE 200 237 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 238 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 239 { 240 mixin(commonValues); 241 242 g.scanner.code = n1.matchedString; 243 g.scanner.line = n0.start_loc.line; 244 245 return 0; 246 }; 247 248 // TRACE 93 249 g.p.rules ~= g.r; 250 // TRACE 95 251 g.r = new_rule(g, g.p); 252 // new_elem: 0x10FC89580 253 // g.r = new_rule(g, g.p); // : 0x10FC8FB00 254 // TRACE 98 255 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 256 g.e = new_string(g, `'${declare'`, g.r); 257 // new_elem: 0x10FC894C0 258 // TRACE 101 259 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 260 g.e = new_ident("declarationtype", g.r); // new_elem: 0x10FC89420 261 // TRACE 101 262 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 263 g.e = new_ident("identifier", g.r); // new_elem: 0x10FC89360 264 // TRACE 159 265 star_EBNF(g); 266 // g.p = new_production(g, "global_code__8"); // : 0x10FC8FA00 267 // new_elem: 0x10FC89300 268 // g.r = new_rule(g, g.p); // : 0x10FC8F900 269 // new_elem: 0x10FC892E0 270 // new_elem: 0x10FC892C0 271 // new_elem: 0x10FC892A0 272 // g.r = new_rule(g, g.p); // : 0x10FC8F800 273 // TRACE 98 274 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 275 g.e = new_string(g, `'}'`, g.r); 276 // new_elem: 0x10FC891E0 277 // TRACE 200 278 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 279 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 280 { 281 mixin(commonValues); 282 283 if (!d_get_number_of_children(n2)) 284 add_declaration(g, n2.matchedString, cast(DeclarationKind)u1.kind, n2.start_loc.line); 285 else { 286 int i, n = d_get_number_of_children(n2); 287 for (i = 0; i < n; i++) { 288 D_ParseNode *pn = d_get_child(n2, i); 289 add_declaration(g, pn.matchedString, cast(DeclarationKind)u1.kind, pn.start_loc.line); 290 291 } 292 } 293 return 0; 294 }; 295 296 // TRACE 93 297 g.p.rules ~= g.r; 298 // TRACE 95 299 g.r = new_rule(g, g.p); 300 // new_elem: 0x10FC89040 301 // g.r = new_rule(g, g.p); // : 0x10FC91100 302 // TRACE 98 303 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 304 g.e = new_string(g, `'${token'`, g.r); 305 // new_elem: 0x10FC92F80 306 // TRACE 101 307 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 308 g.e = new_ident("token_identifier", g.r); // new_elem: 0x10FC92EE0 309 // TRACE 160 310 plus_EBNF(g); 311 // g.p = new_production(g, "global_code__9"); // : 0x10FC91000 312 // new_elem: 0x10FC92E60 313 // g.r = new_rule(g, g.p); // : 0x10FC94F00 314 // new_elem: 0x10FC92E40 315 // new_elem: 0x10FC92DE0 316 // new_elem: 0x10FC92DC0 317 // g.r = new_rule(g, g.p); // : 0x10FC94E00 318 // TRACE 98 319 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 320 g.e = new_string(g, `'}'`, g.r); 321 // new_elem: 0x10FC92D00 322 // TRACE 93 323 g.p.rules ~= g.r; 324 // TRACE 95 325 g.r = new_rule(g, g.p); 326 // new_elem: 0x10FC92BE0 327 // g.r = new_rule(g, g.p); // : 0x10FC94D00 328 // TRACE 98 329 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 330 g.e = new_string(g, `'${pass'`, g.r); 331 // new_elem: 0x10FC92B20 332 // TRACE 101 333 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 334 g.e = new_ident("identifier", g.r); // new_elem: 0x10FC92A80 335 // TRACE 101 336 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 337 g.e = new_ident("pass_types", g.r); // new_elem: 0x10FC929E0 338 // TRACE 98 339 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 340 g.e = new_string(g, `'}'`, g.r); 341 // new_elem: 0x10FC92920 342 // TRACE 200 343 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 344 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 345 { 346 mixin(commonValues); 347 add_pass(g, n1.matchedString, u2.kind, n1.start_loc.line); 348 349 return 0; 350 }; 351 352 // TRACE 93 353 g.p.rules ~= g.r; 354 // TRACE 87 355 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 356 g.p = new_production(g, "pass_types"); // : 0x10FC94000 357 // TRACE 95 358 g.r = new_rule(g, g.p); 359 // new_elem: 0x10FC926E0 360 // g.r = new_rule(g, g.p); // : 0x10FC96F00 361 // TRACE 93 362 g.p.rules ~= g.r; 363 // TRACE 95 364 g.r = new_rule(g, g.p); 365 // new_elem: 0x10FC925C0 366 // g.r = new_rule(g, g.p); // : 0x10FC96E00 367 // TRACE 101 368 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 369 g.e = new_ident("pass_type", g.r); // new_elem: 0x10FC92520 370 // TRACE 101 371 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 372 g.e = new_ident("pass_types", g.r); // new_elem: 0x10FC92480 373 // TRACE 200 374 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 375 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 376 { 377 mixin(commonValues); 378 uu.kind = u0.kind | u1.kind; 379 return 0; 380 }; 381 382 // TRACE 93 383 g.p.rules ~= g.r; 384 // TRACE 87 385 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 386 g.p = new_production(g, "pass_type"); // : 0x10FC96B00 387 // TRACE 95 388 g.r = new_rule(g, g.p); 389 // new_elem: 0x10FC92240 390 // g.r = new_rule(g, g.p); // : 0x10FC96A00 391 // TRACE 98 392 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 393 g.e = new_string(g, `'preorder'`, g.r); 394 // new_elem: 0x10FC92180 395 // TRACE 200 396 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 397 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 398 { 399 mixin(commonValues); 400 uu.kind |= D_PASS_PRE_ORDER; 401 return 0; 402 }; 403 404 // TRACE 93 405 g.p.rules ~= g.r; 406 // TRACE 95 407 g.r = new_rule(g, g.p); 408 // new_elem: 0x10FC97FE0 409 // g.r = new_rule(g, g.p); // : 0x10FC96700 410 // TRACE 98 411 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 412 g.e = new_string(g, `'postorder'`, g.r); 413 // new_elem: 0x10FC97F20 414 // TRACE 200 415 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 416 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 417 { 418 mixin(commonValues); 419 uu.kind |= D_PASS_POST_ORDER; 420 return 0; 421 }; 422 423 // TRACE 93 424 g.p.rules ~= g.r; 425 // TRACE 95 426 g.r = new_rule(g, g.p); 427 // new_elem: 0x10FC97D80 428 // g.r = new_rule(g, g.p); // : 0x10FC96400 429 // TRACE 98 430 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 431 g.e = new_string(g, `'manual'`, g.r); 432 // new_elem: 0x10FC97CC0 433 // TRACE 200 434 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 435 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 436 { 437 mixin(commonValues); 438 uu.kind |= D_PASS_MANUAL; 439 return 0; 440 }; 441 442 // TRACE 93 443 g.p.rules ~= g.r; 444 // TRACE 95 445 g.r = new_rule(g, g.p); 446 // new_elem: 0x10FC97B20 447 // g.r = new_rule(g, g.p); // : 0x10FC96100 448 // TRACE 98 449 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 450 g.e = new_string(g, `'for_all'`, g.r); 451 // new_elem: 0x10FC97A60 452 // TRACE 200 453 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 454 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 455 { 456 mixin(commonValues); 457 uu.kind |= D_PASS_FOR_ALL; 458 return 0; 459 }; 460 461 // TRACE 93 462 g.p.rules ~= g.r; 463 // TRACE 95 464 g.r = new_rule(g, g.p); 465 // new_elem: 0x10FC978C0 466 // g.r = new_rule(g, g.p); // : 0x10FC99E00 467 // TRACE 98 468 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 469 g.e = new_string(g, `'for_undefined'`, g.r); 470 // new_elem: 0x10FC97800 471 // TRACE 200 472 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 473 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 474 { 475 mixin(commonValues); 476 uu.kind |= D_PASS_FOR_UNDEFINED; 477 return 0; 478 }; 479 480 // TRACE 93 481 g.p.rules ~= g.r; 482 // TRACE 87 483 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 484 g.p = new_production(g, "declarationtype"); // : 0x10FC99B00 485 // TRACE 95 486 g.r = new_rule(g, g.p); 487 // new_elem: 0x10FC975A0 488 // g.r = new_rule(g, g.p); // : 0x10FC99A00 489 // TRACE 98 490 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 491 g.e = new_string(g, `'tokenize'`, g.r); 492 // new_elem: 0x10FC974E0 493 // TRACE 200 494 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 495 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 496 { 497 mixin(commonValues); 498 uu.kind = DeclarationKind.DECLARE_TOKENIZE; 499 return 0; 500 }; 501 502 // TRACE 93 503 g.p.rules ~= g.r; 504 // TRACE 95 505 g.r = new_rule(g, g.p); 506 // new_elem: 0x10FC97340 507 // g.r = new_rule(g, g.p); // : 0x10FC99600 508 // TRACE 98 509 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 510 g.e = new_string(g, `'longest_match'`, g.r); 511 // new_elem: 0x10FC97280 512 // TRACE 200 513 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 514 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 515 { 516 mixin(commonValues); 517 uu.kind = DeclarationKind.DECLARE_LONGEST_MATCH; 518 return 0; 519 }; 520 521 // TRACE 93 522 g.p.rules ~= g.r; 523 // TRACE 95 524 g.r = new_rule(g, g.p); 525 // new_elem: 0x10FC970E0 526 // g.r = new_rule(g, g.p); // : 0x10FC99300 527 // TRACE 98 528 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 529 g.e = new_string(g, `'whitespace'`, g.r); 530 // new_elem: 0x10FC97020 531 // TRACE 200 532 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 533 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 534 { 535 mixin(commonValues); 536 uu.kind = DeclarationKind.DECLARE_WHITESPACE; 537 return 0; 538 }; 539 540 // TRACE 93 541 g.p.rules ~= g.r; 542 // TRACE 95 543 g.r = new_rule(g, g.p); 544 // new_elem: 0x10FC9BE80 545 // g.r = new_rule(g, g.p); // : 0x10FC99000 546 // TRACE 98 547 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 548 g.e = new_string(g, `'all_matches'`, g.r); 549 // new_elem: 0x10FC9BDC0 550 // TRACE 200 551 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 552 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 553 { 554 mixin(commonValues); 555 uu.kind = DeclarationKind.DECLARE_ALL_MATCHES; 556 return 0; 557 }; 558 559 // TRACE 93 560 g.p.rules ~= g.r; 561 // TRACE 95 562 g.r = new_rule(g, g.p); 563 // new_elem: 0x10FC9BC20 564 // g.r = new_rule(g, g.p); // : 0x10FC9DD00 565 // TRACE 98 566 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 567 g.e = new_string(g, `'set_op_priority_from_rule'`, g.r); 568 // new_elem: 0x10FC9BB40 569 // TRACE 200 570 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 571 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 572 { 573 mixin(commonValues); 574 uu.kind = DeclarationKind.DECLARE_SET_OP_PRIORITY; 575 return 0; 576 }; 577 578 // TRACE 93 579 g.p.rules ~= g.r; 580 // TRACE 95 581 g.r = new_rule(g, g.p); 582 // new_elem: 0x10FC9B9A0 583 // g.r = new_rule(g, g.p); // : 0x10FC9DA00 584 // TRACE 98 585 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 586 g.e = new_string(g, `'all_subparsers'`, g.r); 587 // new_elem: 0x10FC9B8E0 588 // TRACE 200 589 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 590 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 591 { 592 mixin(commonValues); 593 uu.kind = DeclarationKind.DECLARE_STATES_FOR_ALL_NTERMS; 594 return 0; 595 }; 596 597 // TRACE 93 598 g.p.rules ~= g.r; 599 // TRACE 95 600 g.r = new_rule(g, g.p); 601 // new_elem: 0x10FC9B740 602 // g.r = new_rule(g, g.p); // : 0x10FC9D700 603 // TRACE 98 604 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 605 g.e = new_string(g, `'subparser'`, g.r); 606 // new_elem: 0x10FC9B680 607 // TRACE 200 608 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 609 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 610 { 611 mixin(commonValues); 612 uu.kind = DeclarationKind.DECLARE_STATE_FOR; 613 return 0; 614 }; 615 616 // TRACE 93 617 g.p.rules ~= g.r; 618 // TRACE 95 619 g.r = new_rule(g, g.p); 620 // new_elem: 0x10FC9B4E0 621 // g.r = new_rule(g, g.p); // : 0x10FC9D400 622 // TRACE 98 623 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 624 g.e = new_string(g, `'save_parse_tree'`, g.r); 625 // new_elem: 0x10FC9B400 626 // TRACE 200 627 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 628 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 629 { 630 mixin(commonValues); 631 uu.kind = DeclarationKind.DECLARE_SAVE_PARSE_TREE; 632 return 0; 633 }; 634 635 // TRACE 93 636 g.p.rules ~= g.r; 637 // TRACE 87 638 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 639 g.p = new_production(g, "token_identifier"); // : 0x10FC9D100 640 // TRACE 95 641 g.r = new_rule(g, g.p); 642 // new_elem: 0x10FC9B160 643 // g.r = new_rule(g, g.p); // : 0x10FC9D000 644 // TRACE 101 645 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 646 g.e = new_ident("identifier", g.r); // new_elem: 0x10FC9B0C0 647 // TRACE 200 648 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 649 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 650 { 651 mixin(commonValues); 652 653 new_token(g, n0.matchedString); 654 return 0; 655 }; 656 657 // TRACE 93 658 g.p.rules ~= g.r; 659 // TRACE 87 660 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 661 g.p = new_production(g, "production"); // : 0x10FC9FD00 662 // TRACE 95 663 g.r = new_rule(g, g.p); 664 // new_elem: 0x10FCA0E80 665 // g.r = new_rule(g, g.p); // : 0x10FC9FC00 666 // TRACE 101 667 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 668 g.e = new_ident("production_name", g.r); // new_elem: 0x10FCA0DE0 669 // TRACE 98 670 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 671 g.e = new_string(g, `':'`, g.r); 672 // new_elem: 0x10FCA0D00 673 // TRACE 101 674 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 675 g.e = new_ident("rules", g.r); // new_elem: 0x10FCA0C60 676 // TRACE 98 677 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 678 g.e = new_string(g, `';'`, g.r); 679 // new_elem: 0x10FCA0BA0 680 // TRACE 93 681 g.p.rules ~= g.r; 682 // TRACE 95 683 g.r = new_rule(g, g.p); 684 // new_elem: 0x10FCA0A80 685 // g.r = new_rule(g, g.p); // : 0x10FC9FB00 686 // TRACE 101 687 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 688 g.e = new_ident("production_name", g.r); // new_elem: 0x10FCA09E0 689 // TRACE 101 690 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 691 g.e = new_ident("regex_production", g.r); // new_elem: 0x10FCA0920 692 // TRACE 101 693 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 694 g.e = new_ident("rules", g.r); // new_elem: 0x10FCA0860 695 // TRACE 98 696 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 697 g.e = new_string(g, `';'`, g.r); 698 // new_elem: 0x10FCA07A0 699 // TRACE 93 700 g.p.rules ~= g.r; 701 // TRACE 95 702 g.r = new_rule(g, g.p); 703 // new_elem: 0x10FCA0680 704 // g.r = new_rule(g, g.p); // : 0x10FC9FA00 705 // TRACE 98 706 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 707 g.e = new_string(g, `';'`, g.r); 708 // new_elem: 0x10FCA05C0 709 // TRACE 93 710 g.p.rules ~= g.r; 711 // TRACE 87 712 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 713 g.p = new_production(g, "regex_production"); // : 0x10FC9F900 714 // TRACE 95 715 g.r = new_rule(g, g.p); 716 // new_elem: 0x10FCA03A0 717 // g.r = new_rule(g, g.p); // : 0x10FC9F800 718 // TRACE 98 719 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 720 g.e = new_string(g, `'::='`, g.r); 721 // new_elem: 0x10FCA02E0 722 // TRACE 200 723 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 724 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 725 { 726 mixin(commonValues); 727 728 729 g.p.regex = 1; 730 731 return 0; 732 }; 733 734 // TRACE 93 735 g.p.rules ~= g.r; 736 // TRACE 87 737 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 738 g.p = new_production(g, "production_name"); // : 0x10FC9F500 739 // TRACE 95 740 g.r = new_rule(g, g.p); 741 // new_elem: 0x10FCA0080 742 // g.r = new_rule(g, g.p); // : 0x10FC9F300 743 // TRACE 140 744 auto var0x10fc9f500 = g.p; 745 auto var0x10fc9f300 = g.r; 746 ///printf("// g.p: %p\n// g.r: %p\n", g.p, g.r); _ps.user.p = g.p; _ps.user.r = g.r; 747 g.p = new_internal_production(g, g.p); g.r = null; 748 // g.p: 0x10fc9f500 749 // g.r: 0x10fc9f300 750 // g.p = new_production(g, "production_name__17"); // : 0x10FCA2F00 751 // TRACE 95 752 g.r = new_rule(g, g.p); 753 // new_elem: 0x10FCA3F60 754 // g.r = new_rule(g, g.p); // : 0x10FCA2E00 755 // TRACE 101 756 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 757 g.e = new_ident("identifier", g.r); // new_elem: 0x10FCA3EC0 758 // TRACE 93 759 g.p.rules ~= g.r; 760 // TRACE 95 761 g.r = new_rule(g, g.p); 762 // new_elem: 0x10FCA3DA0 763 // g.r = new_rule(g, g.p); // : 0x10FCA2D00 764 // TRACE 98 765 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 766 g.e = new_string(g, `'_'`, g.r); 767 // new_elem: 0x10FCA3CE0 768 // TRACE 93 769 g.p.rules ~= g.r; 770 // TRACE 109 771 ///printf("// u1.p: %p\n// u1.r: %p\n", _c1.user.p, _c1.user.r); 772 g.e = new_elem_nterm(g.p, var0x10fc9f300); g.p = var0x10fc9f500; g.r = var0x10fc9f300; g.r.elems ~= g.e; 773 // u1.p: 0x10fc9f500 774 // u1.r: 0x10fc9f300 775 // new_elem: 0x10FCA3BE0 776 // TRACE 200 777 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 778 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 779 { 780 mixin(commonValues); 781 782 g.p = new_production(g, n0.matchedString); 783 return 0; 784 }; 785 786 // TRACE 93 787 g.p.rules ~= g.r; 788 // TRACE 87 789 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 790 g.p = new_production(g, "rules"); // : 0x10FCA2700 791 // TRACE 95 792 g.r = new_rule(g, g.p); 793 // new_elem: 0x10FCA39A0 794 // g.r = new_rule(g, g.p); // : 0x10FCA2600 795 // TRACE 101 796 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 797 g.e = new_ident("rule", g.r); // new_elem: 0x10FCA3900 798 // TRACE 140 799 auto var0x10fca2700 = g.p; 800 auto var0x10fca2600 = g.r; 801 ///printf("// g.p: %p\n// g.r: %p\n", g.p, g.r); _ps.user.p = g.p; _ps.user.r = g.r; 802 g.p = new_internal_production(g, g.p); g.r = null; 803 // g.p: 0x10fca2700 804 // g.r: 0x10fca2600 805 // g.p = new_production(g, "rules__19"); // : 0x10FCA2200 806 // TRACE 95 807 g.r = new_rule(g, g.p); 808 // new_elem: 0x10FCA37E0 809 // g.r = new_rule(g, g.p); // : 0x10FCA2100 810 // TRACE 98 811 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 812 g.e = new_string(g, `'|'`, g.r); 813 // new_elem: 0x10FCA3720 814 // TRACE 101 815 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 816 g.e = new_ident("rule", g.r); // new_elem: 0x10FCA3680 817 // TRACE 93 818 g.p.rules ~= g.r; 819 // TRACE 109 820 ///printf("// u1.p: %p\n// u1.r: %p\n", _c1.user.p, _c1.user.r); 821 g.e = new_elem_nterm(g.p, var0x10fca2600); g.p = var0x10fca2700; g.r = var0x10fca2600; g.r.elems ~= g.e; 822 // u1.p: 0x10fca2700 823 // u1.r: 0x10fca2600 824 // new_elem: 0x10FCA3580 825 // TRACE 159 826 star_EBNF(g); 827 // g.p = new_production(g, "rules__20"); // : 0x10FCA5D00 828 // new_elem: 0x10FCA3520 829 // g.r = new_rule(g, g.p); // : 0x10FCA5C00 830 // new_elem: 0x10FCA3500 831 // new_elem: 0x10FCA34E0 832 // new_elem: 0x10FCA34C0 833 // g.r = new_rule(g, g.p); // : 0x10FCA5B00 834 // TRACE 93 835 g.p.rules ~= g.r; 836 // TRACE 87 837 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 838 g.p = new_production(g, "rule"); // : 0x10FCA5A00 839 // TRACE 95 840 g.r = new_rule(g, g.p); 841 // new_elem: 0x10FCA3300 842 // g.r = new_rule(g, g.p); // : 0x10FCA5900 843 // TRACE 101 844 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 845 g.e = new_ident("new_rule", g.r); // new_elem: 0x10FCA3260 846 // TRACE 140 847 auto var0x10fca5a00 = g.p; 848 auto var0x10fca5900 = g.r; 849 ///printf("// g.p: %p\n// g.r: %p\n", g.p, g.r); _ps.user.p = g.p; _ps.user.r = g.r; 850 g.p = new_internal_production(g, g.p); g.r = null; 851 // g.p: 0x10fca5a00 852 // g.r: 0x10fca5900 853 // g.p = new_production(g, "rule__22"); // : 0x10FCA5500 854 // TRACE 95 855 g.r = new_rule(g, g.p); 856 // new_elem: 0x10FCA3140 857 // g.r = new_rule(g, g.p); // : 0x10FCA5400 858 // TRACE 140 859 auto var0x10fca5500 = g.p; 860 auto var0x10fca5400 = g.r; 861 ///printf("// g.p: %p\n// g.r: %p\n", g.p, g.r); _ps.user.p = g.p; _ps.user.r = g.r; 862 g.p = new_internal_production(g, g.p); g.r = null; 863 // g.p: 0x10fca5500 864 // g.r: 0x10fca5400 865 // g.p = new_production(g, "rule__22__23"); // : 0x10FCA5000 866 // TRACE 95 867 g.r = new_rule(g, g.p); 868 // new_elem: 0x10FCA3020 869 // g.r = new_rule(g, g.p); // : 0x10FCA6F00 870 // TRACE 101 871 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 872 g.e = new_ident("element", g.r); // new_elem: 0x10FCA7F80 873 // TRACE 101 874 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 875 g.e = new_ident("element_modifier", g.r); // new_elem: 0x10FCA7EE0 876 // TRACE 159 877 star_EBNF(g); 878 // g.p = new_production(g, "rule__22__23__24"); // : 0x10FCA6E00 879 // new_elem: 0x10FCA7E40 880 // g.r = new_rule(g, g.p); // : 0x10FCA6D00 881 // new_elem: 0x10FCA7E20 882 // new_elem: 0x10FCA7E00 883 // new_elem: 0x10FCA7DE0 884 // g.r = new_rule(g, g.p); // : 0x10FCA6C00 885 // TRACE 93 886 g.p.rules ~= g.r; 887 // TRACE 109 888 ///printf("// u1.p: %p\n// u1.r: %p\n", _c1.user.p, _c1.user.r); 889 g.e = new_elem_nterm(g.p, var0x10fca5400); g.p = var0x10fca5500; g.r = var0x10fca5400; g.r.elems ~= g.e; 890 // u1.p: 0x10fca5500 891 // u1.r: 0x10fca5400 892 // new_elem: 0x10FCA7CE0 893 // TRACE 159 894 star_EBNF(g); 895 // g.p = new_production(g, "rule__22__25"); // : 0x10FCA6800 896 // new_elem: 0x10FCA7C80 897 // g.r = new_rule(g, g.p); // : 0x10FCA6700 898 // new_elem: 0x10FCA7C60 899 // new_elem: 0x10FCA7C40 900 // new_elem: 0x10FCA7C20 901 // g.r = new_rule(g, g.p); // : 0x10FCA6600 902 // TRACE 101 903 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 904 g.e = new_ident("simple_element", g.r); // new_elem: 0x10FCA7B80 905 // TRACE 101 906 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 907 g.e = new_ident("element_modifier", g.r); // new_elem: 0x10FCA7AE0 908 // TRACE 159 909 star_EBNF(g); 910 // g.p = new_production(g, "rule__22__26"); // : 0x10FCA6500 911 // new_elem: 0x10FCA7A60 912 // g.r = new_rule(g, g.p); // : 0x10FCA6400 913 // new_elem: 0x10FCA7A40 914 // new_elem: 0x10FCA7A20 915 // new_elem: 0x10FCA7A00 916 // g.r = new_rule(g, g.p); // : 0x10FCA6300 917 // TRACE 93 918 g.p.rules ~= g.r; 919 // TRACE 109 920 ///printf("// u1.p: %p\n// u1.r: %p\n", _c1.user.p, _c1.user.r); 921 g.e = new_elem_nterm(g.p, var0x10fca5900); g.p = var0x10fca5a00; g.r = var0x10fca5900; g.r.elems ~= g.e; 922 // u1.p: 0x10fca5a00 923 // u1.r: 0x10fca5900 924 // new_elem: 0x10FCA7900 925 // TRACE 158 926 conditional_EBNF(g); 927 // g.p = new_production(g, "rule__27"); // : 0x10FCAAF00 928 // new_elem: 0x10FCA7880 929 // g.r = new_rule(g, g.p); // : 0x10FCAAE00 930 // new_elem: 0x10FCA7860 931 // g.r = new_rule(g, g.p); // : 0x10FCAAD00 932 // new_elem: 0x10FCA7840 933 // TRACE 101 934 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 935 g.e = new_ident("rule_modifier", g.r); // new_elem: 0x10FCA77A0 936 // TRACE 159 937 star_EBNF(g); 938 // g.p = new_production(g, "rule__28"); // : 0x10FCAAC00 939 // new_elem: 0x10FCA7740 940 // g.r = new_rule(g, g.p); // : 0x10FCAAB00 941 // new_elem: 0x10FCA7720 942 // new_elem: 0x10FCA7700 943 // new_elem: 0x10FCA76E0 944 // g.r = new_rule(g, g.p); // : 0x10FCAAA00 945 // TRACE 101 946 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 947 g.e = new_ident("rule_code", g.r); // new_elem: 0x10FCA7640 948 // TRACE 200 949 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 950 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 951 { 952 953 mixin(commonValues); 954 955 g.p.rules ~= g.r; 956 957 return 0; 958 }; 959 960 // TRACE 93 961 g.p.rules ~= g.r; 962 // TRACE 87 963 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 964 g.p = new_production(g, "new_rule"); // : 0x10FCAA700 965 // TRACE 95 966 g.r = new_rule(g, g.p); 967 // new_elem: 0x10FCA7400 968 // g.r = new_rule(g, g.p); // : 0x10FCAA600 969 // TRACE 200 970 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 971 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 972 { 973 mixin(commonValues); 974 975 g.r = new_rule(g, g.p); 976 return 0; 977 }; 978 979 // TRACE 93 980 g.p.rules ~= g.r; 981 // TRACE 87 982 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 983 g.p = new_production(g, "simple_element"); // : 0x10FCAA300 984 // TRACE 95 985 g.r = new_rule(g, g.p); 986 // new_elem: 0x10FCA71C0 987 // g.r = new_rule(g, g.p); // : 0x10FCAA200 988 // TRACE 101 989 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 990 g.e = new_ident("string", g.r); // new_elem: 0x10FCA7120 991 // TRACE 200 992 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 993 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 994 { 995 mixin(commonValues); 996 997 g.e = new_string(g, n0.matchedString, g.r); 998 return 0; 999 }; 1000 1001 // TRACE 93 1002 g.p.rules ~= g.r; 1003 // TRACE 95 1004 g.r = new_rule(g, g.p); 1005 // new_elem: 0x10FCAEF80 1006 // g.r = new_rule(g, g.p); // : 0x10FCADB00 1007 // TRACE 101 1008 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1009 g.e = new_ident("regex", g.r); // new_elem: 0x10FCAEEE0 1010 // TRACE 200 1011 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1012 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1013 { 1014 mixin(commonValues); 1015 1016 g.e = new_string(g, n0.matchedString, g.r); 1017 return 0; 1018 }; 1019 1020 // TRACE 93 1021 g.p.rules ~= g.r; 1022 // TRACE 95 1023 g.r = new_rule(g, g.p); 1024 // new_elem: 0x10FCAED40 1025 // g.r = new_rule(g, g.p); // : 0x10FCAD400 1026 // TRACE 101 1027 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1028 g.e = new_ident("unicode_char", g.r); // new_elem: 0x10FCAECA0 1029 // TRACE 200 1030 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1031 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1032 { 1033 mixin(commonValues); 1034 1035 g.e = new_utf8_char(g, n0.start_loc.s, n0.end, g.r); 1036 return 0; 1037 }; 1038 1039 // TRACE 93 1040 g.p.rules ~= g.r; 1041 // TRACE 95 1042 g.r = new_rule(g, g.p); 1043 // new_elem: 0x10FCAEB00 1044 // g.r = new_rule(g, g.p); // : 0x10FCB0D00 1045 // TRACE 101 1046 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1047 g.e = new_ident("identifier", g.r); // new_elem: 0x10FCAEA60 1048 // TRACE 200 1049 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1050 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1051 { 1052 mixin(commonValues); 1053 1054 g.e = new_ident(n0.matchedString, g.r); 1055 return 0; 1056 }; 1057 1058 // TRACE 93 1059 g.p.rules ~= g.r; 1060 // TRACE 95 1061 g.r = new_rule(g, g.p); 1062 // new_elem: 0x10FCAE8C0 1063 // g.r = new_rule(g, g.p); // : 0x10FCB0900 1064 // TRACE 98 1065 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1066 g.e = new_string(g, `'${scan'`, g.r); 1067 // new_elem: 0x10FCAE800 1068 // TRACE 101 1069 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1070 g.e = new_ident("balanced_code", g.r); // new_elem: 0x10FCAE760 1071 // TRACE 160 1072 plus_EBNF(g); 1073 // g.p = new_production(g, "simple_element__31"); // : 0x10FCB0800 1074 // new_elem: 0x10FCAE700 1075 // g.r = new_rule(g, g.p); // : 0x10FCB0700 1076 // new_elem: 0x10FCAE6E0 1077 // new_elem: 0x10FCAE6A0 1078 // new_elem: 0x10FCAE680 1079 // g.r = new_rule(g, g.p); // : 0x10FCB0600 1080 // TRACE 98 1081 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1082 g.e = new_string(g, `'}'`, g.r); 1083 // new_elem: 0x10FCAE5C0 1084 // TRACE 200 1085 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1086 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1087 { 1088 mixin(commonValues); 1089 1090 g.e = new_code(g, n1.matchedString, g.r); 1091 return 0; 1092 }; 1093 1094 // TRACE 93 1095 g.p.rules ~= g.r; 1096 // TRACE 95 1097 g.r = new_rule(g, g.p); 1098 // new_elem: 0x10FCAE420 1099 // g.r = new_rule(g, g.p); // : 0x10FCB2F00 1100 // TRACE 98 1101 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1102 g.e = new_string(g, `'('`, g.r); 1103 // new_elem: 0x10FCAE360 1104 // TRACE 101 1105 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1106 g.e = new_ident("new_subrule", g.r); // new_elem: 0x10FCAE2C0 1107 // TRACE 101 1108 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1109 g.e = new_ident("rules", g.r); // new_elem: 0x10FCAE220 1110 // TRACE 98 1111 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1112 g.e = new_string(g, `')'`, g.r); 1113 // new_elem: 0x10FCAE160 1114 // TRACE 200 1115 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1116 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1117 { 1118 mixin(commonValues); 1119 1120 1121 g.e = new_elem_nterm(g.p, u1.r); 1122 g.p = u1.p; 1123 g.r = u1.r; 1124 g.r.elems ~= g.e; 1125 1126 return 0; 1127 }; 1128 1129 // TRACE 93 1130 g.p.rules ~= g.r; 1131 // TRACE 87 1132 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 1133 g.p = new_production(g, "element"); // : 0x10FCB4500 1134 // TRACE 95 1135 g.r = new_rule(g, g.p); 1136 // new_elem: 0x10FCB7F20 1137 // g.r = new_rule(g, g.p); // : 0x10FCB4400 1138 // TRACE 101 1139 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1140 g.e = new_ident("simple_element", g.r); // new_elem: 0x10FCB7E80 1141 // TRACE 93 1142 g.p.rules ~= g.r; 1143 // TRACE 95 1144 g.r = new_rule(g, g.p); 1145 // new_elem: 0x10FCB7D60 1146 // g.r = new_rule(g, g.p); // : 0x10FCB4300 1147 // TRACE 101 1148 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1149 g.e = new_ident("bracket_code", g.r); // new_elem: 0x10FCB7CC0 1150 // TRACE 200 1151 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1152 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1153 { 1154 1155 mixin(commonValues); 1156 1157 Production *p = new_internal_production(g, null); 1158 Rule *r = new_rule(g, p); 1159 p.rules ~= r; 1160 r.speculative_code.code = dup_code(n0.start_loc.s + 1, n0.end - 1); 1161 r.speculative_code.line = n0.start_loc.line; 1162 g.e = new_elem_nterm(p, g.r); 1163 g.r.elems ~= g.e; 1164 1165 return 0; 1166 }; 1167 1168 // TRACE 93 1169 g.p.rules ~= g.r; 1170 // TRACE 95 1171 g.r = new_rule(g, g.p); 1172 // new_elem: 0x10FCB7B20 1173 // g.r = new_rule(g, g.p); // : 0x10FCBEB00 1174 // TRACE 101 1175 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1176 g.e = new_ident("curly_code", g.r); // new_elem: 0x10FCB7A80 1177 // TRACE 200 1178 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1179 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1180 { 1181 1182 mixin(commonValues); 1183 1184 Production *p = new_internal_production(g, null); 1185 Rule *r = new_rule(g, p); 1186 p.rules ~= r; 1187 r.final_code.code = dup_code(n0.start_loc.s + 1, n0.end - 1); 1188 r.final_code.line = n0.start_loc.line; 1189 g.e = new_elem_nterm(p, g.r); 1190 g.r.elems ~= g.e; 1191 1192 return 0; 1193 }; 1194 1195 // TRACE 93 1196 g.p.rules ~= g.r; 1197 // TRACE 87 1198 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 1199 g.p = new_production(g, "new_subrule"); // : 0x10FCC4200 1200 // TRACE 95 1201 g.r = new_rule(g, g.p); 1202 // new_elem: 0x10FCB7840 1203 // g.r = new_rule(g, g.p); // : 0x10FCC4100 1204 // TRACE 200 1205 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1206 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1207 { 1208 mixin(commonValues); 1209 1210 1211 uu.p = g.p; 1212 uu.r = g.r; 1213 g.p = new_internal_production(g, g.p); 1214 g.r = null; 1215 1216 return 0; 1217 }; 1218 1219 // TRACE 93 1220 g.p.rules ~= g.r; 1221 // TRACE 87 1222 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 1223 g.p = new_production(g, "element_modifier"); // : 0x10FCC8200 1224 // TRACE 95 1225 g.r = new_rule(g, g.p); 1226 // new_elem: 0x10FCB75A0 1227 // g.r = new_rule(g, g.p); // : 0x10FCC8100 1228 // TRACE 98 1229 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1230 g.e = new_string(g, `'$term'`, g.r); 1231 // new_elem: 0x10FCB74E0 1232 // TRACE 101 1233 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1234 g.e = new_ident("integer", g.r); // new_elem: 0x10FCB7440 1235 // TRACE 200 1236 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1237 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1238 { 1239 mixin(commonValues); 1240 1241 1242 if (g.e.kind != ElemKind.ELEM_TERM) 1243 d_fail("terminal priority on non-terminal"); 1244 g.e.term.term_priority = cast(int)strtol(n1.start_loc.s, null, 0); 1245 1246 return 0; 1247 }; 1248 1249 // TRACE 93 1250 g.p.rules ~= g.r; 1251 // TRACE 95 1252 g.r = new_rule(g, g.p); 1253 // new_elem: 0x10FCB72A0 1254 // g.r = new_rule(g, g.p); // : 0x10FCCB700 1255 // TRACE 98 1256 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1257 g.e = new_string(g, `'$name'`, g.r); 1258 // new_elem: 0x10FCB71E0 1259 // TRACE 140 1260 auto var0x10fcc8200 = g.p; 1261 auto var0x10fccb700 = g.r; 1262 ///printf("// g.p: %p\n// g.r: %p\n", g.p, g.r); _ps.user.p = g.p; _ps.user.r = g.r; 1263 g.p = new_internal_production(g, g.p); g.r = null; 1264 // g.p: 0x10fcc8200 1265 // g.r: 0x10fccb700 1266 // g.p = new_production(g, "element_modifier__35"); // : 0x10FCCB300 1267 // TRACE 95 1268 g.r = new_rule(g, g.p); 1269 // new_elem: 0x10FCB70A0 1270 // g.r = new_rule(g, g.p); // : 0x10FCCB200 1271 // TRACE 101 1272 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1273 g.e = new_ident("string", g.r); // new_elem: 0x10FCB7000 1274 // TRACE 93 1275 g.p.rules ~= g.r; 1276 // TRACE 95 1277 g.r = new_rule(g, g.p); 1278 // new_elem: 0x10FCCDEE0 1279 // g.r = new_rule(g, g.p); // : 0x10FCCB100 1280 // TRACE 101 1281 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1282 g.e = new_ident("regex", g.r); // new_elem: 0x10FCCDE40 1283 // TRACE 93 1284 g.p.rules ~= g.r; 1285 // TRACE 109 1286 ///printf("// u1.p: %p\n// u1.r: %p\n", _c1.user.p, _c1.user.r); 1287 g.e = new_elem_nterm(g.p, var0x10fccb700); g.p = var0x10fcc8200; g.r = var0x10fccb700; g.r.elems ~= g.e; 1288 // u1.p: 0x10fcc8200 1289 // u1.r: 0x10fccb700 1290 // new_elem: 0x10FCCDD40 1291 // TRACE 200 1292 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1293 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1294 { 1295 mixin(commonValues); 1296 1297 1298 if (g.e.kind != ElemKind.ELEM_TERM) 1299 d_fail("terminal name on non-terminal"); 1300 g.e.term.term_name = n1.matchedString[1 .. $ - 1]; 1301 1302 return 0; 1303 }; 1304 1305 // TRACE 93 1306 g.p.rules ~= g.r; 1307 // TRACE 95 1308 g.r = new_rule(g, g.p); 1309 // new_elem: 0x10FCCDBA0 1310 // g.r = new_rule(g, g.p); // : 0x10FCCF400 1311 // TRACE 98 1312 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1313 g.e = new_string(g, `'/i'`, g.r); 1314 // new_elem: 0x10FCCDAE0 1315 // TRACE 200 1316 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1317 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1318 { 1319 mixin(commonValues); 1320 1321 1322 if (g.e.kind != ElemKind.ELEM_TERM) 1323 d_fail("ignore-case (/i) on non-terminal"); 1324 g.e.term.ignore_case = 1; 1325 1326 return 0; 1327 }; 1328 1329 // TRACE 93 1330 g.p.rules ~= g.r; 1331 // TRACE 95 1332 g.r = new_rule(g, g.p); 1333 // new_elem: 0x10FCCD940 1334 // g.r = new_rule(g, g.p); // : 0x10FCD1B00 1335 // TRACE 98 1336 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1337 g.e = new_string(g, `'?'`, g.r); 1338 // new_elem: 0x10FCCD880 1339 // TRACE 200 1340 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1341 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1342 { 1343 mixin(commonValues); 1344 1345 conditional_EBNF(g); 1346 return 0; 1347 }; 1348 1349 // TRACE 93 1350 g.p.rules ~= g.r; 1351 // TRACE 95 1352 g.r = new_rule(g, g.p); 1353 // new_elem: 0x10FCCD6E0 1354 // g.r = new_rule(g, g.p); // : 0x10FCD1800 1355 // TRACE 98 1356 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1357 g.e = new_string(g, `'*'`, g.r); 1358 // new_elem: 0x10FCCD620 1359 // TRACE 200 1360 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1361 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1362 { 1363 mixin(commonValues); 1364 1365 star_EBNF(g); 1366 return 0; 1367 }; 1368 1369 // TRACE 93 1370 g.p.rules ~= g.r; 1371 // TRACE 95 1372 g.r = new_rule(g, g.p); 1373 // new_elem: 0x10FCCD460 1374 // g.r = new_rule(g, g.p); // : 0x10FCD1500 1375 // TRACE 98 1376 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1377 g.e = new_string(g, `'+'`, g.r); 1378 // new_elem: 0x10FCCD3A0 1379 // TRACE 200 1380 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1381 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1382 { 1383 mixin(commonValues); 1384 1385 plus_EBNF(g); 1386 return 0; 1387 }; 1388 1389 // TRACE 93 1390 g.p.rules ~= g.r; 1391 // TRACE 95 1392 g.r = new_rule(g, g.p); 1393 // new_elem: 0x10FCCD1E0 1394 // g.r = new_rule(g, g.p); // : 0x10FCD1200 1395 // TRACE 98 1396 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1397 g.e = new_string(g, `'@'`, g.r); 1398 // new_elem: 0x10FCCD120 1399 // TRACE 101 1400 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1401 g.e = new_ident("integer", g.r); // new_elem: 0x10FCCD080 1402 // TRACE 200 1403 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1404 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1405 { 1406 mixin(commonValues); 1407 1408 rep_EBNF(g, cast(int)strtol(n1.start_loc.s, null, 0), -1); 1409 return 0; 1410 }; 1411 1412 // TRACE 93 1413 g.p.rules ~= g.r; 1414 // TRACE 95 1415 g.r = new_rule(g, g.p); 1416 // new_elem: 0x10FCD3EE0 1417 // g.r = new_rule(g, g.p); // : 0x10FCD4F00 1418 // TRACE 98 1419 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1420 g.e = new_string(g, `'@'`, g.r); 1421 // new_elem: 0x10FCD3E20 1422 // TRACE 101 1423 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1424 g.e = new_ident("integer", g.r); // new_elem: 0x10FCD3D80 1425 // TRACE 98 1426 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1427 g.e = new_string(g, `':'`, g.r); 1428 // new_elem: 0x10FCD3CC0 1429 // TRACE 101 1430 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1431 g.e = new_ident("integer", g.r); // new_elem: 0x10FCD3C20 1432 // TRACE 200 1433 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1434 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1435 { 1436 mixin(commonValues); 1437 1438 rep_EBNF(g, cast(int)strtol(n1.start_loc.s, null, 0), cast(int)strtol(n3.start_loc.s, null, 0)); 1439 return 0; 1440 }; 1441 1442 // TRACE 93 1443 g.p.rules ~= g.r; 1444 // TRACE 87 1445 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 1446 g.p = new_production(g, "rule_modifier"); // : 0x10FCD4B00 1447 // TRACE 95 1448 g.r = new_rule(g, g.p); 1449 // new_elem: 0x10FCD39E0 1450 // g.r = new_rule(g, g.p); // : 0x10FCD4A00 1451 // TRACE 101 1452 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1453 g.e = new_ident("rule_assoc", g.r); // new_elem: 0x10FCD3940 1454 // TRACE 101 1455 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1456 g.e = new_ident("rule_priority", g.r); // new_elem: 0x10FCD38A0 1457 // TRACE 93 1458 g.p.rules ~= g.r; 1459 // TRACE 95 1460 g.r = new_rule(g, g.p); 1461 // new_elem: 0x10FCD3780 1462 // g.r = new_rule(g, g.p); // : 0x10FCD4900 1463 // TRACE 101 1464 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1465 g.e = new_ident("external_action", g.r); // new_elem: 0x10FCD36E0 1466 // TRACE 93 1467 g.p.rules ~= g.r; 1468 // TRACE 87 1469 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 1470 g.p = new_production(g, "rule_assoc"); // : 0x10FCD4700 1471 // TRACE 95 1472 g.r = new_rule(g, g.p); 1473 // new_elem: 0x10FCD3500 1474 // g.r = new_rule(g, g.p); // : 0x10FCD4600 1475 // TRACE 98 1476 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1477 g.e = new_string(g, `'$unary_op_right'`, g.r); 1478 // new_elem: 0x10FCD3420 1479 // TRACE 200 1480 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1481 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1482 { 1483 mixin(commonValues); 1484 1485 g.r.op_assoc = AssocKind.ASSOC_UNARY_RIGHT; 1486 return 0; 1487 }; 1488 1489 // TRACE 93 1490 g.p.rules ~= g.r; 1491 // TRACE 95 1492 g.r = new_rule(g, g.p); 1493 // new_elem: 0x10FCD3280 1494 // g.r = new_rule(g, g.p); // : 0x10FCD4300 1495 // TRACE 98 1496 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1497 g.e = new_string(g, `'$unary_op_left'`, g.r); 1498 // new_elem: 0x10FCD31C0 1499 // TRACE 200 1500 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1501 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1502 { 1503 mixin(commonValues); 1504 1505 g.r.op_assoc = AssocKind.ASSOC_UNARY_LEFT; 1506 return 0; 1507 }; 1508 1509 // TRACE 93 1510 g.p.rules ~= g.r; 1511 // TRACE 95 1512 g.r = new_rule(g, g.p); 1513 // new_elem: 0x10FCD3020 1514 // g.r = new_rule(g, g.p); // : 0x10FCD4000 1515 // TRACE 98 1516 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1517 g.e = new_string(g, `'$binary_op_right'`, g.r); 1518 // new_elem: 0x10FCD7F40 1519 // TRACE 200 1520 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1521 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1522 { 1523 mixin(commonValues); 1524 1525 g.r.op_assoc = AssocKind.ASSOC_BINARY_RIGHT; 1526 return 0; 1527 }; 1528 1529 // TRACE 93 1530 g.p.rules ~= g.r; 1531 // TRACE 95 1532 g.r = new_rule(g, g.p); 1533 // new_elem: 0x10FCD7DA0 1534 // g.r = new_rule(g, g.p); // : 0x10FCD9D00 1535 // TRACE 98 1536 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1537 g.e = new_string(g, `'$binary_op_left'`, g.r); 1538 // new_elem: 0x10FCD7CC0 1539 // TRACE 200 1540 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1541 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1542 { 1543 mixin(commonValues); 1544 1545 g.r.op_assoc = AssocKind.ASSOC_BINARY_LEFT; 1546 return 0; 1547 }; 1548 1549 // TRACE 93 1550 g.p.rules ~= g.r; 1551 // TRACE 95 1552 g.r = new_rule(g, g.p); 1553 // new_elem: 0x10FCD7B20 1554 // g.r = new_rule(g, g.p); // : 0x10FCD9A00 1555 // TRACE 98 1556 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1557 g.e = new_string(g, `'$unary_right'`, g.r); 1558 // new_elem: 0x10FCD7A60 1559 // TRACE 200 1560 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1561 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1562 { 1563 mixin(commonValues); 1564 1565 g.r.rule_assoc = AssocKind.ASSOC_UNARY_RIGHT; 1566 return 0; 1567 }; 1568 1569 // TRACE 93 1570 g.p.rules ~= g.r; 1571 // TRACE 95 1572 g.r = new_rule(g, g.p); 1573 // new_elem: 0x10FCD78C0 1574 // g.r = new_rule(g, g.p); // : 0x10FCD9700 1575 // TRACE 98 1576 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1577 g.e = new_string(g, `'$unary_left'`, g.r); 1578 // new_elem: 0x10FCD7800 1579 // TRACE 200 1580 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1581 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1582 { 1583 mixin(commonValues); 1584 1585 g.r.rule_assoc = AssocKind.ASSOC_UNARY_LEFT; 1586 return 0; 1587 }; 1588 1589 // TRACE 93 1590 g.p.rules ~= g.r; 1591 // TRACE 95 1592 g.r = new_rule(g, g.p); 1593 // new_elem: 0x10FCD7660 1594 // g.r = new_rule(g, g.p); // : 0x10FCD9400 1595 // TRACE 98 1596 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1597 g.e = new_string(g, `'$binary_right'`, g.r); 1598 // new_elem: 0x10FCD75A0 1599 // TRACE 200 1600 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1601 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1602 { 1603 mixin(commonValues); 1604 1605 g.r.rule_assoc = AssocKind.ASSOC_BINARY_RIGHT; 1606 return 0; 1607 }; 1608 1609 // TRACE 93 1610 g.p.rules ~= g.r; 1611 // TRACE 95 1612 g.r = new_rule(g, g.p); 1613 // new_elem: 0x10FCD7400 1614 // g.r = new_rule(g, g.p); // : 0x10FCD9100 1615 // TRACE 98 1616 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1617 g.e = new_string(g, `'$binary_left'`, g.r); 1618 // new_elem: 0x10FCD7340 1619 // TRACE 200 1620 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1621 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1622 { 1623 mixin(commonValues); 1624 1625 g.r.rule_assoc = AssocKind.ASSOC_BINARY_LEFT; 1626 return 0; 1627 }; 1628 1629 // TRACE 93 1630 g.p.rules ~= g.r; 1631 // TRACE 95 1632 g.r = new_rule(g, g.p); 1633 // new_elem: 0x10FCD71A0 1634 // g.r = new_rule(g, g.p); // : 0x10FCDBE00 1635 // TRACE 98 1636 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1637 g.e = new_string(g, `'$right'`, g.r); 1638 // new_elem: 0x10FCD70E0 1639 // TRACE 200 1640 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1641 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1642 { 1643 mixin(commonValues); 1644 1645 g.r.rule_assoc = AssocKind.ASSOC_NARY_RIGHT; 1646 return 0; 1647 }; 1648 1649 // TRACE 93 1650 g.p.rules ~= g.r; 1651 // TRACE 95 1652 g.r = new_rule(g, g.p); 1653 // new_elem: 0x10FCDCF40 1654 // g.r = new_rule(g, g.p); // : 0x10FCDBB00 1655 // TRACE 98 1656 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1657 g.e = new_string(g, `'$left'`, g.r); 1658 // new_elem: 0x10FCDCE80 1659 // TRACE 200 1660 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1661 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1662 { 1663 mixin(commonValues); 1664 1665 g.r.rule_assoc = AssocKind.ASSOC_NARY_LEFT; 1666 return 0; 1667 }; 1668 1669 // TRACE 93 1670 g.p.rules ~= g.r; 1671 // TRACE 87 1672 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 1673 g.p = new_production(g, "rule_priority"); // : 0x10FCDB700 1674 // TRACE 95 1675 g.r = new_rule(g, g.p); 1676 // new_elem: 0x10FCDCC40 1677 // g.r = new_rule(g, g.p); // : 0x10FCDB600 1678 // TRACE 101 1679 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1680 g.e = new_ident("integer", g.r); // new_elem: 0x10FCDCBA0 1681 // TRACE 200 1682 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1683 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1684 { 1685 mixin(commonValues); 1686 1687 1688 if (g.r.op_assoc) g.r.op_priority = cast(int)strtol(n0.start_loc.s, null, 0); 1689 else g.r.rule_priority = cast(int)strtol(n0.start_loc.s, null, 0); 1690 1691 return 0; 1692 }; 1693 1694 // TRACE 93 1695 g.p.rules ~= g.r; 1696 // TRACE 87 1697 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 1698 g.p = new_production(g, "external_action"); // : 0x10FCDE600 1699 // TRACE 95 1700 g.r = new_rule(g, g.p); 1701 // new_elem: 0x10FCDC940 1702 // g.r = new_rule(g, g.p); // : 0x10FCDE500 1703 // TRACE 98 1704 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1705 g.e = new_string(g, `'${action}'`, g.r); 1706 // new_elem: 0x10FCDC880 1707 // TRACE 200 1708 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1709 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1710 { 1711 mixin(commonValues); 1712 1713 g.r.action_index = g.action_index++; 1714 return 0; 1715 }; 1716 1717 // TRACE 93 1718 g.p.rules ~= g.r; 1719 // TRACE 95 1720 g.r = new_rule(g, g.p); 1721 // new_elem: 0x10FCDC6E0 1722 // g.r = new_rule(g, g.p); // : 0x10FCDE100 1723 // TRACE 98 1724 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1725 g.e = new_string(g, `'${action'`, g.r); 1726 // new_elem: 0x10FCDC620 1727 // TRACE 101 1728 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1729 g.e = new_ident("integer", g.r); // new_elem: 0x10FCDC580 1730 // TRACE 98 1731 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1732 g.e = new_string(g, `'}'`, g.r); 1733 // new_elem: 0x10FCDC4C0 1734 // TRACE 200 1735 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1736 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1737 { 1738 mixin(commonValues); 1739 1740 g.r.action_index = cast(int)strtol(n1.start_loc.s, null, 0); 1741 return 0; 1742 }; 1743 1744 // TRACE 93 1745 g.p.rules ~= g.r; 1746 // TRACE 87 1747 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 1748 g.p = new_production(g, "rule_code"); // : 0x10FCE0D00 1749 // TRACE 95 1750 g.r = new_rule(g, g.p); 1751 // new_elem: 0x10FCDC280 1752 // g.r = new_rule(g, g.p); // : 0x10FCE0C00 1753 // TRACE 101 1754 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1755 g.e = new_ident("speculative_code", g.r); // new_elem: 0x10FCDC1E0 1756 // TRACE 158 1757 conditional_EBNF(g); 1758 // g.p = new_production(g, "rule_code__41"); // : 0x10FCE0B00 1759 // new_elem: 0x10FCDC140 1760 // g.r = new_rule(g, g.p); // : 0x10FCE0A00 1761 // new_elem: 0x10FCDC120 1762 // g.r = new_rule(g, g.p); // : 0x10FCE0900 1763 // new_elem: 0x10FCDC100 1764 // TRACE 101 1765 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1766 g.e = new_ident("final_code", g.r); // new_elem: 0x10FCDC060 1767 // TRACE 158 1768 conditional_EBNF(g); 1769 // g.p = new_production(g, "rule_code__42"); // : 0x10FCE0800 1770 // new_elem: 0x10FCE2FE0 1771 // g.r = new_rule(g, g.p); // : 0x10FCE0700 1772 // new_elem: 0x10FCE2FC0 1773 // g.r = new_rule(g, g.p); // : 0x10FCE0600 1774 // new_elem: 0x10FCE2FA0 1775 // TRACE 101 1776 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1777 g.e = new_ident("pass_code", g.r); // new_elem: 0x10FCE2F00 1778 // TRACE 159 1779 star_EBNF(g); 1780 // g.p = new_production(g, "rule_code__43"); // : 0x10FCE0500 1781 // new_elem: 0x10FCE2EA0 1782 // g.r = new_rule(g, g.p); // : 0x10FCE0400 1783 // new_elem: 0x10FCE2E80 1784 // new_elem: 0x10FCE2E60 1785 // new_elem: 0x10FCE2E40 1786 // g.r = new_rule(g, g.p); // : 0x10FCE0300 1787 // TRACE 93 1788 g.p.rules ~= g.r; 1789 // TRACE 87 1790 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 1791 g.p = new_production(g, "speculative_code"); // : 0x10FCE0100 1792 // TRACE 95 1793 g.r = new_rule(g, g.p); 1794 // new_elem: 0x10FCE2C20 1795 // g.r = new_rule(g, g.p); // : 0x10FCE0000 1796 // TRACE 101 1797 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1798 g.e = new_ident("bracket_code", g.r); // new_elem: 0x10FCE2B80 1799 // TRACE 200 1800 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1801 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1802 { 1803 mixin(commonValues); 1804 1805 1806 g.r.speculative_code.code = dup_code(n0.start_loc.s + 1, n0.end - 1); 1807 g.r.speculative_code.line = n0.start_loc.line; 1808 1809 return 0; 1810 }; 1811 1812 // TRACE 93 1813 g.p.rules ~= g.r; 1814 // TRACE 87 1815 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 1816 g.p = new_production(g, "final_code"); // : 0x10FCE5B00 1817 // TRACE 95 1818 g.r = new_rule(g, g.p); 1819 // new_elem: 0x10FCE2940 1820 // g.r = new_rule(g, g.p); // : 0x10FCE5A00 1821 // TRACE 101 1822 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1823 g.e = new_ident("curly_code", g.r); // new_elem: 0x10FCE28A0 1824 // TRACE 200 1825 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1826 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1827 { 1828 mixin(commonValues); 1829 1830 1831 g.r.final_code.code = dup_code(n0.start_loc.s + 1, n0.end - 1); 1832 g.r.final_code.line = n0.start_loc.line; 1833 1834 return 0; 1835 }; 1836 1837 // TRACE 93 1838 g.p.rules ~= g.r; 1839 // TRACE 87 1840 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 1841 g.p = new_production(g, "pass_code"); // : 0x10FCE7600 1842 // TRACE 95 1843 g.r = new_rule(g, g.p); 1844 // new_elem: 0x10FCE2660 1845 // g.r = new_rule(g, g.p); // : 0x10FD77600 1846 // TRACE 101 1847 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1848 g.e = new_ident("identifier", g.r); // new_elem: 0x10FCE25C0 1849 // TRACE 98 1850 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1851 g.e = new_string(g, `':'`, g.r); 1852 // new_elem: 0x10FCE2500 1853 // TRACE 101 1854 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1855 g.e = new_ident("curly_code", g.r); // new_elem: 0x10FCE2460 1856 // TRACE 200 1857 /// g.r.final_code.code = dup_code(_c0.start_loc.s + 1, _c0.end - 1); g.r.final_code.line = _c0.start_loc.line; 1858 g.r.final_code.f = (new_ps, children, n_children, pn_offset, parser) 1859 { 1860 mixin(commonValues); 1861 1862 1863 add_pass_code(g, g.r, n0.matchedString, n2.matchedString[1 .. $ - 1], 1864 n0.start_loc.line, n2.start_loc.line); 1865 1866 return 0; 1867 }; 1868 1869 // TRACE 93 1870 g.p.rules ~= g.r; 1871 // TRACE 87 1872 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 1873 g.p = new_production(g, "curly_code"); // : 0x10FD7C000 1874 // TRACE 95 1875 g.r = new_rule(g, g.p); 1876 // new_elem: 0x10FCE2220 1877 // g.r = new_rule(g, g.p); // : 0x10FD7FF00 1878 // TRACE 98 1879 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1880 g.e = new_string(g, `'{'`, g.r); 1881 // new_elem: 0x10FCE2160 1882 // TRACE 101 1883 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1884 g.e = new_ident("balanced_code", g.r); // new_elem: 0x10FCE20C0 1885 // TRACE 159 1886 star_EBNF(g); 1887 // g.p = new_production(g, "curly_code__48"); // : 0x10FD7FE00 1888 // new_elem: 0x10FCE2060 1889 // g.r = new_rule(g, g.p); // : 0x10FD7FD00 1890 // new_elem: 0x10FCE2040 1891 // new_elem: 0x10FCE2020 1892 // new_elem: 0x10FCE2000 1893 // g.r = new_rule(g, g.p); // : 0x10FD7FC00 1894 // TRACE 98 1895 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1896 g.e = new_string(g, `'}'`, g.r); 1897 // new_elem: 0x10FD80F40 1898 // TRACE 93 1899 g.p.rules ~= g.r; 1900 // TRACE 87 1901 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 1902 g.p = new_production(g, "bracket_code"); // : 0x10FD7FA00 1903 // TRACE 95 1904 g.r = new_rule(g, g.p); 1905 // new_elem: 0x10FD80D80 1906 // g.r = new_rule(g, g.p); // : 0x10FD7F900 1907 // TRACE 98 1908 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1909 g.e = new_string(g, `'['`, g.r); 1910 // new_elem: 0x10FD80CC0 1911 // TRACE 101 1912 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1913 g.e = new_ident("balanced_code", g.r); // new_elem: 0x10FD80C20 1914 // TRACE 159 1915 star_EBNF(g); 1916 // g.p = new_production(g, "bracket_code__50"); // : 0x10FD7F800 1917 // new_elem: 0x10FD80BA0 1918 // g.r = new_rule(g, g.p); // : 0x10FD7F700 1919 // new_elem: 0x10FD80B80 1920 // new_elem: 0x10FD80B60 1921 // new_elem: 0x10FD80B40 1922 // g.r = new_rule(g, g.p); // : 0x10FD7F600 1923 // TRACE 98 1924 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1925 g.e = new_string(g, `']'`, g.r); 1926 // new_elem: 0x10FD80A80 1927 // TRACE 93 1928 g.p.rules ~= g.r; 1929 // TRACE 87 1930 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 1931 g.p = new_production(g, "balanced_code"); // : 0x10FD7F400 1932 // TRACE 95 1933 g.r = new_rule(g, g.p); 1934 // new_elem: 0x10FD808C0 1935 // g.r = new_rule(g, g.p); // : 0x10FD7F300 1936 // TRACE 98 1937 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1938 g.e = new_string(g, `'('`, g.r); 1939 // new_elem: 0x10FD80800 1940 // TRACE 101 1941 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1942 g.e = new_ident("balanced_code", g.r); // new_elem: 0x10FD80760 1943 // TRACE 159 1944 star_EBNF(g); 1945 // g.p = new_production(g, "balanced_code__52"); // : 0x10FD7F200 1946 // new_elem: 0x10FD80700 1947 // g.r = new_rule(g, g.p); // : 0x10FD7F100 1948 // new_elem: 0x10FD806E0 1949 // new_elem: 0x10FD806C0 1950 // new_elem: 0x10FD806A0 1951 // g.r = new_rule(g, g.p); // : 0x10FD7F000 1952 // TRACE 98 1953 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1954 g.e = new_string(g, `')'`, g.r); 1955 // new_elem: 0x10FD805E0 1956 // TRACE 93 1957 g.p.rules ~= g.r; 1958 // TRACE 95 1959 g.r = new_rule(g, g.p); 1960 // new_elem: 0x10FD804C0 1961 // g.r = new_rule(g, g.p); // : 0x10FD83F00 1962 // TRACE 98 1963 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1964 g.e = new_string(g, `'['`, g.r); 1965 // new_elem: 0x10FD80400 1966 // TRACE 101 1967 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1968 g.e = new_ident("balanced_code", g.r); // new_elem: 0x10FD80360 1969 // TRACE 159 1970 star_EBNF(g); 1971 // g.p = new_production(g, "balanced_code__53"); // : 0x10FD83E00 1972 // new_elem: 0x10FD80300 1973 // g.r = new_rule(g, g.p); // : 0x10FD83D00 1974 // new_elem: 0x10FD802E0 1975 // new_elem: 0x10FD802C0 1976 // new_elem: 0x10FD802A0 1977 // g.r = new_rule(g, g.p); // : 0x10FD83C00 1978 // TRACE 98 1979 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1980 g.e = new_string(g, `']'`, g.r); 1981 // new_elem: 0x10FD801E0 1982 // TRACE 93 1983 g.p.rules ~= g.r; 1984 // TRACE 95 1985 g.r = new_rule(g, g.p); 1986 // new_elem: 0x10FD800C0 1987 // g.r = new_rule(g, g.p); // : 0x10FD83B00 1988 // TRACE 98 1989 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 1990 g.e = new_string(g, `'{'`, g.r); 1991 // new_elem: 0x10FD80000 1992 // TRACE 101 1993 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 1994 g.e = new_ident("balanced_code", g.r); // new_elem: 0x10FD84F60 1995 // TRACE 159 1996 star_EBNF(g); 1997 // g.p = new_production(g, "balanced_code__54"); // : 0x10FD83A00 1998 // new_elem: 0x10FD84F00 1999 // g.r = new_rule(g, g.p); // : 0x10FD83900 2000 // new_elem: 0x10FD84EE0 2001 // new_elem: 0x10FD84EC0 2002 // new_elem: 0x10FD84EA0 2003 // g.r = new_rule(g, g.p); // : 0x10FD83800 2004 // TRACE 98 2005 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 2006 g.e = new_string(g, `'}'`, g.r); 2007 // new_elem: 0x10FD84DE0 2008 // TRACE 93 2009 g.p.rules ~= g.r; 2010 // TRACE 95 2011 g.r = new_rule(g, g.p); 2012 // new_elem: 0x10FD84CC0 2013 // g.r = new_rule(g, g.p); // : 0x10FD83700 2014 // TRACE 101 2015 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 2016 g.e = new_ident("string", g.r); // new_elem: 0x10FD84C20 2017 // TRACE 93 2018 g.p.rules ~= g.r; 2019 // TRACE 95 2020 g.r = new_rule(g, g.p); 2021 // new_elem: 0x10FD84B00 2022 // g.r = new_rule(g, g.p); // : 0x10FD83600 2023 // TRACE 101 2024 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 2025 g.e = new_ident("identifier", g.r); // new_elem: 0x10FD84A60 2026 // TRACE 93 2027 g.p.rules ~= g.r; 2028 // TRACE 95 2029 g.r = new_rule(g, g.p); 2030 // new_elem: 0x10FD84940 2031 // g.r = new_rule(g, g.p); // : 0x10FD83500 2032 // TRACE 101 2033 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 2034 g.e = new_ident("regex", g.r); // new_elem: 0x10FD848A0 2035 // TRACE 93 2036 g.p.rules ~= g.r; 2037 // TRACE 95 2038 g.r = new_rule(g, g.p); 2039 // new_elem: 0x10FD84780 2040 // g.r = new_rule(g, g.p); // : 0x10FD83400 2041 // TRACE 101 2042 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 2043 g.e = new_ident("integer", g.r); // new_elem: 0x10FD846E0 2044 // TRACE 93 2045 g.p.rules ~= g.r; 2046 // TRACE 95 2047 g.r = new_rule(g, g.p); 2048 // new_elem: 0x10FD845C0 2049 // g.r = new_rule(g, g.p); // : 0x10FD83300 2050 // TRACE 101 2051 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 2052 g.e = new_ident("symbols", g.r); // new_elem: 0x10FD84520 2053 // TRACE 93 2054 g.p.rules ~= g.r; 2055 // TRACE 87 2056 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 2057 g.p = new_production(g, "symbols"); // : 0x10FD83100 2058 // TRACE 95 2059 g.r = new_rule(g, g.p); 2060 // new_elem: 0x10FD84360 2061 // g.r = new_rule(g, g.p); // : 0x10FD83000 2062 // TRACE 99 2063 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 2064 g.e = new_string(g, `"[!~` ~ "`" ~ `@#$%^&*\-_+=|:;\\<,>.?/]"`, g.r); 2065 // new_elem: 0x10FD84280 2066 // TRACE 93 2067 g.p.rules ~= g.r; 2068 // TRACE 87 2069 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 2070 g.p = new_production(g, "string"); // : 0x10FD87E00 2071 // TRACE 95 2072 g.r = new_rule(g, g.p); 2073 // new_elem: 0x10FD840C0 2074 // g.r = new_rule(g, g.p); // : 0x10FD87D00 2075 // TRACE 99 2076 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 2077 g.e = new_string(g, `"'([^'\\]|\\[^])*'"`, g.r); 2078 // new_elem: 0x10FD88FE0 2079 // TRACE 93 2080 g.p.rules ~= g.r; 2081 // TRACE 87 2082 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 2083 g.p = new_production(g, "regex"); // : 0x10FD87B00 2084 // TRACE 95 2085 g.r = new_rule(g, g.p); 2086 // new_elem: 0x10FD88E20 2087 // g.r = new_rule(g, g.p); // : 0x10FD87A00 2088 // TRACE 99 2089 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 2090 g.e = new_string(g, `"\"([^\"\\]|\\[^])*\""`, g.r); 2091 // new_elem: 0x10FD88D40 2092 // TRACE 93 2093 g.p.rules ~= g.r; 2094 // TRACE 87 2095 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 2096 g.p = new_production(g, "unicode_char"); // : 0x10FD87800 2097 // TRACE 95 2098 g.r = new_rule(g, g.p); 2099 // new_elem: 0x10FD88B80 2100 // g.r = new_rule(g, g.p); // : 0x10FD87700 2101 // TRACE 99 2102 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 2103 g.e = new_string(g, `"[uU]\+[0-9a-fA-F]+"`, g.r); 2104 // new_elem: 0x10FD88AA0 2105 // TRACE 93 2106 g.p.rules ~= g.r; 2107 // TRACE 87 2108 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 2109 g.p = new_production(g, "identifier"); // : 0x10FD87500 2110 // TRACE 95 2111 g.r = new_rule(g, g.p); 2112 // new_elem: 0x10FD888E0 2113 // g.r = new_rule(g, g.p); // : 0x10FD87400 2114 // TRACE 99 2115 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 2116 g.e = new_string(g, `"[a-zA-Z_][a-zA-Z_0-9]*"`, g.r); 2117 // new_elem: 0x10FD88800 2118 // TRACE 147 2119 /// if (g.e.kind != ElemKind.ELEM_TERM) d_fail("terminal priority on non-terminal"); 2120 assert(g.e.kind == ElemKind.ELEM_TERM); 2121 g.e.term.term_priority = -1; 2122 // TRACE 93 2123 g.p.rules ~= g.r; 2124 // TRACE 87 2125 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 2126 g.p = new_production(g, "integer"); // : 0x10FD8AF00 2127 // TRACE 95 2128 g.r = new_rule(g, g.p); 2129 // new_elem: 0x10FD885E0 2130 // g.r = new_rule(g, g.p); // : 0x10FD8AE00 2131 // TRACE 101 2132 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 2133 g.e = new_ident("decimalint", g.r); // new_elem: 0x10FD88540 2134 // TRACE 93 2135 g.p.rules ~= g.r; 2136 // TRACE 95 2137 g.r = new_rule(g, g.p); 2138 // new_elem: 0x10FD88420 2139 // g.r = new_rule(g, g.p); // : 0x10FD8AD00 2140 // TRACE 101 2141 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 2142 g.e = new_ident("hexint", g.r); // new_elem: 0x10FD88380 2143 // TRACE 93 2144 g.p.rules ~= g.r; 2145 // TRACE 95 2146 g.r = new_rule(g, g.p); 2147 // new_elem: 0x10FD88260 2148 // g.r = new_rule(g, g.p); // : 0x10FD8AC00 2149 // TRACE 101 2150 /// g.e = new_ident(_c0.start_loc.s, _c0.end, g.r); 2151 g.e = new_ident("octalint", g.r); // new_elem: 0x10FD881C0 2152 // TRACE 93 2153 g.p.rules ~= g.r; 2154 // TRACE 87 2155 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 2156 g.p = new_production(g, "decimalint"); // : 0x10FD8AA00 2157 // TRACE 95 2158 g.r = new_rule(g, g.p); 2159 // new_elem: 0x10FD88000 2160 // g.r = new_rule(g, g.p); // : 0x10FD8A900 2161 // TRACE 99 2162 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 2163 g.e = new_string(g, `"-?[1-9][0-9]*[uUlL]?"`, g.r); 2164 // new_elem: 0x10FD8CF20 2165 // TRACE 93 2166 g.p.rules ~= g.r; 2167 // TRACE 87 2168 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 2169 g.p = new_production(g, "hexint"); // : 0x10FD8A700 2170 // TRACE 95 2171 g.r = new_rule(g, g.p); 2172 // new_elem: 0x10FD8CD60 2173 // g.r = new_rule(g, g.p); // : 0x10FD8A600 2174 // TRACE 99 2175 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 2176 g.e = new_string(g, `"-?(0x|0X)[0-9a-fA-F]+[uUlL]?"`, g.r); 2177 // new_elem: 0x10FD8CC80 2178 // TRACE 93 2179 g.p.rules ~= g.r; 2180 // TRACE 87 2181 /// g.p = new_production(g, dup_str(_c0.start_loc.s, _c0.end)); 2182 g.p = new_production(g, "octalint"); // : 0x10FD8A400 2183 // TRACE 95 2184 g.r = new_rule(g, g.p); 2185 // new_elem: 0x10FD8CAC0 2186 // g.r = new_rule(g, g.p); // : 0x10FD8A300 2187 // TRACE 99 2188 /// g.e = new_string(g, _c0.start_loc.s, _c0.end, g.r); 2189 g.e = new_string(g, `"-?0[0-7]*[uUlL]?"`, g.r); 2190 // new_elem: 0x10FD8C9E0 2191 // TRACE 93 2192 g.p.rules ~= g.r; 2193 2194 finish_productions(g); 2195 build_grammar(g); 2196 2197 return g; 2198 } 2199 2200 2201 bool parseGrammar(Grammar* g, string str) 2202 { 2203 static __gshared D_ParserTables* gramGramTables; 2204 2205 D_ParserTables* ggTables; 2206 if (__ctfe) 2207 { 2208 ggTables = createTablesFromGrammar(grammarGrammar(), null, null); 2209 } 2210 else 2211 { 2212 if (gramGramTables == null) 2213 gramGramTables = createTablesFromGrammar(grammarGrammar(), null, null); 2214 ggTables = gramGramTables; 2215 } 2216 2217 if (!g.productions.length) 2218 initialize_productions(g); 2219 D_Parser *p = new_D_Parser(ggTables, (GramGramParseNode_User).sizeof); 2220 p.initial_globals = g; 2221 if (!dparse(p, str)) 2222 return false; 2223 2224 if (g.productions.length > 1) 2225 finish_productions(g); 2226 2227 return true; 2228 } 2229 2230 int 2231 parse_grammar(Grammar *g, string pathname, string sarg) { 2232 if (!sarg) 2233 { 2234 sarg = readContentsOfFile(pathname); 2235 if (!sarg) 2236 return -1; 2237 } 2238 if (!parseGrammar(g, sarg)) 2239 return -1; 2240 return 0; 2241 } 2242 2243 void testGramJson() 2244 { 2245 Grammar *g = createEmptyGrammar(); 2246 2247 if (parse_grammar(g, "d/grammar.g", null) < 0) 2248 assert(false); 2249 2250 auto s = new Serializer(); 2251 JSONValue v = s.serialize(g); 2252 string v1 = toJSON(&v, true); 2253 writeln("JSON: ", v1); 2254 2255 Grammar* otherG; 2256 s.deserialize(otherG, v); 2257 2258 v = s.serialize(otherG); 2259 string v2 = toJSON(&v, true); 2260 2261 if (v2 != v1) 2262 { 2263 writeln("JSON2: ", v2); 2264 assert(false); 2265 } 2266 2267 g = grammarGrammar(); 2268 v = s.serialize(g); 2269 string v3 = toJSON(&v, true); 2270 if (v3 != v2) 2271 { 2272 writeln("V3: ", v3); 2273 } 2274 } 2275