use of com.google.javascript.jscomp.parsing.parser.trees.ParseTree in project closure-compiler by google.
the class Parser method parseRelational.
// 11.8 Relational
private ParseTree parseRelational(Expression expressionIn) {
SourcePosition start = getTreeStartLocation();
ParseTree left = parseShiftExpression();
while (peekRelationalOperator(expressionIn)) {
Token operator = nextToken();
ParseTree right = parseShiftExpression();
left = new BinaryOperatorTree(getTreeLocation(start), left, operator, right);
}
return left;
}
use of com.google.javascript.jscomp.parsing.parser.trees.ParseTree in project closure-compiler by google.
the class Parser method parseYield.
// yield [no line terminator] (*)? AssignExpression
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-runtime-semantics-evaluation
private ParseTree parseYield(Expression expressionIn) {
SourcePosition start = getTreeStartLocation();
eat(TokenType.YIELD);
boolean isYieldAll = false;
ParseTree expression = null;
if (!peekImplicitSemiColon()) {
isYieldAll = eatOpt(TokenType.STAR) != null;
if (peekAssignmentExpression()) {
expression = parseAssignment(expressionIn);
} else if (isYieldAll) {
reportError("yield* requires an expression");
}
}
return new YieldExpressionTree(getTreeLocation(start), isYieldAll, expression);
}
use of com.google.javascript.jscomp.parsing.parser.trees.ParseTree in project closure-compiler by google.
the class Parser method parseCatch.
private CatchTree parseCatch() {
SourcePosition start = getTreeStartLocation();
CatchTree catchBlock;
eat(TokenType.CATCH);
ParseTree exception = new EmptyStatementTree(new SourceRange(getTreeEndLocation(), getTreeStartLocation()));
if (peekToken().type == TokenType.OPEN_PAREN) {
eat(TokenType.OPEN_PAREN);
if (peekPatternStart()) {
exception = parsePattern(PatternKind.INITIALIZER);
} else {
exception = parseIdentifierExpression();
}
eat(TokenType.CLOSE_PAREN);
} else {
recordFeatureUsed(Feature.OPTIONAL_CATCH_BINDING);
}
BlockTree catchBody = parseBlock();
catchBlock = new CatchTree(getTreeLocation(start), exception, catchBody);
return catchBlock;
}
use of com.google.javascript.jscomp.parsing.parser.trees.ParseTree in project closure-compiler by google.
the class Parser method parseBitwiseAND.
// 11.10 Bitwise AND
private ParseTree parseBitwiseAND(Expression expressionIn) {
SourcePosition start = getTreeStartLocation();
ParseTree left = parseEquality(expressionIn);
while (peek(TokenType.AMPERSAND)) {
Token operator = eat(TokenType.AMPERSAND);
ParseTree right = parseEquality(expressionIn);
left = new BinaryOperatorTree(getTreeLocation(start), left, operator, right);
}
return left;
}
use of com.google.javascript.jscomp.parsing.parser.trees.ParseTree in project closure-compiler by google.
the class Parser method parseMultiplicativeExpression.
// 11.5 Multiplicative Expression
private ParseTree parseMultiplicativeExpression() {
SourcePosition start = getTreeStartLocation();
ParseTree left = parseExponentiationExpression();
while (peekMultiplicativeOperator()) {
Token operator = nextToken();
ParseTree right = parseExponentiationExpression();
left = new BinaryOperatorTree(getTreeLocation(start), left, operator, right);
}
return left;
}
Aggregations