inline functions in tokenizer
This commit is contained in:
parent
66e48cbf41
commit
7abbe2f6b5
|
@ -526,34 +526,6 @@ QString CppTokenizer::getWord()
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CppTokenizer::isArguments()
|
|
||||||
{
|
|
||||||
return *mCurrent == '(';
|
|
||||||
}
|
|
||||||
|
|
||||||
//bool CppTokenizer::isForInit()
|
|
||||||
//{
|
|
||||||
// return (*mCurrent == '(') && (mLastToken == "for");
|
|
||||||
//}
|
|
||||||
|
|
||||||
bool CppTokenizer::isNumber()
|
|
||||||
{
|
|
||||||
return isDigitChar(*mCurrent);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CppTokenizer::isPreprocessor()
|
|
||||||
{
|
|
||||||
return *mCurrent=='#';
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CppTokenizer::isWord()
|
|
||||||
{
|
|
||||||
bool result = isIdentChar(*mCurrent);
|
|
||||||
if (result && (*(mCurrent+1) == '"'))
|
|
||||||
result = false;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CppTokenizer::simplify(QString &output)
|
void CppTokenizer::simplify(QString &output)
|
||||||
{
|
{
|
||||||
//remove \n \r;
|
//remove \n \r;
|
||||||
|
|
|
@ -49,31 +49,18 @@ public:
|
||||||
void clear();
|
void clear();
|
||||||
void tokenize(const QStringList& buffer);
|
void tokenize(const QStringList& buffer);
|
||||||
void dumpTokens(const QString& fileName);
|
void dumpTokens(const QString& fileName);
|
||||||
const PToken& operator[](int i) const {
|
const PToken& operator[](int i) const { return mTokenList[i]; }
|
||||||
return mTokenList[i];
|
int tokenCount() const { return mTokenList.count(); }
|
||||||
}
|
static bool isIdentChar(const QChar& ch) { return ch=='_' || ch.isLetter(); }
|
||||||
int tokenCount() const {
|
int lambdasCount() const { return mLambdas.count(); }
|
||||||
return mTokenList.count();
|
|
||||||
}
|
|
||||||
static bool isIdentChar(const QChar& ch) {
|
|
||||||
return ch=='_' || ch.isLetter() ;
|
|
||||||
}
|
|
||||||
int lambdasCount() const {
|
|
||||||
return mLambdas.count();
|
|
||||||
}
|
|
||||||
|
|
||||||
int indexOfFirstLambda() const {
|
int indexOfFirstLambda() const { return mLambdas.front(); }
|
||||||
return mLambdas.front();
|
void removeFirstLambda() { mLambdas.pop_front(); }
|
||||||
}
|
|
||||||
void removeFirstLambda() {
|
|
||||||
mLambdas.pop_front();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void addToken(const QString& sText, int iLine, TokenType tokenType);
|
void addToken(const QString& sText, int iLine, TokenType tokenType);
|
||||||
void advance();
|
void advance();
|
||||||
void countLines();
|
void countLines();
|
||||||
PToken getToken(int index);
|
|
||||||
|
|
||||||
// QString getForInit();
|
// QString getForInit();
|
||||||
QString getNextToken(
|
QString getNextToken(
|
||||||
|
@ -81,11 +68,11 @@ private:
|
||||||
QString getNumber();
|
QString getNumber();
|
||||||
QString getPreprocessor();
|
QString getPreprocessor();
|
||||||
QString getWord();
|
QString getWord();
|
||||||
bool isArguments();
|
bool isArguments() { return *mCurrent == '('; }
|
||||||
// bool isForInit();
|
// bool isForInit();
|
||||||
bool isNumber();
|
bool isNumber() { return isDigitChar(*mCurrent); }
|
||||||
bool isPreprocessor();
|
bool isPreprocessor() { return *mCurrent=='#'; }
|
||||||
bool isWord();
|
bool isWord() { return isIdentChar(*mCurrent) && (*(mCurrent+1) != '"') && (*(mCurrent+1) != '\''); }
|
||||||
void simplify(QString& output);
|
void simplify(QString& output);
|
||||||
void simplifyArgs(QString& output);
|
void simplifyArgs(QString& output);
|
||||||
// void skipAssignment();
|
// void skipAssignment();
|
||||||
|
|
Loading…
Reference in New Issue