From e853f28912e10e9745eb6511a9c50b62a87c85ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 16 Dec 2008 17:05:43 +0000 Subject: [PATCH] token : minor refactoring to TOKEN::insertToken. Give the linenr and fileIndex the same values as this token. It's better than nothing --- token.cpp | 8 +++++--- token.h | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/token.cpp b/token.cpp index ff468f1f7..287fedbc6 100644 --- a/token.cpp +++ b/token.cpp @@ -366,16 +366,18 @@ void TOKEN::previous( TOKEN *previous ) _previous = previous; } -void TOKEN::insertToken( const char *str ) +void TOKEN::insertToken( const char str[] ) { TOKEN *newToken = new TOKEN; - newToken->setstr( str ); + newToken->setstr( str ); + newToken->_linenr = _linenr; + newToken->_fileIndex = _fileIndex; if( this->next() ) { newToken->next( this->next() ); newToken->next()->previous( newToken ); } - + this->next( newToken ); newToken->previous( this ); } diff --git a/token.h b/token.h index e403ede8b..c31d801cf 100644 --- a/token.h +++ b/token.h @@ -134,14 +134,14 @@ public: */ static void eraseTokens( TOKEN *begin, const TOKEN *end ); - void eraseToken(); + void eraseToken(); /** * Insert new token after this token. This function will handle * relations between next and previous token also. * @param str String for the new token. */ - void insertToken( const char *str ); + void insertToken( const char str[] ); TOKEN *previous() const;