use of com.google.javascript.jscomp.parsing.parser.util.SourcePosition in project closure-compiler by google.
the class Parser method parseVariableStatement.
// 12.2 Variable Statement
private VariableStatementTree parseVariableStatement() {
SourcePosition start = getTreeStartLocation();
VariableDeclarationListTree declarations = parseVariableDeclarationList();
eatPossiblyImplicitSemiColon();
return new VariableStatementTree(getTreeLocation(start), declarations);
}
use of com.google.javascript.jscomp.parsing.parser.util.SourcePosition in project closure-compiler by google.
the class Parser method parseSuperExpression.
private SuperExpressionTree parseSuperExpression() {
SourcePosition start = getTreeStartLocation();
eat(TokenType.SUPER);
if (peek(TokenType.QUESTION_DOT)) {
// super?.() not allowed
reportError("Optional chaining is forbidden in super?.");
}
return new SuperExpressionTree(getTreeLocation(start));
}
use of com.google.javascript.jscomp.parsing.parser.util.SourcePosition in project closure-compiler by google.
the class Parser method parseEmptyStatement.
// 12.3 Empty Statement
private EmptyStatementTree parseEmptyStatement() {
SourcePosition start = getTreeStartLocation();
eat(TokenType.SEMI_COLON);
return new EmptyStatementTree(getTreeLocation(start));
}
use of com.google.javascript.jscomp.parsing.parser.util.SourcePosition 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.util.SourcePosition 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);
}
Aggregations