tokenizer: simplify assembler (#270), fix _asm also.

http://apps.sourceforge.net/trac/cppcheck/ticket/270
This commit is contained in:
Reijo Tomperi 2009-05-01 20:53:08 +03:00
parent a46de47158
commit bc4fb21325
2 changed files with 6 additions and 1 deletions

View File

@ -433,7 +433,7 @@ void Tokenizer::tokenize(std::istream &code, const char FileName[])
// Remove __asm.. // Remove __asm..
for (Token *tok = _tokens; tok; tok = tok->next()) for (Token *tok = _tokens; tok; tok = tok->next())
{ {
if (Token::Match(tok->next(), "__asm|asm {")) if (Token::Match(tok->next(), "__asm|_asm|asm {"))
{ {
while (tok->next()) while (tok->next())
{ {

View File

@ -230,6 +230,11 @@ private:
ASSERT_EQUALS("abc def", tokenizeAndStringify(code)); ASSERT_EQUALS("abc def", tokenizeAndStringify(code));
} }
{
const char code[] = "abc _asm { mov ax,bx } def";
ASSERT_EQUALS("abc def", tokenizeAndStringify(code));
}
{ {
const char code[] = "abc __asm { mov ax,bx } def"; const char code[] = "abc __asm { mov ax,bx } def";
ASSERT_EQUALS("abc def", tokenizeAndStringify(code)); ASSERT_EQUALS("abc def", tokenizeAndStringify(code));