Added some throwing stubs to parser

This commit is contained in:
Brandon Dyck 2023-07-01 00:26:32 -06:00
parent 6fd622a573
commit 6ab36fc489

View File

@ -184,7 +184,7 @@ class Parser
Expr elseCase = expression();
return new If { Condition = condition, Then = thenCase, Else = elseCase };
case TokenType.When:
throw new NotImplementedException();
throw new NotImplementedException("TODO when");
}
return primary();
@ -207,6 +207,7 @@ class Parser
private Expr primary()
{
Expr expr = operand();
if (match(TokenType.Period))
{
Name? ident = name();
@ -216,14 +217,17 @@ class Parser
}
return new Selector { Left = expr, FieldName = ident };
}
if (match(TokenType.LBracket))
{
throw new NotImplementedException("TODO index");
}
if (match(TokenType.LParen))
{
throw new NotImplementedException("TODO apply");
}
return expr;
}
@ -247,6 +251,35 @@ class Parser
return new Grouping { Expression = expr };
}
Expr? expr;
if ((expr = record()) != null)
{
return expr;
}
if ((expr = variant()) != null)
{
return expr;
}
if ((expr = list()) != null)
{
return expr;
}
throw error(peek(), "Expect expression.");
}
private Expr? list()
{
throw new NotImplementedException("TODO list");
}
private Expr? variant()
{
throw new NotImplementedException("TODO variant");
}
private Expr? record()
{
throw new NotImplementedException("TODO record");
}
}