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

This commit is contained in:
Edoardo Prezioso 2012-01-30 13:24:31 +01:00
parent d9e9c0aceb
commit 5a1585dcfb
1 changed files with 14 additions and 8 deletions

View File

@ -1043,15 +1043,15 @@ void Tokenizer::simplifyTypedef()
continue; // invalid input continue; // invalid input
// check for invalid input // check for invalid input
if (!tok->tokAt(offset)) { if (!tokOffset) {
syntaxError(tok); syntaxError(tok);
return; return;
} }
// check for template // check for template
if (tok->strAt(offset) == "<") { if (tokOffset->str() == "<") {
unsigned int level = 0; unsigned int level = 0;
typeEnd = tok->tokAt(offset + 1); typeEnd = tokOffset->next();
for (; typeEnd ; typeEnd = typeEnd->next()) { for (; typeEnd ; typeEnd = typeEnd->next()) {
if (typeEnd->str() == ">") { if (typeEnd->str() == ">") {
if (!level) if (!level)
@ -1079,21 +1079,27 @@ void Tokenizer::simplifyTypedef()
tok = typeEnd; tok = typeEnd;
offset = 1; offset = 1;
tokOffset = tok->next();
} }
// check for pointers and references // check for pointers and references
while (Token::Match(tok->tokAt(offset), "*|&|const")) while (Token::Match(tokOffset, "*|&|const")) {
pointers.push_back(tok->strAt(offset++)); pointers.push_back(tokOffset->str());
++offset;
tokOffset = tokOffset->next();
}
// check for invalid input // check for invalid input
if (!tok->tokAt(offset)) { if (!tokOffset) {
syntaxError(tok); syntaxError(tok);
return; return;
} }
if (Token::Match(tok->tokAt(offset), "%type%")) { if (Token::Match(tokOffset, "%type%")) {
// found the type name // found the type name
typeName = tok->tokAt(offset++); ++offset;
typeName = tokOffset;
tokOffset = tokOffset->next();
// check for array // check for array
if (tok->tokAt(offset) && tok->strAt(offset) == "[") { if (tok->tokAt(offset) && tok->strAt(offset) == "[") {