Example usage for org.eclipse.jdt.internal.compiler.parser.diagnose DiagnoseParser DiagnoseParser

List of usage examples for org.eclipse.jdt.internal.compiler.parser.diagnose DiagnoseParser DiagnoseParser

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.parser.diagnose DiagnoseParser DiagnoseParser.

Prototype

public DiagnoseParser(Parser parser, int firstToken, int start, int end, CompilerOptions options) 

Source Link

Usage

From source file:org.eclipse.jdt.internal.compiler.parser.Parser.java

License:Open Source License

private void reportSyntaxErrorsForSkippedMethod(TypeDeclaration[] types) {
    if (types != null) {
        for (int i = 0; i < types.length; i++) {
            TypeDeclaration[] memberTypes = types[i].memberTypes;
            if (memberTypes != null) {
                reportSyntaxErrorsForSkippedMethod(memberTypes);
            }/*from  ww w .j  av a 2 s.  c  o m*/

            AbstractMethodDeclaration[] methods = types[i].methods;
            if (methods != null) {
                for (int j = 0; j < methods.length; j++) {
                    AbstractMethodDeclaration method = methods[j];
                    if ((method.bits & ASTNode.ErrorInSignature) != 0) {
                        if (method.isAnnotationMethod()) {
                            DiagnoseParser diagnoseParser = new DiagnoseParser(this, TokenNameQUESTION,
                                    method.declarationSourceStart, method.declarationSourceEnd, this.options);
                            diagnoseParser.diagnoseParse(this.options.performStatementsRecovery);
                        } else {
                            DiagnoseParser diagnoseParser = new DiagnoseParser(this, TokenNameDIVIDE,
                                    method.declarationSourceStart, method.declarationSourceEnd, this.options);
                            diagnoseParser.diagnoseParse(this.options.performStatementsRecovery);
                        }

                    }
                }
            }

            FieldDeclaration[] fields = types[i].fields;
            if (fields != null) {
                int length = fields.length;
                for (int j = 0; j < length; j++) {
                    if (fields[j] instanceof Initializer) {
                        Initializer initializer = (Initializer) fields[j];
                        if ((initializer.bits & ASTNode.ErrorInSignature) != 0) {
                            DiagnoseParser diagnoseParser = new DiagnoseParser(this, TokenNameRIGHT_SHIFT,
                                    initializer.declarationSourceStart, initializer.declarationSourceEnd,
                                    this.options);
                            diagnoseParser.diagnoseParse(this.options.performStatementsRecovery);
                        }
                    }
                }
            }
        }
    }
}