@Override public void initializeParser() { this.parser = new CommentRecorderParser(this.problemReporter, false); } @Override
flushCommentsDefinedPriorTo(this.endStatementPosition); checkAndSetModifiers(ClassFileConstants.AccDeprecated);
@Override protected void consumeAnnotationTypeDeclarationHeaderName() { int currentAstPtr = this.astPtr; super.consumeAnnotationTypeDeclarationHeaderName(); if (this.astPtr > currentAstPtr) // if ast node was pushed on the ast stack rememberCategories(); } @Override
new DefaultProblemFactory(Locale.getDefault())); CommentRecorderParser parser = new CommentRecorderParser(problemReporter, false); parser.setMethodsFullRecovery(false); parser.setStatementsRecovery(enabledStatementRecovery); ASTNode[] result = parser.parseClassBodyDeclarations(source, offset, length, compilationUnitDeclaration);
compilerOptions, new DefaultProblemFactory(Locale.getDefault())); CommentRecorderParser parser = new CommentRecorderParser(problemReporter, false); parser.setMethodsFullRecovery(false); parser.setStatementsRecovery(enabledStatementRecovery); parser.parse(constructorDeclaration, compilationUnitDeclaration, true);
CompilationUnitDeclaration unit = result[i]; CommentRecorderParser parser = new CommentRecorderParser( new ProblemReporter( DefaultErrorHandlingPolicies.proceedWithAllProblems(), CompilationUnitDeclaration tmpDeclForComment = parser.dietParse(sourceUnit, compilationResult); unit.comments = tmpDeclForComment.comments;
public Expression parseExpression(char[] source, int offset, int length, Map<String, String> settings, boolean recordParsingInformation) { if (source == null) { throw new IllegalArgumentException(); } CompilerOptions compilerOptions = new CompilerOptions(settings); // in this case we don't want to ignore method bodies since we are parsing only an expression final ProblemReporter problemReporter = new ProblemReporter( DefaultErrorHandlingPolicies.proceedWithAllProblems(), compilerOptions, new DefaultProblemFactory(Locale.getDefault())); CommentRecorderParser parser = new CommentRecorderParser(problemReporter, false); ICompilationUnit sourceUnit = new CompilationUnit( source, "", //$NON-NLS-1$ compilerOptions.defaultEncoding); CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, compilerOptions.maxProblemsPerUnit); CompilationUnitDeclaration unit = new CompilationUnitDeclaration(problemReporter, compilationResult, source.length); Expression result = parser.parseExpression(source, offset, length, unit, true /* record line separators */); if (recordParsingInformation) { this.recordedParsingInformation = getRecordedParsingInformation(compilationResult, unit.comments); } return result; }
protected void consumeClassHeaderName1() { int currentAstPtr = this.astPtr; super.consumeClassHeaderName1(); if (this.astPtr > currentAstPtr) // if ast node was pushed on the ast stack rememberCategories(); } protected void consumeClassInstanceCreationExpressionWithTypeArguments() {
protected void consumeCatchFormalParameter() { super.consumeCatchFormalParameter(); // Flush comments prior to this formal parameter so the declarationSourceStart of the following parameter // is correctly set (see bug 80904) // Note that this could be done in the Parser itself, but this would slow down all parsers, when they don't need // the declarationSourceStart to be set flushCommentsDefinedPriorTo(this.scanner.currentPosition); } protected void consumeClassHeaderName1() {
protected void consumeAnnotationAsModifier() { super.consumeAnnotationAsModifier(); Annotation annotation = (Annotation)this.expressionStack[this.expressionPtr]; if (this.reportReferenceInfo) { // accept annotation type reference this.requestor.acceptAnnotationTypeReference(annotation.type.getTypeName(), annotation.sourceStart, annotation.sourceEnd); } } protected void consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() {
@Override protected void consumeAnnotationTypeDeclarationHeaderNameWithTypeParameters() { int currentAstPtr = this.astPtr; super.consumeAnnotationTypeDeclarationHeaderNameWithTypeParameters(); if (this.astPtr > currentAstPtr) // if ast node was pushed on the ast stack rememberCategories(); } @Override
protected void classInstanceCreation(boolean alwaysQualified) { boolean previousFlag = this.reportReferenceInfo; this.reportReferenceInfo = false; // not to see the type reference reported in super call to getTypeReference(...) super.classInstanceCreation(alwaysQualified); this.reportReferenceInfo = previousFlag; if (this.reportReferenceInfo){ AllocationExpression alloc = (AllocationExpression)this.expressionStack[this.expressionPtr]; TypeReference typeRef = alloc.type; this.requestor.acceptConstructorReference( typeRef instanceof SingleTypeReference ? ((SingleTypeReference) typeRef).token : CharOperation.concatWith(alloc.type.getParameterizedTypeName(), '.'), alloc.arguments == null ? 0 : alloc.arguments.length, alloc.sourceStart); } } protected void consumeAnnotationAsModifier() {
@Override protected void consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() { boolean previousFlag = this.reportReferenceInfo; this.reportReferenceInfo = false; // not to see the type reference reported in super call to getTypeReference(...) super.consumeClassInstanceCreationExpressionQualifiedWithTypeArguments(); this.reportReferenceInfo = previousFlag; if (this.reportReferenceInfo){ AllocationExpression alloc = (AllocationExpression)this.expressionStack[this.expressionPtr]; TypeReference typeRef = alloc.type; this.requestor.acceptConstructorReference( typeRef instanceof SingleTypeReference ? ((SingleTypeReference) typeRef).token : CharOperation.concatWith(alloc.type.getParameterizedTypeName(), '.'), alloc.arguments == null ? 0 : alloc.arguments.length, alloc.sourceStart); } } @Override
new DefaultProblemFactory(Locale.getDefault())); CommentRecorderParser parser = new CommentRecorderParser(problemReporter, false); parser.setMethodsFullRecovery(false); parser.setStatementsRecovery(enabledStatementRecovery); ASTNode[] result = parser.parseClassBodyDeclarations(source, offset, length, compilationUnitDeclaration);
compilerOptions, new DefaultProblemFactory(Locale.getDefault())); CommentRecorderParser parser = new CommentRecorderParser(problemReporter, false); parser.setMethodsFullRecovery(false); parser.setStatementsRecovery(enabledStatementRecovery); parser.parse(constructorDeclaration, compilationUnitDeclaration, true);
compilerOptions.ignoreMethodBodies = this.ignoreMethodBodies; CommentRecorderParser parser = new CommentRecorderParser( new ProblemReporter( DefaultErrorHandlingPolicies.proceedWithAllProblems(), compilerOptions.defaultEncoding); final CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, compilerOptions.maxProblemsPerUnit); CompilationUnitDeclaration compilationUnitDeclaration = parser.dietParse(sourceUnit, compilationResult);
public Expression parseExpression(char[] source, int offset, int length, Map settings, boolean recordParsingInformation) { if (source == null) { throw new IllegalArgumentException(); } CompilerOptions compilerOptions = new CompilerOptions(settings); // in this case we don't want to ignore method bodies since we are parsing only an expression final ProblemReporter problemReporter = new ProblemReporter( DefaultErrorHandlingPolicies.proceedWithAllProblems(), compilerOptions, new DefaultProblemFactory(Locale.getDefault())); CommentRecorderParser parser = new CommentRecorderParser(problemReporter, false); ICompilationUnit sourceUnit = new CompilationUnit( source, "", //$NON-NLS-1$ compilerOptions.defaultEncoding); CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, compilerOptions.maxProblemsPerUnit); CompilationUnitDeclaration unit = new CompilationUnitDeclaration(problemReporter, compilationResult, source.length); Expression result = parser.parseExpression(source, offset, length, unit, true /* record line separators */); if (recordParsingInformation) { this.recordedParsingInformation = getRecordedParsingInformation(compilationResult, unit.comments); } return result; }
protected void consumeClassHeaderName1() { int currentAstPtr = this.astPtr; super.consumeClassHeaderName1(); if (this.astPtr > currentAstPtr) // if ast node was pushed on the ast stack rememberCategories(); } protected void consumeClassInstanceCreationExpressionWithTypeArguments() {
@Override protected void consumeCatchFormalParameter() { super.consumeCatchFormalParameter(); // Flush comments prior to this formal parameter so the declarationSourceStart of the following parameter // is correctly set (see bug 80904) // Note that this could be done in the Parser itself, but this would slow down all parsers, when they don't need // the declarationSourceStart to be set flushCommentsDefinedPriorTo(this.scanner.currentPosition); } @Override
protected void consumeAnnotationAsModifier() { super.consumeAnnotationAsModifier(); Annotation annotation = (Annotation)this.expressionStack[this.expressionPtr]; if (this.reportReferenceInfo) { // accept annotation type reference this.requestor.acceptAnnotationTypeReference(annotation.type.getTypeName(), annotation.sourceStart, annotation.sourceEnd); } } protected void consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() {