private VanguardParser getVanguardParser() { if (this.vanguardParser == null) { this.vanguardScanner = new VanguardScanner(this.sourceLevel, this.complianceLevel); this.vanguardParser = new VanguardParser(this.vanguardScanner); this.vanguardScanner.setActiveParser(this.vanguardParser); } this.vanguardScanner.setSource(this.source); this.vanguardScanner.resetTo(this.startPosition, this.eofPosition - 1, isInModuleDeclaration(), this.scanContext); return this.vanguardParser; }
@Override public int getNextToken() throws InvalidInputException { int token; if (this.nextToken != TokenNameNotAToken) { token = this.nextToken; this.nextToken = TokenNameNotAToken; return token; // presumed to be unambiguous. } if (this.scanContext == null) { // init lazily, since isInModuleDeclaration may need the parser to be known this.scanContext = isInModuleDeclaration() ? ScanContext.EXPECTING_KEYWORD : ScanContext.INACTIVE; } token = getNextToken0(); if (areRestrictedModuleKeywordsActive()) { if (isRestrictedKeyword(token)) token = disambiguatedRestrictedKeyword(token); updateScanContext(token); } if (token == TokenNameAT && atTypeAnnotation()) { if (((VanguardParser) this.activeParser).currentGoal == Goal.LambdaParameterListGoal) { token = disambiguatedToken(token); } else { token = TokenNameAT308; } } return token == TokenNameEOF ? TokenNameNotAToken : token; } }
} else { getVanguardParser(); this.vanguardScanner.resetTo(this.currentPosition, this.eofPosition - 1, true, ScanContext.EXPECTING_IDENTIFIER); try { int lookAhead = this.vanguardScanner.getNextToken(); if (lookAhead == TokenNameSEMICOLON) token = TokenNameIdentifier;
} else { getVanguardParser(); this.vanguardScanner.resetTo(this.currentPosition, this.eofPosition - 1, true, ScanContext.EXPECTING_IDENTIFIER); try { int lookAhead = this.vanguardScanner.getNextToken(); if (lookAhead == TokenNameSEMICOLON) token = TokenNameIdentifier;
private int disambiguatedToken(int token) { final VanguardParser parser = getVanguardParser(); if (token == TokenNameLPAREN && maybeAtLambdaOrCast()) { if (parser.parse(Goal.LambdaParameterListGoal) == VanguardParser.SUCCESS) { this.nextToken = TokenNameLPAREN; return TokenNameBeginLambda; } this.vanguardScanner.resetTo(this.startPosition, this.eofPosition - 1); if (parser.parse(Goal.IntersectionCastGoal) == VanguardParser.SUCCESS) { this.nextToken = TokenNameLPAREN; return TokenNameBeginIntersectionCast; } } else if (token == TokenNameLESS && maybeAtReferenceExpression()) { if (parser.parse(Goal.ReferenceExpressionGoal) == VanguardParser.SUCCESS) { this.nextToken = TokenNameLESS; return TokenNameBeginTypeArguments; } } else if (token == TokenNameAT && atTypeAnnotation()) { token = TokenNameAT308; if (maybeAtEllipsisAnnotationsStart()) { if (parser.parse(Goal.VarargTypeAnnotationGoal) == VanguardParser.SUCCESS) { this.consumingEllipsisAnnotations = true; this.nextToken = TokenNameAT308; return TokenNameAT308DOTDOTDOT; } } } return token; }
int disambiguatedToken(int token) { final VanguardParser parser = getVanguardParser(); if (token == TokenNameLPAREN && maybeAtLambdaOrCast()) { if (parser.parse(Goal.LambdaParameterListGoal) == VanguardParser.SUCCESS) { this.nextToken = TokenNameLPAREN; return TokenNameBeginLambda; } this.vanguardScanner.resetTo(this.startPosition, this.eofPosition - 1); if (parser.parse(Goal.IntersectionCastGoal) == VanguardParser.SUCCESS) { this.nextToken = TokenNameLPAREN; return TokenNameBeginIntersectionCast; } } else if (token == TokenNameLESS && maybeAtReferenceExpression()) { if (parser.parse(Goal.ReferenceExpressionGoal) == VanguardParser.SUCCESS) { this.nextToken = TokenNameLESS; return TokenNameBeginTypeArguments; } } else if (token == TokenNameAT && atTypeAnnotation()) { token = TokenNameAT308; if (maybeAtEllipsisAnnotationsStart()) { if (parser.parse(Goal.VarargTypeAnnotationGoal) == VanguardParser.SUCCESS) { this.consumingEllipsisAnnotations = true; this.nextToken = TokenNameAT308; return TokenNameAT308DOTDOTDOT; } } } return token; }
private int disambiguatedToken(int token) { final VanguardParser parser = getVanguardParser(); if (token == TokenNameLPAREN && maybeAtLambdaOrCast()) { if (parser.parse(Goal.LambdaParameterListGoal) == VanguardParser.SUCCESS) { this.nextToken = TokenNameLPAREN; return TokenNameBeginLambda; } this.vanguardScanner.resetTo(this.startPosition, this.eofPosition - 1); if (parser.parse(Goal.IntersectionCastGoal) == VanguardParser.SUCCESS) { this.nextToken = TokenNameLPAREN; return TokenNameBeginIntersectionCast; } } else if (token == TokenNameLESS && maybeAtReferenceExpression()) { if (parser.parse(Goal.ReferenceExpressionGoal) == VanguardParser.SUCCESS) { this.nextToken = TokenNameLESS; return TokenNameBeginTypeArguments; } } else if (token == TokenNameAT && atTypeAnnotation()) { token = TokenNameAT308; if (maybeAtEllipsisAnnotationsStart()) { if (parser.parse(Goal.VarargTypeAnnotationGoal) == VanguardParser.SUCCESS) { this.consumingEllipsisAnnotations = true; this.nextToken = TokenNameAT308; return TokenNameAT308DOTDOTDOT; } } } return token; }
int disambiguatedToken(int token) { final VanguardParser parser = getVanguardParser(); if (token == TokenNameLPAREN && maybeAtLambdaOrCast()) { if (parser.parse(Goal.LambdaParameterListGoal) == VanguardParser.SUCCESS) { this.nextToken = TokenNameLPAREN; return TokenNameBeginLambda; } this.vanguardScanner.resetTo(this.startPosition, this.eofPosition - 1); if (parser.parse(Goal.IntersectionCastGoal) == VanguardParser.SUCCESS) { this.nextToken = TokenNameLPAREN; return TokenNameBeginIntersectionCast; } } else if (token == TokenNameLESS && maybeAtReferenceExpression()) { if (parser.parse(Goal.ReferenceExpressionGoal) == VanguardParser.SUCCESS) { this.nextToken = TokenNameLESS; return TokenNameBeginTypeArguments; } } else if (token == TokenNameAT && atTypeAnnotation()) { token = TokenNameAT308; if (maybeAtEllipsisAnnotationsStart()) { if (parser.parse(Goal.VarargTypeAnnotationGoal) == VanguardParser.SUCCESS) { this.consumingEllipsisAnnotations = true; this.nextToken = TokenNameAT308; return TokenNameAT308DOTDOTDOT; } } } return token; }
int disambiguatedToken(int token) { final VanguardParser parser = getVanguardParser(); if (token == TokenNameLPAREN && maybeAtLambdaOrCast()) { if (parser.parse(Goal.LambdaParameterListGoal) == VanguardParser.SUCCESS) { this.nextToken = TokenNameLPAREN; return TokenNameBeginLambda; } this.vanguardScanner.resetTo(this.startPosition, this.eofPosition - 1); if (parser.parse(Goal.IntersectionCastGoal) == VanguardParser.SUCCESS) { this.nextToken = TokenNameLPAREN; return TokenNameBeginIntersectionCast; } } else if (token == TokenNameLESS && maybeAtReferenceExpression()) { if (parser.parse(Goal.ReferenceExpressionGoal) == VanguardParser.SUCCESS) { this.nextToken = TokenNameLESS; return TokenNameBeginTypeArguments; } } else if (token == TokenNameAT && atTypeAnnotation()) { token = TokenNameAT308; if (maybeAtEllipsisAnnotationsStart()) { if (parser.parse(Goal.VarargTypeAnnotationGoal) == VanguardParser.SUCCESS) { this.consumingEllipsisAnnotations = true; this.nextToken = TokenNameAT308; return TokenNameAT308DOTDOTDOT; } } } return token; }
private int disambiguatedToken(int token) { final VanguardParser parser = getVanguardParser(); if (token == TokenNameLPAREN && maybeAtLambdaOrCast()) { if (parser.parse(Goal.LambdaParameterListGoal) == VanguardParser.SUCCESS) { this.nextToken = TokenNameLPAREN; return TokenNameBeginLambda; } this.vanguardScanner.resetTo(this.startPosition, this.eofPosition - 1); if (parser.parse(Goal.IntersectionCastGoal) == VanguardParser.SUCCESS) { this.nextToken = TokenNameLPAREN; return TokenNameBeginIntersectionCast; } } else if (token == TokenNameLESS && maybeAtReferenceExpression()) { if (parser.parse(Goal.ReferenceExpressionGoal) == VanguardParser.SUCCESS) { this.nextToken = TokenNameLESS; return TokenNameBeginTypeArguments; } } else if (token == TokenNameAT && atTypeAnnotation()) { token = TokenNameAT308; if (maybeAtEllipsisAnnotationsStart()) { if (parser.parse(Goal.VarargTypeAnnotationGoal) == VanguardParser.SUCCESS) { this.consumingEllipsisAnnotations = true; this.nextToken = TokenNameAT308; return TokenNameAT308DOTDOTDOT; } } } return token; }
int disambiguatedToken(int token) { final VanguardParser parser = getVanguardParser(); if (token == TokenNameLPAREN && maybeAtLambdaOrCast()) { if (parser.parse(Goal.LambdaParameterListGoal) == VanguardParser.SUCCESS) { this.nextToken = TokenNameLPAREN; return TokenNameBeginLambda; } this.vanguardScanner.resetTo(this.startPosition, this.eofPosition - 1); if (parser.parse(Goal.IntersectionCastGoal) == VanguardParser.SUCCESS) { this.nextToken = TokenNameLPAREN; return TokenNameBeginIntersectionCast; } } else if (token == TokenNameLESS && maybeAtReferenceExpression()) { if (parser.parse(Goal.ReferenceExpressionGoal) == VanguardParser.SUCCESS) { this.nextToken = TokenNameLESS; return TokenNameBeginTypeArguments; } } else if (token == TokenNameAT && atTypeAnnotation()) { token = TokenNameAT308; if (maybeAtEllipsisAnnotationsStart()) { if (parser.parse(Goal.VarargTypeAnnotationGoal) == VanguardParser.SUCCESS) { this.consumingEllipsisAnnotations = true; this.nextToken = TokenNameAT308; return TokenNameAT308DOTDOTDOT; } } } return token; }
public int getNextToken() throws InvalidInputException { int token; if (this.nextToken != TokenNameNotAToken) { token = this.nextToken; this.nextToken = TokenNameNotAToken; return token; // presumed to be unambiguous. } if (this.scanContext == null) { // init lazily, since isInModuleDeclaration may need the parser to be known this.scanContext = isInModuleDeclaration() ? ScanContext.EXPECTING_KEYWORD : ScanContext.INACTIVE; } token = getNextToken0(); if (areRestrictedModuleKeywordsActive()) { if (isRestrictedKeyword(token)) token = disambiguatedRestrictedKeyword(token); updateScanContext(token); } if (token == TokenNameAT && atTypeAnnotation()) { if (((VanguardParser) this.activeParser).currentGoal == Goal.LambdaParameterListGoal) { token = disambiguatedToken(token); } else { token = TokenNameAT308; } } return token == TokenNameEOF ? TokenNameNotAToken : token; } }
int disambiguatedToken(int token) { final VanguardParser parser = getVanguardParser(); if (token == TokenNameLPAREN && maybeAtLambdaOrCast()) { if (parser.parse(Goal.LambdaParameterListGoal) == VanguardParser.SUCCESS) { this.nextToken = TokenNameLPAREN; return TokenNameBeginLambda; } this.vanguardScanner.resetTo(this.startPosition, this.eofPosition - 1); if (parser.parse(Goal.IntersectionCastGoal) == VanguardParser.SUCCESS) { this.nextToken = TokenNameLPAREN; return TokenNameBeginIntersectionCast; } } else if (token == TokenNameLESS && maybeAtReferenceExpression()) { if (parser.parse(Goal.ReferenceExpressionGoal) == VanguardParser.SUCCESS) { this.nextToken = TokenNameLESS; return TokenNameBeginTypeArguments; } } else if (token == TokenNameAT && atTypeAnnotation()) { token = TokenNameAT308; if (maybeAtEllipsisAnnotationsStart()) { if (parser.parse(Goal.VarargTypeAnnotationGoal) == VanguardParser.SUCCESS) { this.consumingEllipsisAnnotations = true; this.nextToken = TokenNameAT308; return TokenNameAT308DOTDOTDOT; } } } return token; }
public int getNextToken() throws InvalidInputException { int token; if (this.nextToken != TokenNameNotAToken) { token = this.nextToken; this.nextToken = TokenNameNotAToken; return token; // presumed to be unambiguous. } token = getNextToken0(); if (token == TokenNameAT && atTypeAnnotation()) { if (((VanguardParser) this.activeParser).currentGoal == Goal.LambdaParameterListGoal) { token = disambiguatedToken(token); } else { token = TokenNameAT308; } } return token == TokenNameEOF ? TokenNameNotAToken : token; } }
public int getNextToken() throws InvalidInputException { int token; if (this.nextToken != TokenNameNotAToken) { token = this.nextToken; this.nextToken = TokenNameNotAToken; return token; // presumed to be unambiguous. } token = getNextToken0(); if (token == TokenNameAT && atTypeAnnotation()) { if (((VanguardParser) this.activeParser).currentGoal == Goal.LambdaParameterListGoal) { token = disambiguatedToken(token); } else { token = TokenNameAT308; } } return token == TokenNameEOF ? TokenNameNotAToken : token; } }
public int getNextToken() throws InvalidInputException { int token; if (this.nextToken != TokenNameNotAToken) { token = this.nextToken; this.nextToken = TokenNameNotAToken; return token; // presumed to be unambiguous. } token = getNextToken0(); if (token == TokenNameAT && atTypeAnnotation()) { if (((VanguardParser) this.activeParser).currentGoal == Goal.LambdaParameterListGoal) { token = disambiguatedToken(token); } else { token = TokenNameAT308; } } return token == TokenNameEOF ? TokenNameNotAToken : token; } }
public int getNextToken() throws InvalidInputException { int token = getNextToken0(); if (token == TokenNameAT && atTypeAnnotation()) { token = TokenNameAT308; } return token == TokenNameEOF ? TokenNameNotAToken : token; } }
public int getNextToken() throws InvalidInputException { int token = getNextToken0(); if (token == TokenNameAT && atTypeAnnotation()) { token = TokenNameAT308; } return token == TokenNameEOF ? TokenNameNotAToken : token; } }
private VanguardParser getVanguardParser() { if (this.vanguardParser == null) { this.vanguardScanner = new VanguardScanner(this.sourceLevel, this.complianceLevel); this.vanguardParser = new VanguardParser(this.vanguardScanner); this.vanguardScanner.setActiveParser(this.vanguardParser); } this.vanguardScanner.setSource(this.source); this.vanguardScanner.resetTo(this.startPosition, this.eofPosition - 1); return this.vanguardParser; }
private VanguardParser getVanguardParser() { if (this.vanguardParser == null) { this.vanguardScanner = new VanguardScanner(this.sourceLevel, this.complianceLevel); this.vanguardParser = new VanguardParser(this.vanguardScanner); this.vanguardScanner.setActiveParser(this.vanguardParser); } this.vanguardScanner.setSource(this.source); this.vanguardScanner.resetTo(this.startPosition, this.eofPosition - 1); return this.vanguardParser; }