token : minor refactoring to TOKEN::insertToken. Give the linenr and fileIndex the same values as this token. It's better than nothing
This commit is contained in:
parent
40f3ef61c9
commit
e853f28912
|
@ -366,16 +366,18 @@ void TOKEN::previous( TOKEN *previous )
|
||||||
_previous = previous;
|
_previous = previous;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TOKEN::insertToken( const char *str )
|
void TOKEN::insertToken( const char str[] )
|
||||||
{
|
{
|
||||||
TOKEN *newToken = new TOKEN;
|
TOKEN *newToken = new TOKEN;
|
||||||
newToken->setstr( str );
|
newToken->setstr( str );
|
||||||
|
newToken->_linenr = _linenr;
|
||||||
|
newToken->_fileIndex = _fileIndex;
|
||||||
if( this->next() )
|
if( this->next() )
|
||||||
{
|
{
|
||||||
newToken->next( this->next() );
|
newToken->next( this->next() );
|
||||||
newToken->next()->previous( newToken );
|
newToken->next()->previous( newToken );
|
||||||
}
|
}
|
||||||
|
|
||||||
this->next( newToken );
|
this->next( newToken );
|
||||||
newToken->previous( this );
|
newToken->previous( this );
|
||||||
}
|
}
|
||||||
|
|
4
token.h
4
token.h
|
@ -134,14 +134,14 @@ public:
|
||||||
*/
|
*/
|
||||||
static void eraseTokens( TOKEN *begin, const TOKEN *end );
|
static void eraseTokens( TOKEN *begin, const TOKEN *end );
|
||||||
|
|
||||||
void eraseToken();
|
void eraseToken();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert new token after this token. This function will handle
|
* Insert new token after this token. This function will handle
|
||||||
* relations between next and previous token also.
|
* relations between next and previous token also.
|
||||||
* @param str String for the new token.
|
* @param str String for the new token.
|
||||||
*/
|
*/
|
||||||
void insertToken( const char *str );
|
void insertToken( const char str[] );
|
||||||
|
|
||||||
TOKEN *previous() const;
|
TOKEN *previous() const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue