Updated tokenizer. To handle "#define f1(a,b) (a+b)" better
This commit is contained in:
parent
101afe4344
commit
d0cffeaa8c
|
@ -766,5 +766,13 @@ static void unused_variable()
|
|||
"}\n";
|
||||
check( CheckVariableScope, __LINE__, test5, "" );
|
||||
|
||||
|
||||
|
||||
const char test6[] = "static void f()\n"
|
||||
"{\n"
|
||||
"#define F1(x, y, z) (z ^ (x & (y ^ z)))\n"
|
||||
"}\n";
|
||||
check( CheckVariableScope, __LINE__, test6, "" );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -328,7 +328,9 @@ void TokenizeCode(std::istream &code, const unsigned int FileIndex)
|
|||
State = (State==Space1) ? Id : Value;
|
||||
}
|
||||
|
||||
else if (State==Id && std::isspace(line[i]))
|
||||
else if (State==Id)
|
||||
{
|
||||
if ( std::isspace( line[i] ) )
|
||||
{
|
||||
strId = strdup(CurrentToken);
|
||||
memset(CurrentToken, 0, sizeof(CurrentToken));
|
||||
|
@ -336,6 +338,11 @@ void TokenizeCode(std::istream &code, const unsigned int FileIndex)
|
|||
State = Space2;
|
||||
continue;
|
||||
}
|
||||
else if ( ! std::isalnum(line[i]) )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*pToken = line[i];
|
||||
pToken++;
|
||||
|
|
Loading…
Reference in New Issue