private AST statementList(bool isInMainScope)
{
#if WRITE_DEBUG_INFO
Console.WriteLine("statement list");
#endif
AST statementListTree = new AST(new Token(Token.TokenType.STATEMENT_LIST, "<STATEMENT_LIST>"));
while (lookAheadType(1) != Token.TokenType.EOF &&
lookAheadType(1) != Token.TokenType.ELSE)
{
if(lookAheadType(1) == Token.TokenType.BLOCK_END) {
if(isInMainScope) {
m_errorHandler.errorOccured("Found the word 'end' where it makes no sense",
Error.ErrorType.SYNTAX, lookAhead(1).LineNr, lookAhead(1).LinePosition);
}
break;
}
AST statementTree = statement();
if(statementTree != null) {
statementListTree.addChild(statementTree);
}
else {
#if WRITE_DEBUG_INFO
Console.WriteLine("null statement");
#endif
}
}
return statementListTree;
}