1)Add 'Token' function 'linkAt', which simplifies the writing 'tokAt(i)->link()' to 'linkAt(i)'.
It's still unused, though. 2)Fix one grammatical mistake inside token.h 3)Style change to token.cpp: remove the whitespace between '!' and 'begin'.
This commit is contained in:
parent
283c2e508e
commit
2aceb623ae
|
@ -221,6 +221,18 @@ Token *Token::tokAt(int index)
|
|||
return tok;
|
||||
}
|
||||
|
||||
const Token *Token::linkAt(int index) const
|
||||
{
|
||||
const Token *tok = this->tokAt(index);
|
||||
return tok->link();
|
||||
}
|
||||
|
||||
Token *Token::linkAt(int index)
|
||||
{
|
||||
Token *tok = this->tokAt(index);
|
||||
return tok->link();
|
||||
}
|
||||
|
||||
std::string Token::strAt(int index) const
|
||||
{
|
||||
const Token *tok = this->tokAt(index);
|
||||
|
@ -818,7 +830,7 @@ void Token::insertToken(const std::string &tokenStr)
|
|||
|
||||
void Token::eraseTokens(Token *begin, const Token *end)
|
||||
{
|
||||
if (! begin)
|
||||
if (!begin)
|
||||
return;
|
||||
|
||||
while (begin->next() && begin->next() != end) {
|
||||
|
|
|
@ -71,6 +71,13 @@ public:
|
|||
const Token *tokAt(int index) const;
|
||||
Token *tokAt(int index);
|
||||
|
||||
/**
|
||||
* Returns the link to the token in given index, related to this token.
|
||||
* For example index 1 would return the link to next token.
|
||||
*/
|
||||
const Token *linkAt(int index) const;
|
||||
Token *linkAt(int index);
|
||||
|
||||
std::string strAt(int index) const;
|
||||
|
||||
/**
|
||||
|
@ -368,7 +375,7 @@ public:
|
|||
std::string strValue() const;
|
||||
|
||||
/**
|
||||
* Move srcStart and srcEnd tokens and all tokens between then
|
||||
* Move srcStart and srcEnd tokens and all tokens between them
|
||||
* into new a location. Only links between tokens are changed.
|
||||
* @param srcStart This is the first token to be moved
|
||||
* @param srcEnd The last token to be moved
|
||||
|
|
Loading…
Reference in New Issue