summaryrefslogtreecommitdiffstats
path: root/lib/cppparser/lexer.h
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:56:07 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:56:07 +0000
commitd6f8bbb45b267065a6907e71ff9c98bb6d161241 (patch)
treed109539636691d7b03036ca1c0ed29dbae6577cf /lib/cppparser/lexer.h
parent3331a47a9cad24795c7440ee8107143ce444ef34 (diff)
downloadtdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.tar.gz
tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/cppparser/lexer.h')
-rw-r--r--lib/cppparser/lexer.h98
1 files changed, 49 insertions, 49 deletions
diff --git a/lib/cppparser/lexer.h b/lib/cppparser/lexer.h
index 08681a4d..a94e5c5e 100644
--- a/lib/cppparser/lexer.h
+++ b/lib/cppparser/lexer.h
@@ -22,11 +22,11 @@
#include "driver.h"
-#include <qstring.h>
-#include <qmap.h>
-#include <qvaluestack.h>
-#include <qpair.h>
-#include <qptrvector.h>
+#include <tqstring.h>
+#include <tqmap.h>
+#include <tqvaluestack.h>
+#include <tqpair.h>
+#include <tqptrvector.h>
#include <hashedstring.h>
#include <ext/hash_map>
@@ -151,8 +151,8 @@ struct LexerData;
class Token
{
- Token(const QString &);
- Token( int type, int position, int length, const QString& text );
+ Token(const TQString &);
+ Token( int type, int position, int length, const TQString& text );
Token( const Token& source );
Token& operator = ( const Token& source );
@@ -176,7 +176,7 @@ public:
int position() const;
void setPosition( int position );
- QString text() const;
+ TQString text() const;
private:
int m_type;
@@ -186,7 +186,7 @@ private:
int m_startColumn;
int m_endLine;
int m_endColumn;
- const QString & m_text;
+ const TQString & m_text;
friend class Lexer;
friend class Parser;
@@ -217,10 +217,10 @@ public:
void setPreprocessorEnabled( bool enabled );
void resetSkipWords();
- void addSkipWord( const QString& word, SkipType skipType=SkipWord, const QString& str = QString::null );
+ void addSkipWord( const TQString& word, SkipType skipType=SkipWord, const TQString& str = TQString::null );
- QString source() const;
- void setSource( const QString& source );
+ TQString source() const;
+ void setSource( const TQString& source );
int index() const;
void setIndex( int index );
@@ -246,23 +246,23 @@ public:
return m_source.unicode() + offset;
}
- inline int getOffset( const QChar* p ) const {
+ inline int getOffset( const TQChar* p ) const {
return int(p - (m_source.unicode()));
}
private:
- void setEndPtr( const QChar* c ) {
+ void setEndPtr( const TQChar* c ) {
m_endPtr = c;
if( m_ptr < m_endPtr )
m_currentChar = *m_ptr;
else
- m_currentChar = QChar::null;
+ m_currentChar = TQChar::null;
}
- const QChar currentChar() const;
- QChar peekChar( int n=1 ) const;
+ const TQChar currentChar() const;
+ TQChar peekChar( int n=1 ) const;
int currentPosition() const;
- void insertCurrent( const QString& str );
+ void insertCurrent( const TQString& str );
void tokenize();
void nextToken( Token& token, bool stopOnNewline=false );
@@ -284,7 +284,7 @@ private:
// preprocessor (based on an article of Al Stevens on Dr.Dobb's journal)
int testIfLevel();
int macroDefined();
- QString readArgument();
+ TQString readArgument();
int macroPrimary();
int macroMultiplyDivide();
@@ -298,7 +298,7 @@ private:
int macroLogicalOr();
int macroExpression();
- void handleDirective( const QString& directive );
+ void handleDirective( const TQString& directive );
void processDefine( Macro& macro );
void processElse();
void processElif();
@@ -312,17 +312,17 @@ private:
private:
LexerData* d;
Driver* m_driver;
- QPtrVector< Token > m_tokens;
+ TQPtrVector< Token > m_tokens;
int m_size;
int m_index;
- QString m_source;
- const QChar* m_ptr;
- const QChar* m_endPtr;
- QChar m_currentChar;
+ TQString m_source;
+ const TQChar* m_ptr;
+ const TQChar* m_endPtr;
+ TQChar m_currentChar;
bool m_recordComments;
bool m_recordWhiteSpaces;
bool m_startLine;
- __gnu_cxx::hash_map< HashedString, QPair<SkipType, QString> > m_words;
+ __gnu_cxx::hash_map< HashedString, QPair<SkipType, TQString> > m_words;
int m_skippedLines;
@@ -331,8 +331,8 @@ private:
bool m_skipWordsEnabled;
// preprocessor
- QMemArray<bool> m_skipping;
- QMemArray<bool> m_trueTest;
+ TQMemArray<bool> m_skipping;
+ TQMemArray<bool> m_trueTest;
int m_ifLevel;
bool m_preprocessorEnabled;
bool m_inPreproc;
@@ -346,7 +346,7 @@ private:
};
-inline Token::Token(const QString & text = "")
+inline Token::Token(const TQString & text = "")
: m_type( -1 ),
m_position( 0 ),
m_length( 0 ),
@@ -354,7 +354,7 @@ inline Token::Token(const QString & text = "")
{
}
-inline Token::Token( int type, int position, int length, const QString& text )
+inline Token::Token( int type, int position, int length, const TQString& text )
: m_type( type ),
m_position( position ),
m_length( length ),
@@ -424,7 +424,7 @@ inline int Token::position() const
return m_position;
}
-inline QString Token::text() const
+inline TQString Token::text() const
{
return m_text.mid(m_position, m_length);
}
@@ -488,7 +488,7 @@ inline void Lexer::setRecordWhiteSpaces( bool record )
m_recordWhiteSpaces = record;
}
-inline QString Lexer::source() const
+inline TQString Lexer::source() const
{
return m_source;
}
@@ -540,7 +540,7 @@ inline void Lexer::nextChar()
if( m_ptr < m_endPtr )
m_currentChar = *m_ptr;
else
- m_currentChar = QChar::null;
+ m_currentChar = TQChar::null;
}
inline void Lexer::nextChar( int n )
@@ -551,7 +551,7 @@ inline void Lexer::nextChar( int n )
if( m_ptr < m_endPtr )
m_currentChar = *m_ptr;
else
- m_currentChar = QChar::null;
+ m_currentChar = TQChar::null;
}
inline void Lexer::readIdentifier()
@@ -563,7 +563,7 @@ inline void Lexer::readIdentifier()
inline void Lexer::readWhiteSpaces( bool skipNewLine, bool skipOnlyOnce )
{
while( !currentChar().isNull() ){
- QChar ch = currentChar();
+ TQChar ch = currentChar();
if( ch == '\n' && !skipNewLine ){
break;
@@ -582,7 +582,7 @@ inline void Lexer::readWhiteSpaces( bool skipNewLine, bool skipOnlyOnce )
}
//little hack for better performance
-inline bool isTodo( const QString& txt, int position ) {
+inline bool isTodo( const TQString& txt, int position ) {
if( txt.length() < position + 4 ) return false;
return (txt[ position ] == 't' || txt[ position ] == 'T')
&& (txt[ position+1 ] == 'o' || txt[ position+1 ] == 'O')
@@ -590,7 +590,7 @@ inline bool isTodo( const QString& txt, int position ) {
&& (txt[ position+3 ] == 'o' || txt[ position+3 ] == 'O');
}
-inline bool isFixme( const QString& txt, int position ) {
+inline bool isFixme( const TQString& txt, int position ) {
if( txt.length() < position + 5 ) return false;
return (txt[ position ] == 'f' || txt[ position ] == 'F')
&& (txt[ position+1 ] == 'i' || txt[ position+1 ] == 'I')
@@ -604,7 +604,7 @@ inline void Lexer::readLineComment()
while( !currentChar().isNull() && currentChar() != '\n' ){
if( m_reportMessages && isTodo( m_source, currentPosition() ) ){
nextChar( 4 );
- QString msg;
+ TQString msg;
int line = m_currentLine;
int col = m_currentColumn;
@@ -621,7 +621,7 @@ inline void Lexer::readLineComment()
} else
if( m_reportMessages && isFixme( m_source, currentPosition() ) ){
nextChar( 5 );
- QString msg;
+ TQString msg;
int line = m_currentLine;
int col = m_currentColumn;
@@ -648,7 +648,7 @@ inline void Lexer::readMultiLineComment()
return;
} else if( m_reportMessages && isTodo( m_source, currentPosition() ) ){
nextChar( 4 );
- QString msg;
+ TQString msg;
int line = m_currentLine;
int col = m_currentColumn;
@@ -664,7 +664,7 @@ inline void Lexer::readMultiLineComment()
} else
if( m_reportMessages && isFixme( m_source, currentPosition() ) ) {
nextChar( 5 );
- QString msg;
+ TQString msg;
int line = m_currentLine;
int col = m_currentColumn;
@@ -742,7 +742,7 @@ inline int Lexer::findOperator3() const
int n = getOffset( m_endPtr ) - currentPosition();
if( n >= 3){
- QChar ch = currentChar(), ch1=peekChar(), ch2=peekChar(2);
+ TQChar ch = currentChar(), ch1=peekChar(), ch2=peekChar(2);
if( ch == '<' && ch1 == '<' && ch2 == '=' ) return Token_assign;
else if( ch == '>' && ch1 == '>' && ch2 == '=' ) return Token_assign;
@@ -758,7 +758,7 @@ inline int Lexer::findOperator2() const
int n = getOffset( m_endPtr ) - currentPosition();
if( n>=2 ){
- QChar ch = currentChar(), ch1=peekChar();
+ TQChar ch = currentChar(), ch1=peekChar();
if( ch == ':' && ch1 == ':' ) return Token_scope;
else if( ch == '.' && ch1 == '*' ) return Token_ptrmem;
@@ -812,19 +812,19 @@ inline int Lexer::currentPosition() const
return getOffset( m_ptr );
}
-inline const QChar Lexer::currentChar() const
+inline const TQChar Lexer::currentChar() const
{
return m_currentChar;
}
-inline QChar Lexer::peekChar( int n ) const
+inline TQChar Lexer::peekChar( int n ) const
{
- const QChar* p = m_ptr + n;
+ const TQChar* p = m_ptr + n;
if( p < m_endPtr )
return *p;
else
- return QChar::null;
+ return TQChar::null;
}
inline bool Lexer::eof() const
@@ -852,7 +852,7 @@ inline void Lexer::setReportMessages( bool enable )
m_reportMessages = enable;
}
-inline void Lexer::insertCurrent( const QString& str ) {
+inline void Lexer::insertCurrent( const TQString& str ) {
int posi = currentPosition();
m_source.insert( posi, str );
@@ -861,7 +861,7 @@ inline void Lexer::insertCurrent( const QString& str ) {
if( m_ptr < m_endPtr )
m_currentChar = *m_ptr;
else
- m_currentChar = QChar::null;
+ m_currentChar = TQChar::null;
}
#endif