Search in sources :

Example 1 with WhileStatementTree

use of com.google.javascript.jscomp.parsing.parser.trees.WhileStatementTree in project closure-compiler by google.

the class Parser method parseWhileStatement.

// 12.6.2 The while Statement
private ParseTree parseWhileStatement() {
    SourcePosition start = getTreeStartLocation();
    eat(TokenType.WHILE);
    eat(TokenType.OPEN_PAREN);
    ParseTree condition = parseExpression();
    eat(TokenType.CLOSE_PAREN);
    ParseTree body = parseStatement();
    return new WhileStatementTree(getTreeLocation(start), condition, body);
}
Also used : DoWhileStatementTree(com.google.javascript.jscomp.parsing.parser.trees.DoWhileStatementTree) WhileStatementTree(com.google.javascript.jscomp.parsing.parser.trees.WhileStatementTree) SourcePosition(com.google.javascript.jscomp.parsing.parser.util.SourcePosition) ParseTree(com.google.javascript.jscomp.parsing.parser.trees.ParseTree)

Aggregations

DoWhileStatementTree (com.google.javascript.jscomp.parsing.parser.trees.DoWhileStatementTree)1 ParseTree (com.google.javascript.jscomp.parsing.parser.trees.ParseTree)1 WhileStatementTree (com.google.javascript.jscomp.parsing.parser.trees.WhileStatementTree)1 SourcePosition (com.google.javascript.jscomp.parsing.parser.util.SourcePosition)1