public class StmtExpression : ASTStatement
{
- ListExp expressions;
+ ExpList expressions;
void print()
{
StmtExpression ::parse()
{
- ListExp exp = ListExp::parse();
+ ExpList exp = ExpList::parse();
if(exp)
{
StmtExpression stmt { expressions = exp };
public class StmtIf : ASTStatement
{
- ListExp exp;
+ ExpList exp;
ASTStatement stmt;
ASTStatement elseStmt;
if(elseStmt._class != class(StmtCompound)) elseStmt.print();
if(elseStmt._class == class(StmtExpression)) PrintLn("");
indent--;
- }
+ }
}
StmtIf ::parse()
if(peekToken().type == '(')
{
readToken();
- stmt.exp = ListExp::parse();
+ stmt.exp = ExpList::parse();
if(peekToken().type == ')') readToken();
stmt.stmt = ASTStatement::parse();
if(peekToken().type == ELSE)
public class StmtSwitch : ASTStatement
{
- ListExp exp;
+ ExpList exp;
ASTStatement stmt;
void print()
if(peekToken().type == '(')
{
readToken();
- stmt.exp = ListExp::parse();
+ stmt.exp = ExpList::parse();
if(peekToken().type == ')') readToken();
stmt.stmt = ASTStatement::parse();
}
public class StmtWhile : ASTStatement
{
- ListExp exp;
+ ExpList exp;
ASTStatement stmt;
StmtWhile ::parse()
if(peekToken().type == '(')
{
readToken();
- stmt.exp = ListExp::parse();
+ stmt.exp = ExpList::parse();
if(peekToken().type == ')') readToken();
stmt.stmt = ASTStatement::parse();
}
public class StmtDoWhile : ASTStatement
{
- ListExp exp;
+ ExpList exp;
ASTStatement stmt;
StmtDoWhile ::parse()
if(peekToken().type == '(')
{
readToken();
- stmt.exp = ListExp::parse();
+ stmt.exp = ExpList::parse();
if(peekToken().type == ')') readToken();
}
if(peekToken().type == ';') readToken();
{
ASTStatement init;
ASTStatement check;
- ListExp increment;
+ ExpList increment;
ASTStatement stmt;
void print()
readToken();
stmt.init = ASTStatement::parse();
stmt.check = ASTStatement::parse();
- stmt.increment = ListExp::parse();
+ stmt.increment = ExpList::parse();
if(peekToken().type == ')')
{
readToken();
stmt.stmt = ASTStatement::parse();
- }
+ }
}
return stmt;
}
public class StmtReturn : ASTStatement
{
- ListExp exp;
+ ExpList exp;
void print()
{
Print("return");
{
StmtReturn stmt { };
readToken();
- if(peekToken().type != ';') stmt.exp = ListExp::parse();
+ if(peekToken().type != ';') stmt.exp = ExpList::parse();
if(peekToken().type == ';') readToken();
return stmt;
}
public class StmtForEach : ASTStatement
{
Identifier id;
- ListExp exp;
- ListExp filter;
+ ExpList exp;
+ ExpList filter;
Statement stmt;
}