Example usage for org.eclipse.jdt.internal.compiler.parser RecoveredElement topElement

List of usage examples for org.eclipse.jdt.internal.compiler.parser RecoveredElement topElement

Introduction

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

Prototype

public RecoveredElement topElement() 

Source Link

Usage

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

License:Open Source License

protected CompilationUnitDeclaration endParse(int act) {

    this.lastAct = act;

    if (this.statementRecoveryActivated) {
        RecoveredElement recoveredElement = buildInitialRecoveryState();

        if (recoveredElement != null) {
            recoveredElement.topElement().updateParseTree();
        }//from w w w  .  j  av a  2 s  .  com

        if (this.hasError)
            resetStacks();
    } else if (this.currentElement != null) {
        if (VERBOSE_RECOVERY) {
            System.out.print(Messages.parser_syntaxRecovery);
            System.out.println("--------------------------"); //$NON-NLS-1$
            System.out.println(this.compilationUnit);
            System.out.println("----------------------------------"); //$NON-NLS-1$
        }
        this.currentElement.topElement().updateParseTree();
    } else {
        if (this.diet & VERBOSE_RECOVERY) {
            System.out.print(Messages.parser_regularParse);
            System.out.println("--------------------------"); //$NON-NLS-1$
            System.out.println(this.compilationUnit);
            System.out.println("----------------------------------"); //$NON-NLS-1$
        }
    }
    persistLineSeparatorPositions();
    for (int i = 0; i < this.scanner.foundTaskCount; i++) {
        if (!this.statementRecoveryActivated)
            problemReporter().task(new String(this.scanner.foundTaskTags[i]),
                    new String(this.scanner.foundTaskMessages[i]),
                    this.scanner.foundTaskPriorities[i] == null ? null
                            : new String(this.scanner.foundTaskPriorities[i]),
                    this.scanner.foundTaskPositions[i][0], this.scanner.foundTaskPositions[i][1]);
    }
    return this.compilationUnit;
}