Always by pressing request, oops.

This commit is contained in:
Edoardo Prezioso 2011-12-28 22:51:13 +01:00
parent ec0badb651
commit 09bfa66536
1 changed files with 28 additions and 0 deletions

View File

@ -2625,6 +2625,34 @@ void Tokenizer::simplifyDoublePlusAndDoubleMinus()
}
}
void Tokenizer::simplifyJavaAndCSharp()
{
// better don't call isJava in the loop
bool isJava_ = isJava();
for (Token *tok = _tokens; tok; tok = tok->next()) {
if (tok->str() == "private")
tok->str("private:");
else if (tok->str() == "protected")
tok->str("protected:");
else if (tok->str() == "public")
tok->str("public:");
else if (isJava_) {
if (Token::Match(tok, ") throws %var% {"))
tok->deleteNext(2);
} else {
if (Token::Match(tok, "%type% [ ] %var% [=;]") &&
(!tok->previous() || Token::Match(tok->previous(), "[;{}]"))) {
tok->deleteNext(2);
tok->insertToken("*");
tok = tok->tokAt(2);
if (tok->next()->str() == "=")
tok = tok->next();
}
}
}
}
/** Specify array size if it hasn't been given */
void Tokenizer::arraySize()