Changeset 236
- Timestamp:
- 08/11/06 15:42:31 (2 years ago)
- Files:
-
- trunk/enki/EnkiParser.d (modified) (74 diffs)
- trunk/enki/bootstrap.d (modified) (50 diffs)
- trunk/enki/enki.bnf (modified) (10 diffs)
- trunk/enki/enki_bn.d (modified) (1 diff)
- trunk/enki/library/d/parser/Struct.bnf (modified) (1 diff)
- trunk/enki/library/d/parser/Struct.d (modified) (1 diff)
- trunk/enki/types.d (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/enki/EnkiParser.d
r235 r236 42 42 /* 43 43 44 WS 45 ::= ws| SlashSlashComment| SlashStarComment; 46 47 */ 48 public ResultT!(bool) parse_WS(){ 49 debug writefln("parse_WS()"); 50 uint start1 = position; 51 //no declarations 52 53 54 {//Expression 55 uint start2 = position; 56 if((parse_ws().success) || (parse_SlashSlashComment().success) || (parse_SlashStarComment().success)){ 57 clearErrors(); 58 goto match1; 59 }else{ 60 setError("Expected Whitespace, SlashSlashComment or SlashStarComment."); 61 position = start2; 62 goto mismatch2; 63 } 64 } 65 match1: 66 debug writefln("parse_WS() PASS"); 67 return ResultT!(bool)(true); 68 mismatch2: 69 position = start1; 70 return ResultT!(bool)(); 71 } 72 73 /* 74 44 75 Syntax 45 76 = void createSyntax(SyntaxLine[] lines) 46 ::= ws { ( Rule:~lines | Comment:~lines | Directive:~lines ) ws} eoi;77 ::= WS { ( Rule:~lines | Comment:~lines | Directive:~lines ) WS} eoi; 47 78 48 79 */ 49 80 public ResultT!(String) parse_Syntax(){ 50 81 debug writefln("parse_Syntax()"); 51 uint start 1= position;82 uint start3 = position; 52 83 SyntaxLine[] bind_lines; 53 84 54 85 55 86 {//Expression 56 uint start 2= position;57 if(!(parse_ ws().success)){58 goto mismatch 4;87 uint start4 = position; 88 if(!(parse_WS().success)){ 89 goto mismatch6; 59 90 } 60 91 {//ZeroOrMoreExpr 61 uint start 3= position;92 uint start5 = position; 62 93 uint termPos; 63 loop 5:94 loop7: 64 95 termPos = position; 65 96 if(parse_eoi().success){ 66 goto loopend 6;67 } 68 {//Expression 69 uint start 4= position;97 goto loopend8; 98 } 99 {//Expression 100 uint start6 = position; 70 101 {//Expression 71 uint start 5= position;102 uint start7 = position; 72 103 if((parse_Rule().assignCat!(SyntaxLine[])(bind_lines)) || (parse_Comment().assignCat!(SyntaxLine[])(bind_lines)) || (parse_Directive().assignCat!(SyntaxLine[])(bind_lines))){ 73 104 clearErrors(); 74 105 }else{ 75 106 setError("Expected Rule, Comment or Directive."); 76 position = start 5;77 goto mismatch 8;107 position = start7; 108 goto mismatch10; 78 109 } 79 110 } 80 if(!(parse_ ws().success)){81 goto mismatch 8;82 } 83 goto match 7;84 mismatch 8:111 if(!(parse_WS().success)){ 112 goto mismatch10; 113 } 114 goto match9; 115 mismatch10: 85 116 {/*do nothing*/} 86 position = start 4;87 goto mismatch 4;88 match 7:117 position = start6; 118 goto mismatch6; 119 match9: 89 120 clearErrors(); 90 goto loop 5;91 } 92 loopend 6:121 goto loop7; 122 } 123 loopend8: 93 124 {/*do nothing*/} 94 125 } 126 goto match5; 127 mismatch6: 128 setError("Expected WS."); 129 position = start4; 130 goto mismatch4; 131 match5: 132 clearErrors(); 95 133 goto match3; 96 mismatch4: 97 setError("Expected Whitespace."); 98 position = start2; 99 goto mismatch2; 100 match3: 101 clearErrors(); 102 goto match1; 103 } 104 match1: 134 } 135 match3: 105 136 debug writefln("parse_Syntax() PASS"); 106 137 createSyntax(bind_lines); 107 return ResultT!(String)(sliceData(start 1,position));108 mismatch 2:109 position = start 1;138 return ResultT!(String)(sliceData(start3,position)); 139 mismatch4: 140 position = start3; 110 141 return ResultT!(String)(); 111 142 } … … 115 146 Rule 116 147 = new Rule(String name,RulePredicate pred,Expression expr,RuleDecl decl) 117 ::= ws Identifier:name ws [ RuleDecl:decl ws] [ RulePredicate:pred ] ws "::=" ws Expression:expr ws";";148 ::= WS Identifier:name WS [ RuleDecl:decl WS] [ RulePredicate:pred ] WS "::=" WS Expression:expr WS ";"; 118 149 119 150 */ 120 151 public ResultT!(Rule) parse_Rule(){ 121 152 debug writefln("parse_Rule()"); 122 uint start 6= position;153 uint start8 = position; 123 154 String bind_name; 124 155 RulePredicate bind_pred; … … 128 159 129 160 {//Expression 130 uint start 7= position;131 if(!(parse_ ws().success)){132 goto mismatch1 2;161 uint start9 = position; 162 if(!(parse_WS().success)){ 163 goto mismatch14; 133 164 } 134 165 if(!(parse_Identifier().assign!(String)(bind_name))){ 135 goto mismatch1 2;136 } 137 if(!(parse_ ws().success)){138 goto mismatch1 2;166 goto mismatch14; 167 } 168 if(!(parse_WS().success)){ 169 goto mismatch14; 139 170 } 140 171 {//OptionalExpr 141 172 {//Expression 142 uint start 9= position;143 if((parse_RuleDecl().assign!(RuleDecl)(bind_decl) && parse_ ws().success)){173 uint start11 = position; 174 if((parse_RuleDecl().assign!(RuleDecl)(bind_decl) && parse_WS().success)){ 144 175 clearErrors(); 145 176 }else{ 146 position = start 9;177 position = start11; 147 178 } 148 179 } … … 150 181 {//OptionalExpr 151 182 {//Expression 152 uint start1 1= position;183 uint start13 = position; 153 184 if((parse_RulePredicate().assign!(RulePredicate)(bind_pred))){ 154 185 clearErrors(); 155 186 }else{ 156 position = start1 1;157 } 158 } 159 } 160 if(!(parse_ ws().success)){161 goto mismatch1 2;187 position = start13; 188 } 189 } 190 } 191 if(!(parse_WS().success)){ 192 goto mismatch14; 162 193 } 163 194 if(!(terminal("::=").success)){ 164 goto mismatch1 2;165 } 166 if(!(parse_ ws().success)){167 goto mismatch1 2;195 goto mismatch14; 196 } 197 if(!(parse_WS().success)){ 198 goto mismatch14; 168 199 } 169 200 if(!(parse_Expression().assign!(Expression)(bind_expr))){ 170 goto mismatch1 2;171 } 172 if(!(parse_ ws().success)){173 goto mismatch1 2;201 goto mismatch14; 202 } 203 if(!(parse_WS().success)){ 204 goto mismatch14; 174 205 } 175 206 if(!(terminal(";").success)){ 176 goto mismatch12; 177 } 207 goto mismatch14; 208 } 209 goto match13; 210 mismatch14: 211 setError("Expected WS."); 212 position = start9; 213 goto mismatch12; 214 match13: 215 clearErrors(); 178 216 goto match11; 179 mismatch12: 180 setError("Expected Whitespace."); 181 position = start7; 182 goto mismatch10; 183 match11: 184 clearErrors(); 185 goto match9; 186 } 187 match9: 217 } 218 match11: 188 219 debug writefln("parse_Rule() PASS"); 189 220 ResultT!(Rule) passed = ResultT!(Rule)(new Rule(bind_name,bind_pred,bind_expr,bind_decl)); 190 221 return passed; 191 mismatch1 0:192 position = start 6;222 mismatch12: 223 position = start8; 193 224 ResultT!(Rule) failed = ResultT!(Rule)(); 194 225 return failed; … … 204 235 public ResultT!(RuleDecl) parse_RuleDecl(){ 205 236 debug writefln("parse_RuleDecl()"); 206 uint start1 2= position;237 uint start14 = position; 207 238 Param[] bind_params; 208 239 209 240 210 241 {//Expression 211 uint start1 3= position;242 uint start15 = position; 212 243 if((parse_ParamsExpr().assign!(Param[])(bind_params))){ 213 244 clearErrors(); 214 goto match1 3;245 goto match15; 215 246 }else{ 216 247 setError("Expected ParamsExpr."); 217 position = start1 3;218 goto mismatch1 4;219 } 220 } 221 match1 3:248 position = start15; 249 goto mismatch16; 250 } 251 } 252 match15: 222 253 debug writefln("parse_RuleDecl() PASS"); 223 254 ResultT!(RuleDecl) passed = ResultT!(RuleDecl)(new RuleDecl(bind_params)); 224 255 return passed; 225 mismatch1 4:226 position = start1 2;256 mismatch16: 257 position = start14; 227 258 ResultT!(RuleDecl) failed = ResultT!(RuleDecl)(); 228 259 return failed; … … 233 264 RulePredicate 234 265 = RulePredicate pred 235 ::= "=" ws( ClassPredicate:pred | FunctionPredicate:pred | BindingPredicate:pred ) ;266 ::= "=" WS ( ClassPredicate:pred | FunctionPredicate:pred | BindingPredicate:pred ) ; 236 267 237 268 */ 238 269 public ResultT!(RulePredicate) parse_RulePredicate(){ 239 270 debug writefln("parse_RulePredicate()"); 240 uint start1 4= position;271 uint start16 = position; 241 272 RulePredicate bind_pred; 242 273 243 274 244 275 {//Expression 245 uint start1 5= position;276 uint start17 = position; 246 277 if(!(terminal("=").success)){ 247 goto mismatch 18;248 } 249 if(!(parse_ ws().success)){250 goto mismatch 18;278 goto mismatch20; 279 } 280 if(!(parse_WS().success)){ 281 goto mismatch20; 251 282 } 252 283 {//Expression 253 uint start1 6= position;284 uint start18 = position; 254 285 if((parse_ClassPredicate().assign!(RulePredicate)(bind_pred)) || (parse_FunctionPredicate().assign!(RulePredicate)(bind_pred)) || (parse_BindingPredicate().assign!(RulePredicate)(bind_pred))){ 255 286 clearErrors(); 256 287 }else{ 257 288 setError("Expected ClassPredicate, FunctionPredicate or BindingPredicate."); 258 position = start16; 259 goto mismatch18; 260 } 261 } 289 position = start18; 290 goto mismatch20; 291 } 292 } 293 goto match19; 294 mismatch20: 295 {/*do nothing*/} 296 position = start17; 297 goto mismatch18; 298 match19: 299 clearErrors(); 262 300 goto match17; 263 mismatch18: 264 {/*do nothing*/} 265 position = start15; 266 goto mismatch16; 267 match17: 268 clearErrors(); 269 goto match15; 270 } 271 match15: 301 } 302 match17: 272 303 debug writefln("parse_RulePredicate() PASS"); 273 304 return ResultT!(RulePredicate)(bind_pred); 274 mismatch1 6:275 position = start1 4;305 mismatch18: 306 position = start16; 276 307 return ResultT!(RulePredicate)(); 277 308 } … … 281 312 ClassPredicate 282 313 = new ClassPredicate(String name,Param[] params) 283 ::= "new" ws Identifier:name wsParamsExpr:params ;314 ::= "new" WS Identifier:name WS ParamsExpr:params ; 284 315 285 316 */ 286 317 public ResultT!(ClassPredicate) parse_ClassPredicate(){ 287 318 debug writefln("parse_ClassPredicate()"); 288 uint start1 7= position;319 uint start19 = position; 289 320 String bind_name; 290 321 Param[] bind_params; … … 292 323 293 324 {//Expression 294 uint start18 = position;295 if((terminal("new").success && parse_ws().success && parse_Identifier().assign!(String)(bind_name) && parse_ws().success && parse_ParamsExpr().assign!(Param[])(bind_params))){296 clearErrors();297 goto match19;298 }else{299 position = start18;300 goto mismatch20;301 }302 }303 match19:304 debug writefln("parse_ClassPredicate() PASS");305 ResultT!(ClassPredicate) passed = ResultT!(ClassPredicate)(new ClassPredicate(bind_name,bind_params));306 return passed;307 mismatch20:308 position = start17;309 ResultT!(ClassPredicate) failed = ResultT!(ClassPredicate)();310 return failed;311 }312 313 /*314 315 FunctionPredicate316 = new FunctionPredicate(Param decl,Param[] params)317 ::= ExplicitParam:decl ws ParamsExpr:params ;318 319 */320 public ResultT!(FunctionPredicate) parse_FunctionPredicate(){321 debug writefln("parse_FunctionPredicate()");322 uint start19 = position;323 Param bind_decl;324 Param[] bind_params;325 326 327 {//Expression328 325 uint start20 = position; 329 if(( parse_ExplicitParam().assign!(Param)(bind_decl) && parse_ws().success && parse_ParamsExpr().assign!(Param[])(bind_params))){326 if((terminal("new").success && parse_WS().success && parse_Identifier().assign!(String)(bind_name) && parse_WS().success && parse_ParamsExpr().assign!(Param[])(bind_params))){ 330 327 clearErrors(); 331 328 goto match21; 332 329 }else{ 333 setError("Expected ExplicitParam.");334 330 position = start20; 335 331 goto mismatch22; … … 337 333 } 338 334 match21: 335 debug writefln("parse_ClassPredicate() PASS"); 336 ResultT!(ClassPredicate) passed = ResultT!(ClassPredicate)(new ClassPredicate(bind_name,bind_params)); 337 return passed; 338 mismatch22: 339 position = start19; 340 ResultT!(ClassPredicate) failed = ResultT!(ClassPredicate)(); 341 return failed; 342 } 343 344 /* 345 346 FunctionPredicate 347 = new FunctionPredicate(Param decl,Param[] params) 348 ::= ExplicitParam:decl WS ParamsExpr:params ; 349 350 */ 351 public ResultT!(FunctionPredicate) parse_FunctionPredicate(){ 352 debug writefln("parse_FunctionPredicate()"); 353 uint start21 = position; 354 Param bind_decl; 355 Param[] bind_params; 356 357 358 {//Expression 359 uint start22 = position; 360 if((parse_ExplicitParam().assign!(Param)(bind_decl) && parse_WS().success && parse_ParamsExpr().assign!(Param[])(bind_params))){ 361 clearErrors(); 362 goto match23; 363 }else{ 364 setError("Expected ExplicitParam."); 365 position = start22; 366 goto mismatch24; 367 } 368 } 369 match23: 339 370 debug writefln("parse_FunctionPredicate() PASS"); 340 371 ResultT!(FunctionPredicate) passed = ResultT!(FunctionPredicate)(new FunctionPredicate(bind_decl,bind_params)); 341 372 return passed; 342 mismatch2 2:343 position = start 19;373 mismatch24: 374 position = start21; 344 375 ResultT!(FunctionPredicate) failed = ResultT!(FunctionPredicate)(); 345 376 return failed; … … 355 386 public ResultT!(BindingPredicate) parse_BindingPredicate(){ 356 387 debug writefln("parse_BindingPredicate()"); 357 uint start2 1= position;388 uint start23 = position; 358 389 Param bind_param; 359 390 360 391 361 392 {//Expression 362 uint start2 2= position;393 uint start24 = position; 363 394 if((parse_Param().assign!(Param)(bind_param))){ 364 395 clearErrors(); 365 goto match2 3;396 goto match25; 366 397 }else{ 367 398 setError("Expected Param."); 368 position = start2 2;369 goto mismatch2 4;370 } 371 } 372 match2 3:399 position = start24; 400 goto mismatch26; 401 } 402 } 403 match25: 373 404 debug writefln("parse_BindingPredicate() PASS"); 374 405 ResultT!(BindingPredicate) passed = ResultT!(BindingPredicate)(new BindingPredicate(bind_param)); 375 406 return passed; 376 mismatch2 4:377 position = start2 1;407 mismatch26: 408 position = start23; 378 409 ResultT!(BindingPredicate) failed = ResultT!(BindingPredicate)(); 379 410 return failed; … … 384 415 ParamsExpr 385 416 = Param[] params 386 ::= "(" ws [ Param:~params ws { "," ws Param:~params ws} ] ")";417 ::= "(" WS [ Param:~params WS { "," WS Param:~params WS} ] ")"; 387 418 388 419 */ 389 420 public ResultT!(Param[]) parse_ParamsExpr(){ 390 421 debug writefln("parse_ParamsExpr()"); 391 uint start2 3= position;422 uint start25 = position; 392 423 Param[] bind_params; 393 424 394 425 395 426 {//Expression 396 uint start2 4= position;427 uint start26 = position; 397 428 if(!(terminal("(").success)){ 398 goto mismatch 28;399 } 400 if(!(parse_ ws().success)){401 goto mismatch 28;429 goto mismatch30; 430 } 431 if(!(parse_WS().success)){ 432 goto mismatch30; 402 433 } 403 434 {//OptionalExpr 404 435 {//Expression 405 uint start2 6= position;436 uint start28 = position; 406 437 if(!(parse_Param().assignCat!(Param[])(bind_params))){ 407 goto mismatch3 0;408 } 409 if(!(parse_ ws().success)){410 goto mismatch3 0;438 goto mismatch32; 439 } 440 if(!(parse_WS().success)){ 441 goto mismatch32; 411 442 } 412 443 {//ZeroOrMoreExpr 413 444 uint termPos; 414 loop3 1:445 loop33: 415 446 termPos = position; 416 447 {//Expression 417 uint start 28= position;418 if((terminal(",").success && parse_ ws().success && parse_Param().assignCat!(Param[])(bind_params) && parse_ws().success)){448 uint start30 = position; 449 if((terminal(",").success && parse_WS().success && parse_Param().assignCat!(Param[])(bind_params) && parse_WS().success)){ 419 450 clearErrors(); 420 goto loop3 1;451 goto loop33; 421 452 }else{ 422 position = start 28;423 goto loopend3 2;453 position = start30; 454 goto loopend34; 424 455 } 425 456 } 426 loopend3 2:457 loopend34: 427 458 {/*do nothing*/} 428 459 } 429 goto match 29;430 mismatch3 0:460 goto match31; 461 mismatch32: 431 462 {/*do nothing*/} 432 position = start2 6;463 position = start28; 433 464 {/*do nothing*/} 434 match 29:465 match31: 435 466 clearErrors(); 436 467 {/*do nothing*/} … … 438 469 } 439 470 if(!(terminal(")").success)){ 440 goto mismatch28; 441 } 471 goto mismatch30; 472 } 473 goto match29; 474 mismatch30: 475 {/*do nothing*/} 476 position = start26; 477 goto mismatch28; 478 match29: 479 clearErrors(); 442 480 goto match27; 443 mismatch28: 444 {/*do nothing*/} 445 position = start24; 446 goto mismatch26; 447 match27: 448 clearErrors(); 449 goto match25; 450 } 451 match25: 481 } 482 match27: 452 483 debug writefln("parse_ParamsExpr() PASS"); 453 484 return ResultT!(Param[])(bind_params); 454 mismatch2 6:455 position = start2 3;485 mismatch28: 486 position = start25; 456 487 return ResultT!(Param[])(); 457 488 } … … 466 497 public ResultT!(Param) parse_Param(){ 467 498 debug writefln("parse_Param()"); 468 uint start 29= position;499 uint start31 = position; 469 500 Param bind_param; 470 501 471 502 472 503 {//Expression 473 uint start3 0= position;504 uint start32 = position; 474 505 if((parse_ExplicitParam().assign!(Param)(bind_param)) || (parse_WeakParam().assign!(Param)(bind_param))){ 475 506 clearErrors(); 476 goto match3 3;507 goto match35; 477 508 }else{ 478 509 setError("Expected ExplicitParam or WeakParam."); 479 position = start3 0;480 goto mismatch3 4;481 } 482 } 483 match3 3:510 position = start32; 511 goto mismatch36; 512 } 513 } 514 match35: 484 515 debug writefln("parse_Param() PASS"); 485 516 return ResultT!(Param)(bind_param); 486 mismatch3 4:487 position = start 29;517 mismatch36: 518 position = start31; 488 519 return ResultT!(Param)(); 489 520 } … … 498 529 public ResultT!(Param) parse_WeakParam(){ 499 530 debug writefln("parse_WeakParam()"); 500 uint start3 1= position;531 uint start33 = position; 501 532 String bind_name; 502 533 503 534 504 535 {//Expression 505 uint start3 2= position;536 uint start34 = position; 506 537 if((parse_Identifier().assign!(String)(bind_name))){ 507 538 clearErrors(); 508 goto match3 5;539 goto match37; 509 540 }else{ 510 541 setError("Expected Identifier."); 511 position = start3 2;512 goto mismatch3 6;513 } 514 } 515 match3 5:542 position = start34; 543 goto mismatch38; 544 } 545 } 546 match37: 516 547 debug writefln("parse_WeakParam() PASS"); 517 548 ResultT!(Param) passed = ResultT!(Param)(new Param(bind_name)); 518 549 return passed; 519 mismatch3 6:520 position = start3 1;550 mismatch38: 551 position = start33; 521 552 ResultT!(Param) failed = ResultT!(Param)(); 522 553 return failed; … … 527 558 ExplicitParam 528 559 = new Param(bool isArray,String type,String name) 529 ::= Identifier:type ws [ "[]":isArray Brackets ws] Identifier:name ;560 ::= Identifier:type WS [ "[]":isArray Brackets WS] Identifier:name ; 530 561 531 562 */ 532 563 public ResultT!(Param) parse_ExplicitParam(){ 533 564 debug writefln("parse_ExplicitParam()"); 534 uint start3 3= position;565 uint start35 = position; 535 566 bool bind_isArray; 536 567 String bind_type; … … 539 570 540 571 {//Expression 541 uint start3 4= position;572 uint start36 = position; 542 573 if(!(parse_Identifier().assign!(String)(bind_type))){ 543 goto mismatch4 0;544 } 545 if(!(parse_ ws().success)){546 goto mismatch4 0;574 goto mismatch42; 575 } 576 if(!(parse_WS().success)){ 577 goto mismatch42; 547 578 } 548 579 {//OptionalExpr 549 580 {//Expression 550 uint start3 6= position;551 if((terminal("[]").assign!(bool)(bind_isArray) && parse_Brackets().success && parse_ ws().success)){581 uint start38 = position; 582 if((terminal("[]").assign!(bool)(bind_isArray) && parse_Brackets().success && parse_WS().success)){ 552 583 clearErrors(); 553 584 }else{ 554 position = start3 6;585 position = start38; 555 586 } 556 587 } 557 588 } 558 589 if(!(parse_Identifier().assign!(String)(bind_name))){ 559 goto mismatch40; 560 } 590 goto mismatch42; 591 } 592 goto match41; 593 mismatch42: 594 setError("Expected Identifier."); 595 position = start36; 596 goto mismatch40; 597 match41: 598 clearErrors(); 561 599 goto match39; 562 mismatch40: 563 setError("Expected Identifier."); 564 position = start34; 565 goto mismatch38; 566 match39: 567 clearErrors(); 568 goto match37; 569 } 570 match37: 600 } 601 match39: 571 602 debug writefln("parse_ExplicitParam() PASS"); 572 603 ResultT!(Param) passed = ResultT!(Param)(new Param(bind_isArray,bind_type,bind_name)); 573 604 return passed; 574 mismatch 38:575 position = start3 3;605 mismatch40: 606 position = start35; 576 607 ResultT!(Param) failed = ResultT!(Param)(); 577 608 return failed; … … 586 617 public ResultT!(bool) parse_Brackets(){ 587 618 debug writefln("parse_Brackets()"); 588 uint start3 7= position;619 uint start39 = position; 589 620 //no declarations 590 621 591 622 592 623 {//Expression 593 uint start 38= position;624 uint start40 = position; 594 625 {//OptionalExpr 595 626 {//Expression 596 uint start4 0= position;627 uint start42 = position; 597 628 if((terminal("[]").success && parse_Brackets().success)){ 598 629 clearErrors(); 599 630 }else{ 600 position = start40; 601 } 602 } 603 } 631 position = start42; 632 } 633 } 634 } 635 goto match45; 636 mismatch46: 637 {/*do nothing*/} 638 position = start40; 639 goto mismatch44; 640 match45: 641 clearErrors(); 604 642 goto match43; 605 mismatch44: 606 {/*do nothing*/} 607 position = start38; 608 goto mismatch42; 609 match43: 610 clearErrors(); 611 goto match41; 612 } 613 match41: 643 } 644 match43: 614 645 debug writefln("parse_Brackets() PASS"); 615 646 return ResultT!(bool)(true); 616 mismatch4 2:617 position = start3 7;647 mismatch44: 648 position = start39; 618 649 return ResultT!(bool)(); 619 650 } … … 623 654 Expression 624 655 = new Expression(Term[] terms) 625 ::= Term:~terms ws { "|" ws Term:~terms ws} ;656 ::= Term:~terms WS { "|" WS Term:~terms WS} ; 626 657 627 658 */ 628 659 public ResultT!(Expression) parse_Expression(){ 629 660 debug writefln("parse_Expression()"); 630 uint start4 1= position;661 uint start43 = position; 631 662 Term[] bind_terms; 632 663 633 664 634 665 {//Expression 635 uint start4 2= position;666 uint start44 = position; 636 667 if(!(parse_Term().assignCat!(Term[])(bind_terms))){ 637 goto mismatch 48;638 } 639 if(!(parse_ ws().success)){640 goto mismatch 48;668 goto mismatch50; 669 } 670 if(!(parse_WS().success)){ 671 goto mismatch50; 641 672 } 642 673 {//ZeroOrMoreExpr 643 674 uint termPos; 644 loop 49:675 loop51: 645 676 termPos = position; 646 677 {//Expression 647 uint start4 4= position;648 if((terminal("|").success && parse_ ws().success && parse_Term().assignCat!(Term[])(bind_terms) && parse_ws().success)){678 uint start46 = position; 679 if((terminal("|").success && parse_WS().success && parse_Term().assignCat!(Term[])(bind_terms) && parse_WS().success)){ 649 680 clearErrors(); 650 goto loop 49;681 goto loop51; 651 682 }else{ 652 position = start4 4;653 goto loopend5 0;654 } 655 } 656 loopend5 0:683 position = start46; 684 goto loopend52; 685 } 686 } 687 loopend52: 657 688 {/*do nothing*/} 658 689 } 690 goto match49; 691 mismatch50: 692 setError("Expected Term."); 693 position = start44; 694 goto mismatch48; 695 match49: 696<
