use of com.google.javascript.jscomp.parsing.parser.trees.ForStatementTree in project closure-compiler by google.
the class Parser method parseForStatement.
// 12.6.3 The for Statement
private ParseTree parseForStatement(SourcePosition start, ParseTree initializer) {
if (initializer == null) {
initializer = new NullTree(new SourceRange(getTreeEndLocation(), getTreeStartLocation()));
}
eat(TokenType.SEMI_COLON);
ParseTree condition;
if (!peek(TokenType.SEMI_COLON)) {
condition = parseExpression();
} else {
condition = new NullTree(new SourceRange(getTreeEndLocation(), getTreeStartLocation()));
}
eat(TokenType.SEMI_COLON);
ParseTree increment;
if (!peek(TokenType.CLOSE_PAREN)) {
increment = parseExpression();
} else {
increment = new NullTree(new SourceRange(getTreeEndLocation(), getTreeStartLocation()));
}
eat(TokenType.CLOSE_PAREN);
ParseTree body = parseStatement();
return new ForStatementTree(getTreeLocation(start), initializer, condition, increment, body);
}
Aggregations