1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2011-05-10 03:02:17 +00:00
parent ab3d7d9a43
commit 496fe2cc92

View file

@ -23,7 +23,6 @@ import java.util.HashMap;
* @since 4.0 * @since 4.0
*/ */
public class SimpleScanner { public class SimpleScanner {
private static final int EOFCHAR= -1; private static final int EOFCHAR= -1;
protected static HashMap<String, Integer> fgKeywords= new HashMap<String, Integer>(); protected static HashMap<String, Integer> fgKeywords= new HashMap<String, Integer>();
@ -242,14 +241,10 @@ public class SimpleScanner {
} while ((c == ' ') || (c == '\r') || (c == '\t') || (c == '\n')); } while ((c == ' ') || (c == '\r') || (c == '\t') || (c == '\n'));
ungetChar(c); ungetChar(c);
return newToken(Token.tWHITESPACE); return newToken(Token.tWHITESPACE);
} else if (c == '"') { } else if (c == '"') {
matchStringLiteral(); matchStringLiteral();
return newToken(Token.tSTRING); return newToken(Token.tSTRING);
} else if (c == 'L' && !madeMistake) { } else if (c == 'L' && !madeMistake) {
int oldChar = c; int oldChar = c;
c = getChar(); c = getChar();
if (c != '"') { if (c != '"') {
@ -262,9 +257,7 @@ public class SimpleScanner {
matchStringLiteral(); matchStringLiteral();
return newToken(Token.tLSTRING); return newToken(Token.tLSTRING);
} else if (c == 'R' && !madeMistake) { } else if (c == 'R' && !madeMistake) {
int oldChar = c; int oldChar = c;
c = getChar(); c = getChar();
if (c != '"') { if (c != '"') {
@ -277,9 +270,7 @@ public class SimpleScanner {
matchRawStringLiteral(); matchRawStringLiteral();
return newToken(Token.tRSTRING); return newToken(Token.tRSTRING);
} else if (((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) || (c == '_') || (c > 255 && Character.isUnicodeIdentifierStart(c))) { } else if (((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) || (c == '_') || (c > 255 && Character.isUnicodeIdentifierStart(c))) {
madeMistake = false; madeMistake = false;
c = getChar(); c = getChar();
@ -305,9 +296,7 @@ public class SimpleScanner {
tokenType = ((Integer)tokenTypeObject).intValue(); tokenType = ((Integer)tokenTypeObject).intValue();
return newToken(tokenType); return newToken(tokenType);
} else if ((c >= '0') && (c <= '9') || c == '.') { } else if ((c >= '0') && (c <= '9') || c == '.') {
boolean hex = false; boolean hex = false;
boolean floatingPoint = c == '.'; boolean floatingPoint = c == '.';
boolean firstCharZero = c == '0'; boolean firstCharZero = c == '0';
@ -401,19 +390,14 @@ public class SimpleScanner {
tokenType = floatingPoint ? Token.tFLOATINGPT : Token.tINTEGER; tokenType = floatingPoint ? Token.tFLOATINGPT : Token.tINTEGER;
return newToken(tokenType); return newToken(tokenType);
} else if (c == '#') { } else if (c == '#') {
return matchPPDirective(); return matchPPDirective();
} else { } else {
switch (c) { switch (c) {
case '\'': case '\'':
matchCharLiteral(); matchCharLiteral();
return newToken(Token.tCHAR); return newToken(Token.tCHAR);
case ':': case ':':
c = getChar(); c = getChar();
if (c == ':') { if (c == ':') {
@ -653,8 +637,7 @@ public class SimpleScanner {
boolean escaped= false; boolean escaped= false;
int c = getChar(true); int c = getChar(true);
LOOP: LOOP: for (;;) {
for (;;) {
if (c == EOFCHAR) if (c == EOFCHAR)
break; break;
if (escaped) { if (escaped) {
@ -664,8 +647,7 @@ public class SimpleScanner {
nc= getChar(true); nc= getChar(true);
} }
c= nc; c= nc;
} } else {
else {
switch(c) { switch(c) {
case '\\': case '\\':
escaped= true; escaped= true;
@ -718,7 +700,7 @@ public class SimpleScanner {
} }
/** /**
* Matches a preprocesser directive. * Matches a preprocessor directive.
* *
* @return a preprocessor token * @return a preprocessor token
*/ */