tokenizer: simplify assembler (#270)

This commit is contained in:
Daniel Marjamäki 2009-05-01 12:39:14 +02:00
parent 67832d89f7
commit e37da13c26
2 changed files with 8 additions and 27 deletions

View File

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

View File

@ -225,34 +225,15 @@ private:
void inlineasm()
{
const char filedata[] = "void foo()\n"
"{\n"
" __asm\n"
" {\n"
" jmp $jump1\n"
" $jump1:\n"
" }\n"
"}\n";
// tokenize..
Tokenizer tokenizer;
std::istringstream istr(filedata);
tokenizer.tokenize(istr, "test.cpp");
// Expected result..
const char *expected[] =
{
"void",
"foo",
"(",
")",
"{",
"}",
0
};
const char code[] = "abc asm { mov ax,bx } def";
ASSERT_EQUALS("abc def", tokenizeAndStringify(code));
}
// Compare..
ASSERT_EQUALS(true, cmptok(expected, tokenizer.tokens()));
{
const char code[] = "abc __asm { mov ax,bx } def";
ASSERT_EQUALS("abc def", tokenizeAndStringify(code));
}
}