Tokenizer::simplifyTypedef: 'tokAt(offset)=>tokOffset': work in progress..

This commit is contained in:
Edoardo Prezioso 2012-01-30 15:04:41 +01:00
parent fe3fd1a073
commit 9438d1c2d0
1 changed files with 14 additions and 8 deletions

View File

@ -1101,25 +1101,31 @@ void Tokenizer::simplifyTypedef()
tokOffset = tokOffset->next(); tokOffset = tokOffset->next();
// check for array // check for array
if (tok->tokAt(offset) && tok->strAt(offset) == "[") { if (tokOffset && tokOffset->str() == "[") {
arrayStart = tok->tokAt(offset); arrayStart = tokOffset;
bool atEnd = false; bool atEnd = false;
while (!atEnd) { while (!atEnd) {
while (tok->tokAt(offset + 1) && !Token::Match(tok->tokAt(offset + 1), ";|,")) while (tokOffset->next() && !Token::Match(tokOffset->next(), ";|,")) {
++offset;
if (!tok->tokAt(offset + 1))
return; // invalid input
else if (tok->strAt(offset + 1) == ";")
atEnd = true;
else if (tok->strAt(offset) == "]")
atEnd = true;
else
++offset; ++offset;
tokOffset = tokOffset->next();
} }
arrayEnd = tok->tokAt(offset++); if (!tokOffset->next())
return; // invalid input
else if (tokOffset->next()->str() == ";")
atEnd = true;
else if (tokOffset->str() == "]")
atEnd = true;
else {
++offset;
tokOffset = tokOffset->next();
}
}
++offset;
arrayEnd = tokOffset;
tokOffset = tokOffset->next();
} }
// check for end or another // check for end or another