Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipe Mulet2001-10-04 14:32:14 +0000
committerPhilipe Mulet2001-10-04 14:32:14 +0000
commitc19d6ec60a61fc74d94d3fe5fb8907eb3eeb99a4 (patch)
treefef78f34fafd50e7a8e0ee3a92d996730a9c36b0
parentf7dffaeb9d0554f961c31cbea588fed006b1150c (diff)
downloadeclipse.jdt.core-unlabeled-1.11.2.tar.gz
eclipse.jdt.core-unlabeled-1.11.2.tar.xz
eclipse.jdt.core-unlabeled-1.11.2.zip
*** empty log message ***unlabeled-1.11.2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java34
1 files changed, 21 insertions, 13 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
index 5264792da4..e54d8ed1ab 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
@@ -24,7 +24,8 @@ public class Scanner implements TerminalSymbols {
// 1.4 feature
public boolean assertMode;
public boolean useAssertAsAnIndentifier = false;
- public boolean containsAssertKeyword = false;
+ //flag indicating if processed source contains occurrences of keyword assert
+ public boolean containsAssertKeyword = false;
public boolean recordLineSeparator;
public char currentCharacter;
@@ -662,7 +663,7 @@ public int getNextToken() throws InvalidInputException {
if (recordLineSeparator) {
pushLineSeparator();
} else {
- linePtr++;
+ currentLine = null;
}
}
isWhiteSpace =
@@ -939,11 +940,9 @@ public int getNextToken() throws InvalidInputException {
throw e; // rethrow
}
if (checkNonExternalizedStringLiterals){ // check for presence of NLS tags //$NON-NLS-?$ where ? is an int.
- currentLineNr = linePtr;
- if (currentLineNr != previousLineNr) {
- currentLine= new NLSLine(currentLineNr);
+ if (currentLine == null) {
+ currentLine= new NLSLine();
lines.add(currentLine);
- previousLineNr= currentLineNr;
}
currentLine.add(
new StringLiteral(
@@ -1026,7 +1025,7 @@ public int getNextToken() throws InvalidInputException {
pushLineSeparator();
}
} else {
- linePtr++;
+ currentLine = null;
}
}
if (tokenizeComments) {
@@ -1065,7 +1064,7 @@ public int getNextToken() throws InvalidInputException {
if (recordLineSeparator) {
pushLineSeparator();
} else {
- linePtr++;
+ currentLine = null;
}
}
try { //get the next char
@@ -1090,7 +1089,7 @@ public int getNextToken() throws InvalidInputException {
if (recordLineSeparator) {
pushLineSeparator();
} else {
- linePtr++;
+ currentLine = null;
}
}
star = currentCharacter == '*';
@@ -1750,6 +1749,11 @@ final char[] optimizedCurrentTokenSource6() {
public final void pushLineSeparator() throws InvalidInputException {
//see comment on isLineDelimiter(char) for the use of '\n' and '\r'
final int INCREMENT = 250;
+
+ if (this.checkNonExternalizedStringLiterals) {
+ // reinitialize the current line for non externalize strings purpose
+ currentLine = null;
+ }
//currentCharacter is at position currentPosition-1
// cr 000D
@@ -1809,6 +1813,11 @@ public final void pushUnicodeLineSeparator() {
final int INCREMENT = 250;
//currentCharacter is at position currentPosition-1
+ if (this.checkNonExternalizedStringLiterals) {
+ // reinitialize the current line for non externalize strings purpose
+ currentLine = null;
+ }
+
// cr 000D
if (currentCharacter == '\r') {
int separatorPos = currentPosition - 6;
@@ -2975,7 +2984,7 @@ public Scanner(boolean tokenizeComments, boolean tokenizeWhiteSpace, boolean che
}
private void checkNonExternalizeString() throws InvalidInputException {
- if (currentLine == null || currentLineNr != linePtr)
+ if (currentLine == null)
return;
parseTags(currentLine);
}
@@ -2994,9 +3003,8 @@ private void parseTags(NLSLine line) throws InvalidInputException {
} catch (NumberFormatException e) {
i = -1; // we don't want to consider this as a valid NLS tag
}
- int listIndex = lineLength - i - 1;
- if (line.exists(listIndex)) {
- line.set(listIndex, null);
+ if (line.exists(i)) {
+ line.set(i, null);
}
pos = s.indexOf(TAG_PREFIX, start);
}

Back to the top