1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Scanner2 - sanity point - fixed some problems I was having with comments.

This commit is contained in:
Doug Schaefer 2004-06-22 19:20:10 +00:00
parent fdfc59936c
commit b0040c1336

View file

@ -628,7 +628,6 @@ public class Scanner2 implements IScanner, IScannerData {
// Check for macro expansion
Object expObject = definitions.get(buffer, start, len);
if (expObject == null) {
// but not if it has been expanded on the stack already
// i.e. recursion avoidance
@ -641,7 +640,6 @@ public class Scanner2 implements IScanner, IScannerData {
expObject = null;
break;
}
}
if (expObject != null) {
if (expObject instanceof FunctionStyleMacro) {
@ -1245,8 +1243,13 @@ public class Scanner2 implements IScanner, IScannerData {
int nesting = 0;
while (bufferPos[bufferStackPos] < limit) {
skipOverWhiteSpace();
char c = buffer[++bufferPos[bufferStackPos]];
if (++bufferPos[bufferStackPos] >= limit)
return;
char c = buffer[bufferPos[bufferStackPos]];
if (c == '#') {
skipOverWhiteSpace();
@ -1304,8 +1307,7 @@ public class Scanner2 implements IScanner, IScannerData {
}
}
}
}
} else if (c != '\n')
skipToNewLine();
}
}
@ -1326,6 +1328,8 @@ public class Scanner2 implements IScanner, IScannerData {
if (buffer[pos + 1] == '/') {
// C++ comment, skip rest of line
skipToNewLine();
// leave the new line there
--bufferPos[bufferStackPos];
return;
} else if (buffer[pos + 1] == '*') {
// C comment, find closing */
@ -1468,9 +1472,9 @@ public class Scanner2 implements IScanner, IScannerData {
private void skipToNewLine() {
char[] buffer = bufferStack[bufferStackPos];
int limit = bufferLimit[bufferStackPos];
int pos = ++bufferPos[bufferStackPos];
int pos = bufferPos[bufferStackPos];
if (pos >= limit || buffer[pos] == '\n')
if (pos < limit && buffer[pos] == '\n')
return;
boolean escaped = false;