Lines 16-21
Link Here
|
16 |
import org.eclipse.jdt.core.compiler.IScanner; |
16 |
import org.eclipse.jdt.core.compiler.IScanner; |
17 |
import org.eclipse.jdt.core.compiler.ITerminalSymbols; |
17 |
import org.eclipse.jdt.core.compiler.ITerminalSymbols; |
18 |
import org.eclipse.jdt.core.compiler.InvalidInputException; |
18 |
import org.eclipse.jdt.core.compiler.InvalidInputException; |
|
|
19 |
import org.eclipse.jdt.internal.compiler.CompilationResult; |
19 |
import org.eclipse.jdt.internal.compiler.ast.StringLiteral; |
20 |
import org.eclipse.jdt.internal.compiler.ast.StringLiteral; |
20 |
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; |
21 |
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; |
21 |
import org.eclipse.jdt.internal.compiler.parser.NLSLine; |
22 |
import org.eclipse.jdt.internal.compiler.parser.NLSLine; |
Lines 37-42
Link Here
|
37 |
//flag indicating if processed source contains occurrences of keyword assert |
38 |
//flag indicating if processed source contains occurrences of keyword assert |
38 |
public boolean containsAssertKeyword = false; |
39 |
public boolean containsAssertKeyword = false; |
39 |
|
40 |
|
|
|
41 |
// 1.5 feature |
42 |
public boolean useEnumAsAnIndentifier = false; |
43 |
|
40 |
public boolean recordLineSeparator = false; |
44 |
public boolean recordLineSeparator = false; |
41 |
public char currentCharacter; |
45 |
public char currentCharacter; |
42 |
public int startPosition; |
46 |
public int startPosition; |
Lines 134-140
Link Here
|
134 |
public /*static*/ final char[][][][] charArray_length = |
138 |
public /*static*/ final char[][][][] charArray_length = |
135 |
new char[OptimizedLength][TableSize][InternalTableSize][]; |
139 |
new char[OptimizedLength][TableSize][InternalTableSize][]; |
136 |
// support for detecting non-externalized string literals |
140 |
// support for detecting non-externalized string literals |
137 |
NLSLine currentLine= null; |
141 |
public NLSLine currentLine= null; |
138 |
public static final String TAG_PREFIX= "//$NON-NLS-"; //$NON-NLS-1$ |
142 |
public static final String TAG_PREFIX= "//$NON-NLS-"; //$NON-NLS-1$ |
139 |
public static final int TAG_PREFIX_LENGTH= TAG_PREFIX.length(); |
143 |
public static final int TAG_PREFIX_LENGTH= TAG_PREFIX.length(); |
140 |
public static final String TAG_POSTFIX= "$"; //$NON-NLS-1$ |
144 |
public static final String TAG_POSTFIX= "$"; //$NON-NLS-1$ |
Lines 1488-1499
Link Here
|
1488 |
default : |
1492 |
default : |
1489 |
if (Character.isJavaIdentifierStart(this.currentCharacter)) |
1493 |
if (Character.isJavaIdentifierStart(this.currentCharacter)) |
1490 |
return scanIdentifierOrKeyword(); |
1494 |
return scanIdentifierOrKeyword(); |
1491 |
if (Character.isDigit(this.currentCharacter)) { |
1495 |
if (isDigit(this.currentCharacter)) { |
1492 |
if (isDigit(this.currentCharacter)) { |
1496 |
return scanNumber(false); |
1493 |
return scanNumber(false); |
|
|
1494 |
} else { |
1495 |
throw new InvalidInputException(INVALID_FLOAT); |
1496 |
} |
1497 |
} |
1497 |
} |
1498 |
return TokenNameERROR; |
1498 |
return TokenNameERROR; |
1499 |
} |
1499 |
} |
Lines 2456-2461
Link Here
|
2456 |
//keywors with the same length AND the same first char, then do another |
2456 |
//keywors with the same length AND the same first char, then do another |
2457 |
//dispatch on the second char |
2457 |
//dispatch on the second char |
2458 |
this.useAssertAsAnIndentifier = false; |
2458 |
this.useAssertAsAnIndentifier = false; |
|
|
2459 |
this.useEnumAsAnIndentifier = false; |
2459 |
while (getNextCharAsJavaIdentifierPart()){/*empty*/} |
2460 |
while (getNextCharAsJavaIdentifierPart()){/*empty*/} |
2460 |
|
2461 |
|
2461 |
int index, length; |
2462 |
int index, length; |
Lines 2633-2638
Link Here
|
2633 |
if (this.sourceLevel >= ClassFileConstants.JDK1_5) { |
2634 |
if (this.sourceLevel >= ClassFileConstants.JDK1_5) { |
2634 |
return TokenNameenum; |
2635 |
return TokenNameenum; |
2635 |
} else { |
2636 |
} else { |
|
|
2637 |
this.useEnumAsAnIndentifier = true; |
2636 |
return TokenNameIdentifier; |
2638 |
return TokenNameIdentifier; |
2637 |
} |
2639 |
} |
2638 |
} else { |
2640 |
} else { |
Lines 3213-3218
Link Here
|
3213 |
this.eofPosition = sourceLength; |
3215 |
this.eofPosition = sourceLength; |
3214 |
this.initialPosition = this.currentPosition = 0; |
3216 |
this.initialPosition = this.currentPosition = 0; |
3215 |
this.containsAssertKeyword = false; |
3217 |
this.containsAssertKeyword = false; |
|
|
3218 |
this.linePtr = -1; |
3219 |
} |
3220 |
|
3221 |
/* |
3222 |
* Should be used if a parse (usually a diet parse) has already been performed on the unit, |
3223 |
* so as to get the already computed line end positions. |
3224 |
*/ |
3225 |
public final void setSource(CompilationResult compilationResult) { |
3226 |
char[] contents = compilationResult.compilationUnit.getContents(); |
3227 |
setSource(contents); |
3228 |
int[] lineSeparatorPositions = compilationResult.lineSeparatorPositions; |
3229 |
if (lineSeparatorPositions != null) { |
3230 |
this.lineEnds = lineSeparatorPositions; |
3231 |
this.linePtr = lineSeparatorPositions.length - 1; |
3232 |
} |
3216 |
} |
3233 |
} |
3217 |
|
3234 |
|
3218 |
public String toString() { |
3235 |
public String toString() { |