private Statement parseFunctionDeclaration() throws CompilerException {
return new FunctionDeclaration(parseFunctionLiteral(true));
}
public Statement parseStatement() throws CompilerException {
Statement statement;
int lineNumber;
if (Config.LINENUMBER) {
lineNumber = getLineNumber();
}
if (nextToken == Token.OPERATOR_SEMICOLON) {
readToken(Token.OPERATOR_SEMICOLON);
statement = new EmptyStatement();
} else if (nextToken == Token.OPERATOR_OPENBRACE) {
statement = parseBlockStatement();
} else if (nextToken == Token.KEYWORD_BREAK) {
statement = parseBreakStatement();
} else if (nextToken == Token.KEYWORD_CONTINUE) {
statement = parseContinueStatement();
} else if (nextToken == Token.KEYWORD_DO) {
statement = parseDoStatement();
} else if (nextToken == Token.KEYWORD_FOR) {
statement = parseForStatement();
} else if (nextToken == Token.KEYWORD_IF) {
statement = parseIfStatement();
} else if (nextToken == Token.KEYWORD_RETURN) {
statement = parseReturnStatement();
} else if (nextToken == Token.KEYWORD_THROW) {
statement = parseThrowStatement();
} else if (nextToken == Token.KEYWORD_TRY) {
statement = parseTryStatement();
} else if (nextToken == Token.KEYWORD_SWITCH) {
statement = parseSwitchStatement();
} else if (nextToken == Token.KEYWORD_VAR) {
statement = parseVariableStatement();
} else if (nextToken == Token.KEYWORD_WHILE) {
statement = parseWhileStatement();
} else if (nextToken == Token.KEYWORD_WITH) {
statement = parseWithStatement();
} else {
statement = parseExpressionStatement();
}
if (Config.LINENUMBER) {
statement.setLineNumber(lineNumber);
}
return statement;
}