use of com.google.javascript.jscomp.parsing.parser.trees.ComprehensionTree in project closure-compiler by google.
the class Parser method parseComprehension.
private ParseTree parseComprehension(ComprehensionTree.ComprehensionType type, TokenType startToken, TokenType endToken) {
SourcePosition start = getTreeStartLocation();
eat(startToken);
ImmutableList.Builder<ParseTree> children = ImmutableList.builder();
while (peek(TokenType.FOR) || peek(TokenType.IF)) {
if (peek(TokenType.FOR)) {
children.add(parseComprehensionFor());
} else {
children.add(parseComprehensionIf());
}
}
ParseTree tailExpression = parseAssignmentExpression();
eat(endToken);
return new ComprehensionTree(getTreeLocation(start), type, children.build(), tailExpression);
}
Aggregations