@Override protected SelectionParser createSnapShotParser() { return new SelectionParser(this.problemReporter); } @Override
protected void consumeMarkerAnnotation(boolean isTypeAnnotation) { int index; if ((index = this.indexOfAssistIdentifier()) < 0) { super.consumeMarkerAnnotation(isTypeAnnotation); return; char[][] subset = identifierSubSet(index); this.identifierLengthPtr--; this.identifierPtr -= length; typeReference = createSingleAssistTypeReference( assistIdentifier(), positions[0]); } else { typeReference = createQualifiedAssistTypeReference( subset, assistIdentifier(), positions); markerAnnotation.declarationSourceEnd = markerAnnotation.sourceEnd; if (isTypeAnnotation) { pushOnTypeAnnotationStack(markerAnnotation); } else { pushOnExpressionStack(markerAnnotation);
protected void updateRecoveryState() { /* expose parser state to recovery state */ this.currentElement.updateFromParserState(); /* may be able to retrieve completionNode as an orphan, and then attach it */ selectionIdentifierCheck(); attachOrphanCompletionNode(); // if an assist node has been found and a recovered element exists, // mark enclosing blocks as to be preserved if (this.assistNode != null && this.currentElement != null) { this.currentElement.preserveEnclosingBlocks(); } /* check and update recovered state based on current token, this action is also performed when shifting token after recovery got activated once. */ recoveryTokenCheck(); }
if ((index = indexOfAssistIdentifier()) < 0) { super.consumeTypeImportOnDemandDeclarationName(); return; char[][] subset = identifierSubSet(index+1); // include the assistIdentifier this.identifierLengthPtr--; this.identifierPtr -= length; ImportReference reference = createAssistImportReference(subset, positions, ClassFileConstants.AccDefault); reference.bits |= ASTNode.OnDemand; this.lastCheckPoint = reference.sourceEnd + 1; pushOnAstStack(reference); reference.declarationSourceEnd = flushCommentsDefinedPriorTo(reference.declarationSourceEnd);
if ((completionIndex = indexOfAssistIdentifier()) < 0) { return super.getUnspecifiedReference(rejectTypeAnnotations); consumeNonTypeUseName(); if (CharOperation.equals(assistIdentifier(), SUPER)){ Reference reference; if (completionIndex > 0){ // qualified super pushOnGenericsLengthStack(0); pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]); for (int i = 0; i < completionIndex; i++) { pushOnTypeAnnotationLengthStack(0); getTypeReference(0), (int)(this.identifierPositionStack[ptr+1] >>> 32), (int) this.identifierPositionStack[ptr+1]); pushOnAstStack(reference); this.assistNode = reference; this.lastCheckPoint = reference.sourceEnd + 1; char[][] subset = identifierSubSet(completionIndex); this.identifierLengthPtr--; this.identifierPtr -= length; nameReference = createSingleAssistNameReference(assistIdentifier(), positions[0]); } else {
&& (this.astStack[this.astPtr] == null)) { if (this.indexOfAssistIdentifier() < 0) { super.consumeClassInstanceCreationExpressionWithTypeArguments(); return; char [] oldIdent = assistIdentifier(); setAssistIdentifier(null); alloc.type = getTypeReference(0); checkForDiamond(alloc.type); setAssistIdentifier(oldIdent); pushOnExpressionStack(alloc);
if(selector == assistIdentifier()) { if(CharOperation.equals(selector, SUPER)) { accessMode = ExplicitConstructorCall.Super; pushOnAstStack(constructorCall); this.restartRecovery = true; // force to restart in recovery mode this.lastIgnoredToken = -1; } else { pushOnExpressionStack(new Expression(){ public TypeBinding resolveType(BlockScope scope) { constructorCall.resolve(scope);
buildMoreCompletionContext((Expression)orphan); } else { if (lastIndexOfElement(K_LAMBDA_EXPRESSION_DELIMITER) < 0) { // lambdas are recovered up to the containing expression statement and will carry along the assist node anyways. Statement statement = (Statement) orphan; this.currentElement = this.currentElement.add(statement, 0); if (!isIndirectlyInsideLambdaExpression()) this.currentToken = 0; // given we are not on an eof, we do not want side effects caused by looked-ahead token
public ReferenceExpression newReferenceExpression() { char[] selector = this.identifierStack[this.identifierPtr]; if (selector != assistIdentifier()){ return super.newReferenceExpression(); } ReferenceExpression referenceExpression = new SelectionOnReferenceExpressionName(); this.assistNode = referenceExpression; return referenceExpression; } protected MessageSend newMessageSend() {
public void selectionIdentifierCheck(){ if (checkRecoveredType()) return; } @Override
protected void attachOrphanCompletionNode(){ if (this.isOrphanCompletionNode){ ASTNode orphan = this.assistNode; this.isOrphanCompletionNode = false; /* if in context of a type, then persists the identifier into a fake field return type */ if (this.currentElement instanceof RecoveredType){ RecoveredType recoveredType = (RecoveredType)this.currentElement; /* filter out cases where scanner is still inside type header */ if (recoveredType.foundOpeningBrace) { /* generate a pseudo field with a completion on type reference */ if (orphan instanceof TypeReference){ this.currentElement = this.currentElement.add(new SelectionOnFieldType((TypeReference)orphan), 0); return; } } } if (orphan instanceof Expression) { buildMoreCompletionContext((Expression)orphan); } else { Statement statement = (Statement) orphan; this.currentElement = this.currentElement.add(statement, 0); } this.currentToken = 0; // given we are not on an eof, we do not want side effects caused by looked-ahead token } } private void buildMoreCompletionContext(Expression expression) {
if ((completionIndex = indexOfAssistIdentifier()) < 0) { return super.getUnspecifiedReference(rejectTypeAnnotations); consumeNonTypeUseName(); if (CharOperation.equals(assistIdentifier(), SUPER)){ Reference reference; if (completionIndex > 0){ // qualified super pushOnGenericsLengthStack(0); pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]); for (int i = 0; i < completionIndex; i++) { pushOnTypeAnnotationLengthStack(0); getTypeReference(0), (int)(this.identifierPositionStack[ptr+1] >>> 32), (int) this.identifierPositionStack[ptr+1]); pushOnAstStack(reference); this.assistNode = reference; this.lastCheckPoint = reference.sourceEnd + 1; char[][] subset = identifierSubSet(completionIndex); this.identifierLengthPtr--; this.identifierPtr -= length; nameReference = createSingleAssistNameReference(assistIdentifier(), positions[0]); } else {
if ((index = indexOfAssistIdentifier()) < 0) { super.consumeStaticImportOnDemandDeclarationName(); return; char[][] subset = identifierSubSet(index+1); // include the assistIdentifier this.identifierLengthPtr--; this.identifierPtr -= length; ImportReference reference = createAssistImportReference(subset, positions, ClassFileConstants.AccStatic); reference.bits |= ASTNode.OnDemand; this.lastCheckPoint = reference.sourceEnd + 1; pushOnAstStack(reference); reference.declarationSourceEnd = flushCommentsDefinedPriorTo(reference.declarationSourceEnd);
&& (this.astStack[this.astPtr] == null)) { if (this.indexOfAssistIdentifier() < 0) { super.consumeClassInstanceCreationExpressionWithTypeArguments(); return; char [] oldIdent = assistIdentifier(); setAssistIdentifier(null); alloc.type = getTypeReference(0); setAssistIdentifier(oldIdent); pushOnExpressionStack(alloc);
if(selector == assistIdentifier()) { if(CharOperation.equals(selector, SUPER)) { accessMode = ExplicitConstructorCall.Super; pushOnAstStack(constructorCall); this.restartRecovery = true; // force to restart in recovery mode this.lastIgnoredToken = -1; } else { pushOnExpressionStack(new Expression(){ public TypeBinding resolveType(BlockScope scope) { constructorCall.resolve(scope);
buildMoreCompletionContext((Expression)orphan); } else { if (lastIndexOfElement(K_LAMBDA_EXPRESSION_DELIMITER) < 0) { // lambdas are recovered up to the containing expression statement and will carry along the assist node anyways. Statement statement = (Statement) orphan; this.currentElement = this.currentElement.add(statement, 0); if (!isIndirectlyInsideLambdaExpression()) this.currentToken = 0; // given we are not on an eof, we do not want side effects caused by looked-ahead token
public ReferenceExpression newReferenceExpression() { char[] selector = this.identifierStack[this.identifierPtr]; if (selector != assistIdentifier()){ return super.newReferenceExpression(); } ReferenceExpression referenceExpression = new SelectionOnReferenceExpressionName(); this.assistNode = referenceExpression; return referenceExpression; } protected MessageSend newMessageSend() {
public void selectionIdentifierCheck(){ if (checkRecoveredType()) return; } public void setAssistIdentifier(char[] assistIdent){
protected void consumeMarkerAnnotation() { int index; if ((index = this.indexOfAssistIdentifier()) < 0) { super.consumeMarkerAnnotation(); return; char[][] subset = identifierSubSet(index); this.identifierLengthPtr--; this.identifierPtr -= length; typeReference = createSingleAssistTypeReference( assistIdentifier(), positions[0]); } else { typeReference = createQualifiedAssistTypeReference( subset, assistIdentifier(), positions); pushOnExpressionStack(markerAnnotation);
if ((completionIndex = indexOfAssistIdentifier()) < 0) { return super.getUnspecifiedReference(rejectTypeAnnotations); consumeNonTypeUseName(); if (CharOperation.equals(assistIdentifier(), SUPER)){ Reference reference; if (completionIndex > 0){ // qualified super pushOnGenericsLengthStack(0); pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]); for (int i = 0; i < completionIndex; i++) { pushOnTypeAnnotationLengthStack(0); getTypeReference(0), (int)(this.identifierPositionStack[ptr+1] >>> 32), (int) this.identifierPositionStack[ptr+1]); pushOnAstStack(reference); this.assistNode = reference; this.lastCheckPoint = reference.sourceEnd + 1; char[][] subset = identifierSubSet(completionIndex); this.identifierLengthPtr--; this.identifierPtr -= length; nameReference = createSingleAssistNameReference(assistIdentifier(), positions[0]); } else {