Lines 183-188
Link Here
|
183 |
public boolean reportSyntaxErrorIsRequired = true; |
183 |
public boolean reportSyntaxErrorIsRequired = true; |
184 |
protected boolean restartRecovery; |
184 |
protected boolean restartRecovery; |
185 |
|
185 |
|
|
|
186 |
protected int lastPosistion; |
187 |
|
186 |
// statement recovery |
188 |
// statement recovery |
187 |
// public boolean statementRecoveryEnabled = true; |
189 |
// public boolean statementRecoveryEnabled = true; |
188 |
public boolean methodRecoveryActivated = false; |
190 |
public boolean methodRecoveryActivated = false; |
Lines 7442-7454
Link Here
|
7442 |
break; |
7444 |
break; |
7443 |
case TokenNameStringLiteral : |
7445 |
case TokenNameStringLiteral : |
7444 |
StringLiteral stringLiteral; |
7446 |
StringLiteral stringLiteral; |
7445 |
if (this.recordStringLiterals && this.checkExternalizeStrings && !this.statementRecoveryActivated) { |
7447 |
if (this.recordStringLiterals && |
|
|
7448 |
this.checkExternalizeStrings && |
7449 |
this.lastPosistion < this.scanner.currentPosition && |
7450 |
!this.statementRecoveryActivated) { |
7446 |
stringLiteral = this.createStringLiteral( |
7451 |
stringLiteral = this.createStringLiteral( |
7447 |
this.scanner.getCurrentTokenSourceString(), |
7452 |
this.scanner.getCurrentTokenSourceString(), |
7448 |
this.scanner.startPosition, |
7453 |
this.scanner.startPosition, |
7449 |
this.scanner.currentPosition - 1, |
7454 |
this.scanner.currentPosition - 1, |
7450 |
Util.getLineNumber(this.scanner.startPosition, this.scanner.lineEnds, 0, this.scanner.linePtr)); |
7455 |
Util.getLineNumber(this.scanner.startPosition, this.scanner.lineEnds, 0, this.scanner.linePtr)); |
7451 |
this.compilationUnit.recordStringLiteral(stringLiteral); |
7456 |
this.compilationUnit.recordStringLiteral(stringLiteral, this.currentElement != null); |
7452 |
} else { |
7457 |
} else { |
7453 |
stringLiteral = this.createStringLiteral( |
7458 |
stringLiteral = this.createStringLiteral( |
7454 |
this.scanner.getCurrentTokenSourceString(), |
7459 |
this.scanner.getCurrentTokenSourceString(), |
Lines 8787-8792
Link Here
|
8787 |
final boolean checkNLS = this.options.getSeverity(CompilerOptions.NonExternalizedString) != ProblemSeverities.Ignore; |
8792 |
final boolean checkNLS = this.options.getSeverity(CompilerOptions.NonExternalizedString) != ProblemSeverities.Ignore; |
8788 |
this.checkExternalizeStrings = checkNLS; |
8793 |
this.checkExternalizeStrings = checkNLS; |
8789 |
this.scanner.checkNonExternalizedStringLiterals = initializeNLS && checkNLS; |
8794 |
this.scanner.checkNonExternalizedStringLiterals = initializeNLS && checkNLS; |
|
|
8795 |
this.scanner.lastPosistion = -1; |
8790 |
|
8796 |
|
8791 |
resetModifiers(); |
8797 |
resetModifiers(); |
8792 |
|
8798 |
|
Lines 8802-8807
Link Here
|
8802 |
this.lastJavadocEnd = -1; |
8808 |
this.lastJavadocEnd = -1; |
8803 |
this.listLength = 0; |
8809 |
this.listLength = 0; |
8804 |
this.listTypeParameterLength = 0; |
8810 |
this.listTypeParameterLength = 0; |
|
|
8811 |
this.lastPosistion = -1; |
8805 |
|
8812 |
|
8806 |
this.rBraceStart = 0; |
8813 |
this.rBraceStart = 0; |
8807 |
this.rBraceEnd = 0; |
8814 |
this.rBraceEnd = 0; |
Lines 9125-9131
Link Here
|
9125 |
|
9132 |
|
9126 |
} else if (act > ERROR_ACTION) { /* shift-reduce */ |
9133 |
} else if (act > ERROR_ACTION) { /* shift-reduce */ |
9127 |
consumeToken(this.currentToken); |
9134 |
consumeToken(this.currentToken); |
9128 |
if (this.currentElement != null) this.recoveryTokenCheck(); |
9135 |
if (this.currentElement != null) { |
|
|
9136 |
boolean oldValue = this.recordStringLiterals; |
9137 |
this.recordStringLiterals = false; |
9138 |
this.recoveryTokenCheck(); |
9139 |
this.recordStringLiterals = oldValue; |
9140 |
} |
9129 |
try { |
9141 |
try { |
9130 |
this.currentToken = this.scanner.getNextToken(); |
9142 |
this.currentToken = this.scanner.getNextToken(); |
9131 |
} catch(InvalidInputException e){ |
9143 |
} catch(InvalidInputException e){ |
Lines 9148-9154
Link Here
|
9148 |
} else { |
9160 |
} else { |
9149 |
if (act < ACCEPT_ACTION) { /* shift */ |
9161 |
if (act < ACCEPT_ACTION) { /* shift */ |
9150 |
consumeToken(this.currentToken); |
9162 |
consumeToken(this.currentToken); |
9151 |
if (this.currentElement != null) this.recoveryTokenCheck(); |
9163 |
if (this.currentElement != null) { |
|
|
9164 |
boolean oldValue = this.recordStringLiterals; |
9165 |
this.recordStringLiterals = false; |
9166 |
this.recoveryTokenCheck(); |
9167 |
this.recordStringLiterals = oldValue; |
9168 |
} |
9152 |
try{ |
9169 |
try{ |
9153 |
this.currentToken = this.scanner.getNextToken(); |
9170 |
this.currentToken = this.scanner.getNextToken(); |
9154 |
} catch(InvalidInputException e){ |
9171 |
} catch(InvalidInputException e){ |
Lines 10059-10064
Link Here
|
10059 |
*/ |
10076 |
*/ |
10060 |
public void recoveryTokenCheck() { |
10077 |
public void recoveryTokenCheck() { |
10061 |
switch (this.currentToken) { |
10078 |
switch (this.currentToken) { |
|
|
10079 |
case TokenNameStringLiteral : |
10080 |
if (this.recordStringLiterals && |
10081 |
this.checkExternalizeStrings && |
10082 |
this.lastPosistion < this.scanner.currentPosition && |
10083 |
!this.statementRecoveryActivated) { |
10084 |
StringLiteral stringLiteral = this.createStringLiteral( |
10085 |
this.scanner.getCurrentTokenSourceString(), |
10086 |
this.scanner.startPosition, |
10087 |
this.scanner.currentPosition - 1, |
10088 |
Util.getLineNumber(this.scanner.startPosition, this.scanner.lineEnds, 0, this.scanner.linePtr)); |
10089 |
this.compilationUnit.recordStringLiteral(stringLiteral, this.currentElement != null); |
10090 |
} |
10091 |
break; |
10062 |
case TokenNameLBRACE : |
10092 |
case TokenNameLBRACE : |
10063 |
RecoveredElement newElement = null; |
10093 |
RecoveredElement newElement = null; |
10064 |
if(!this.ignoreNextOpeningBrace) { |
10094 |
if(!this.ignoreNextOpeningBrace) { |
Lines 10246-10254
Link Here
|
10246 |
return false; |
10276 |
return false; |
10247 |
} |
10277 |
} |
10248 |
} |
10278 |
} |
10249 |
protected boolean resumeOnSyntaxError() { |
10279 |
protected boolean resumeOnSyntaxError() { |
10250 |
this.checkExternalizeStrings = false; |
|
|
10251 |
this.scanner.checkNonExternalizedStringLiterals = false; |
10252 |
/* request recovery initialization */ |
10280 |
/* request recovery initialization */ |
10253 |
if (this.currentElement == null){ |
10281 |
if (this.currentElement == null){ |
10254 |
// Reset javadoc before restart parsing after recovery |
10282 |
// Reset javadoc before restart parsing after recovery |
Lines 10270-10275
Link Here
|
10270 |
/* update recovery state with current error state of the parser */ |
10298 |
/* update recovery state with current error state of the parser */ |
10271 |
this.updateRecoveryState(); |
10299 |
this.updateRecoveryState(); |
10272 |
|
10300 |
|
|
|
10301 |
if (this.lastPosistion < this.scanner.currentPosition) { |
10302 |
this.lastPosistion = this.scanner.currentPosition; |
10303 |
this.scanner.lastPosistion = this.scanner.currentPosition; |
10304 |
} |
10305 |
|
10273 |
/* attempt to reset state in order to resume to parse loop */ |
10306 |
/* attempt to reset state in order to resume to parse loop */ |
10274 |
return this.resumeAfterRecovery(); |
10307 |
return this.resumeAfterRecovery(); |
10275 |
} |
10308 |
} |