Diff
Not logged in

Differences From Artifact [50e0836a1ece20de]:

To Artifact [bacc00f3f91907a9]:


114 if( layer.empty && !tryEat(kwd="let") && !tryEat(kwd="va 114 if( layer.empty && !tryEat(kwd="let") && !tryEat(kwd="va 115 return null; // none of {@lay, let, var, def} oc 115 return null; // none of {@lay, let, var, def} oc 116 116 117 auto varpos = currentPosition(); 117 auto varpos = currentPosition(); 118 string var = eatId("after "~kwd, AllowQuoted); // name o 118 string var = eatId("after "~kwd, AllowQuoted); // name o 119 119 120 auto e = tryEat("(") 120 auto e = tryEat("(") 121 ? parseLambdaAfterOpenParen(varpos) // let var | 121 ? parseLambdaAfterOpenParen(pos) // let var ( . 122 : (eat("=", "after "~kwd), E(0)); // let var | 122 : (eat("=", "after "~kwd), E(0)); // let var = . 123 if( moreDeclarationExists() ) 123 if( moreDeclarationExists() ) 124 return new Let(pos, var, layer, e, Body()); 124 return new Let(pos, var, layer, e, Body()); 125 else 125 else 126 return new Let(pos, var, layer, e, new Var(varpo 126 return new Let(pos, var, layer, e, new Var(varpo 127 } 127 } 128 } 128 } 129 129 ................................................................................................................................................................................ 480 480 481 AST parseId() 481 AST parseId() 482 { 482 { 483 scope(exit) lex.popFront; 483 scope(exit) lex.popFront; 484 return new Str(currentPosition(), lex.front.str); 484 return new Str(currentPosition(), lex.front.str); 485 } 485 } 486 486 487 AST parseLambdaAfterOpenParen(immutable LexPosition pos) | 487 AST parseLambdaAfterOpenParen(LexPosition pos) 488 { 488 { 489 Parameter[] params; 489 Parameter[] params; 490 while( !tryEat(")") ) 490 while( !tryEat(")") ) 491 { 491 { 492 params ~= parseParam(); 492 params ~= parseParam(); 493 if( !tryEat(",") ) { 493 if( !tryEat(",") ) { 494 eat(")", "after function parameters"); 494 eat(")", "after function parameters"); ................................................................................................................................................................................ 559 } 559 } 560 560 561 AST doNothingExpression() 561 AST doNothingExpression() 562 { 562 { 563 return new Str(currentPosition(), "(empty function body)"); 563 return new Str(currentPosition(), "(empty function body)"); 564 } 564 } 565 565 566 immutable(LexPosition) currentPosition() | 566 LexPosition currentPosition() 567 { 567 { 568 return lex.empty ? null : lex.front.pos; 568 return lex.empty ? null : lex.front.pos; 569 } 569 } 570 } 570 } 571 571 572 unittest 572 unittest 573 { 573 {