public RecoveredElement add(ModuleStatement moduleStatement, int bracketBalanceValue){ /* default behavior is to delegate recording to parent if any */ resetPendingModifiers(); if (this.parent == null) return this; // ignore this.updateSourceEndIfNecessary(previousAvailableLineEnd(moduleStatement.declarationSourceStart - 1)); return this.parent.add(moduleStatement, bracketBalanceValue); } /*
public RecoveredElement addAnnotationName(int identifierPtr, int identifierLengthPtr, int annotationStart, int bracketBalanceValue) { /* default behavior is to delegate recording to parent if any */ resetPendingModifiers(); if (this.parent == null) return this; // ignore this.updateSourceEndIfNecessary(previousAvailableLineEnd(annotationStart - 1)); return this.parent.addAnnotationName(identifierPtr, identifierLengthPtr, annotationStart, bracketBalanceValue); } /*
protected void checkAndSetModifiers(int flag){ /*modify the current modifiers buffer. When the startPosition of the modifiers is 0 it means that the modifier being parsed is the first of a list of several modifiers. The startPosition is zeroed when a copy of modifiers-buffer is push onto the this.astStack. */ if ((this.modifiers & flag) != 0){ // duplicate modifier this.modifiers |= ExtraCompilerModifiers.AccAlternateModifierProblem; } this.modifiers |= flag; if (this.modifiersSourceStart < 0) this.modifiersSourceStart = this.scanner.startPosition; if (this.currentElement != null) { this.currentElement.addModifier(flag, this.modifiersSourceStart); } } public void checkComment() {
protected RecoveredType currentRecoveryType() { if(this.currentElement != null) { if(this.currentElement instanceof RecoveredType) { return (RecoveredType) this.currentElement; } else { return this.currentElement.enclosingType(); } } return null; } public CompilationUnitDeclaration dietParse(ICompilationUnit sourceUnit, CompilationResult compilationResult) {
public int getLastStart() { ASTNode parseTree = parseTree(); return parseTree == null ? -1 : parseTree.sourceStart; } protected String tabString(int tab) {
@Override public String toString() { return toString(0); } public String toString(int tab) {
public int previousAvailableLineEnd(int position){ Parser parser = parser(); if (parser == null) return position; Scanner scanner = parser.scanner; if (scanner.lineEnds == null) return position; int index = Util.getLineNumber(position, scanner.lineEnds, 0, scanner.linePtr); if (index < 2) return position; int previousLineEnd = scanner.lineEnds[index-2]; char[] source = scanner.source; for (int i = previousLineEnd+1; i < position; i++){ if (!(source[i] == ' ' || source[i] == '\t')) return position; } return previousLineEnd; } /*
protected void consumeAnnotationName() { if(this.currentElement != null) { int start = this.intStack[this.intPtr]; int end = (int) (this.identifierPositionStack[this.identifierPtr] & 0x00000000FFFFFFFFL); annotationRecoveryCheckPoint(start, end); if (this.annotationRecoveryActivated) { this.currentElement = this.currentElement.addAnnotationName(this.identifierPtr, this.identifierLengthPtr, start, 0); } } this.recordStringLiterals = false; } protected void consumeAnnotationTypeDeclaration() {
protected RecoveredType currentRecoveryType() { if(this.currentElement != null) { if(this.currentElement instanceof RecoveredType) { return (RecoveredType) this.currentElement; } else { return this.currentElement.enclosingType(); } } return null; } public CompilationUnitDeclaration dietParse(ICompilationUnit sourceUnit, CompilationResult compilationResult) {
public int getLastStart() { ASTNode parseTree = parseTree(); return parseTree == null ? -1 : parseTree.sourceStart; } protected String tabString(int tab) {
public String toString() { return toString(0); } public String toString(int tab) {
public int previousAvailableLineEnd(int position){ Parser parser = parser(); if (parser == null) return position; Scanner scanner = parser.scanner; if (scanner.lineEnds == null) return position; int index = Util.getLineNumber(position, scanner.lineEnds, 0, scanner.linePtr); if (index < 2) return position; int previousLineEnd = scanner.lineEnds[index-2]; char[] source = scanner.source; for (int i = previousLineEnd+1; i < position; i++){ if (!(source[i] == ' ' || source[i] == '\t')) return position; } return previousLineEnd; } /*
protected void consumeAnnotationName() { if(this.currentElement != null) { int start = this.intStack[this.intPtr]; int end = (int) (this.identifierPositionStack[this.identifierPtr] & 0x00000000FFFFFFFFL); annotationRecoveryCheckPoint(start, end); if (this.annotationRecoveryActivated) { this.currentElement = this.currentElement.addAnnotationName(this.identifierPtr, this.identifierLengthPtr, start, 0); } } this.recordStringLiterals = false; } protected void consumeAnnotationTypeDeclaration() {
public RecoveredElement add(TypeDeclaration typeDeclaration, int bracketBalanceValue){ /* default behavior is to delegate recording to parent if any */ resetPendingModifiers(); if (this.parent == null) return this; // ignore this.updateSourceEndIfNecessary(previousAvailableLineEnd(typeDeclaration.declarationSourceStart - 1)); return this.parent.add(typeDeclaration, bracketBalanceValue); } protected void addBlockStatement(RecoveredBlock recoveredBlock) {
public RecoveredElement addAnnotationName(int identifierPtr, int identifierLengthPtr, int annotationStart, int bracketBalanceValue) { /* default behavior is to delegate recording to parent if any */ resetPendingModifiers(); if (this.parent == null) return this; // ignore this.updateSourceEndIfNecessary(previousAvailableLineEnd(annotationStart - 1)); return this.parent.addAnnotationName(identifierPtr, identifierLengthPtr, annotationStart, bracketBalanceValue); } /*
protected RecoveredType currentRecoveryType() { if(this.currentElement != null) { if(this.currentElement instanceof RecoveredType) { return (RecoveredType) this.currentElement; } else { return this.currentElement.enclosingType(); } } return null; } public CompilationUnitDeclaration dietParse(ICompilationUnit sourceUnit, CompilationResult compilationResult) {
protected void checkAndSetModifiers(int flag){ /*modify the current modifiers buffer. When the startPosition of the modifiers is 0 it means that the modifier being parsed is the first of a list of several modifiers. The startPosition is zeroed when a copy of modifiers-buffer is push onto the this.astStack. */ if ((this.modifiers & flag) != 0){ // duplicate modifier this.modifiers |= ExtraCompilerModifiers.AccAlternateModifierProblem; } this.modifiers |= flag; if (this.modifiersSourceStart < 0) this.modifiersSourceStart = this.scanner.startPosition; if (this.currentElement != null) { this.currentElement.addModifier(flag, this.modifiersSourceStart); } } public void checkComment() {
protected void consumeConstructorHeader() { // ConstructorHeader ::= ConstructorHeaderName MethodHeaderParameters MethodHeaderThrowsClauseopt AbstractMethodDeclaration method = (AbstractMethodDeclaration)this.astStack[this.astPtr]; if (this.currentToken == TokenNameLBRACE){ method.bodyStart = this.scanner.currentPosition; } // recovery if (this.currentElement != null){ if (this.currentToken == TokenNameSEMICOLON){ // for invalid constructors method.modifiers |= ExtraCompilerModifiers.AccSemicolonBody; method.declarationSourceEnd = this.scanner.currentPosition-1; method.bodyEnd = this.scanner.currentPosition-1; if (this.currentElement.parseTree() == method && this.currentElement.parent != null) { this.currentElement = this.currentElement.parent; } } this.restartRecovery = true; // used to avoid branching back into the regular automaton } } protected void consumeConstructorHeaderName() {
public String toString() { return toString(0); } public String toString(int tab) {
public int previousAvailableLineEnd(int position){ Parser parser = parser(); if (parser == null) return position; Scanner scanner = parser.scanner; if (scanner.lineEnds == null) return position; int index = Util.getLineNumber(position, scanner.lineEnds, 0, scanner.linePtr); if (index < 2) return position; int previousLineEnd = scanner.lineEnds[index-2]; char[] source = scanner.source; for (int i = previousLineEnd+1; i < position; i++){ if (!(source[i] == ' ' || source[i] == '\t')) return position; } return previousLineEnd; } /*