Skip to content

Commit 19a5215

Browse files
authored
added dog expression ("@")
1 parent c23c90d commit 19a5215

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

SourceCode/Parser/Parser.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,10 @@ private Expression primary()
593593
{
594594
return element();
595595
}
596+
if (lookMatch(0, TokenType.DOG))
597+
{
598+
return dog();
599+
}
596600
if (match(TokenType.WORD))
597601
{
598602
return new ConstantExpression(current.getText());
@@ -610,6 +614,15 @@ private Expression primary()
610614
throw new Exception("unknown expression");
611615
}
612616

617+
private DogExpression dog()
618+
{
619+
consume(TokenType.DOG);
620+
consume(TokenType.LDEF);
621+
List<string> argNames = new List<string>();
622+
Statement body = statementOrBlock();
623+
return new DogExpression(new LdefExpression(body, argNames));
624+
}
625+
613626
private Expression element()
614627
{
615628
string variable = consume(TokenType.WORD).getText();

0 commit comments

Comments
 (0)