throws IOException
{
ArrayList<Statement> statementList = new ArrayList<Statement>();
while (true) {
Location location = getLocation();
int token = parseToken();
switch (token) {
case -1:
return statementList;
case ';':
break;
case ECHO:
parseEcho(statementList);
break;
case PRINT:
statementList.add(parsePrint());
break;
case UNSET:
parseUnset(statementList);
break;
case ABSTRACT:
case FINAL:
{
_peekToken = token;
int modifiers = 0;
do {
token = parseToken();
switch (token) {
case ABSTRACT:
modifiers |= M_ABSTRACT;
break;
case FINAL:
modifiers |= M_FINAL;
break;
case CLASS:
statementList.add(parseClassDefinition(modifiers));
break;
default:
throw error(L.l("expected 'class' at {0}",
tokenName(token)));
}
} while (token != CLASS);
}
break;
case FUNCTION:
{
Location functionLocation = getLocation();
Function fun = parseFunctionDefinition(M_STATIC);
if (! _isTop) {
statementList.add(_factory.createFunctionDef(functionLocation, fun));