Now lines starting with "# <number>" are skipped. This should fix problems when using a gcc 3.x preprocessor.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8917 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
f740226bcd
commit
15f030fd16
@ -211,13 +211,14 @@ private:
|
|||||||
if (!fInput.getline(buffer, sizeof(buffer)))
|
if (!fInput.getline(buffer, sizeof(buffer)))
|
||||||
throw EOFException("Unexpected end of input.");
|
throw EOFException("Unexpected end of input.");
|
||||||
// parse it
|
// parse it
|
||||||
|
vector<string> line;
|
||||||
int len = strlen(buffer);
|
int len = strlen(buffer);
|
||||||
int tokenStart = 0;
|
int tokenStart = 0;
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
char c = buffer[i];
|
char c = buffer[i];
|
||||||
if (isspace(c)) {
|
if (isspace(c)) {
|
||||||
if (tokenStart < i)
|
if (tokenStart < i)
|
||||||
fTokens.push_back(string(buffer + tokenStart, buffer + i));
|
line.push_back(string(buffer + tokenStart, buffer + i));
|
||||||
tokenStart = i + 1;
|
tokenStart = i + 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -232,16 +233,24 @@ private:
|
|||||||
case ';':
|
case ';':
|
||||||
case ',':
|
case ',':
|
||||||
if (tokenStart < i) {
|
if (tokenStart < i) {
|
||||||
fTokens.push_back(string(buffer + tokenStart,
|
line.push_back(string(buffer + tokenStart,
|
||||||
buffer + i));
|
buffer + i));
|
||||||
}
|
}
|
||||||
fTokens.push_back(string(buffer + i, buffer + i + 1));
|
line.push_back(string(buffer + i, buffer + i + 1));
|
||||||
tokenStart = i + 1;
|
tokenStart = i + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tokenStart < len)
|
if (tokenStart < len)
|
||||||
fTokens.push_back(string(buffer + tokenStart, buffer + len));
|
line.push_back(string(buffer + tokenStart, buffer + len));
|
||||||
|
// drop the line, if it starts with "# <number>", as those are
|
||||||
|
// directions from the pre-processor to the compiler
|
||||||
|
if (line.size() >= 2) {
|
||||||
|
if (line[0] == "#" && isdigit(line[1][0]))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < (int)line.size(); i++)
|
||||||
|
fTokens.push_back(line[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user