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:
Edoardo Prezioso 2011-11-11 21:55:37 +01:00
parent 283c2e508e
commit 2aceb623ae
2 changed files with 21 additions and 2 deletions

View File

@ -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);

View File

@ -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