diff --git a/cppcheck.cbp b/cppcheck.cbp
index b7fd24ace..0419de521 100644
--- a/cppcheck.cbp
+++ b/cppcheck.cbp
@@ -77,6 +77,7 @@
+
diff --git a/token.cpp b/token.cpp
index 6729671d4..1e470b9ed 100644
--- a/token.cpp
+++ b/token.cpp
@@ -19,7 +19,8 @@
#include "token.h"
#include
#include
-#include
+#include
+#include
#ifdef __BORLANDC__
#include // isalpha, isdigit
@@ -399,3 +400,22 @@ void TOKEN::linenr( unsigned int linenr )
{
_linenr = linenr;
}
+
+void TOKEN::printOut( const char *title ) const
+{
+ std::cout << std::endl << "###";
+ if( title )
+ std::cout << " " << title << " ";
+ else
+ std::cout << "########";
+
+ std::cout << "###" << std::endl;
+ for( const TOKEN *t = this; t; t = t->next() )
+ {
+ std::cout << t->linenr() << ": " << t->str();
+ if( t->varId() )
+ std::cout << " ("<< t->varId() <<")";
+
+ std::cout << std::endl;
+ }
+}
diff --git a/token.h b/token.h
index 150c8d7f4..f71c472b0 100644
--- a/token.h
+++ b/token.h
@@ -146,7 +146,15 @@ public:
unsigned int varId() const;
- void varId( unsigned int id );
+ void varId( unsigned int id );
+
+ /**
+ * For debugging purposes, prints token and all tokens
+ * followed by it.
+ * @param title Title for the printout or use default parameter or 0
+ * for no title.
+ */
+ void printOut( const char *title = 0 ) const;
private:
void next( TOKEN *next );