inline functions in tokenizer

This commit is contained in:
Roy Qu 2024-04-10 10:09:04 +08:00
parent 66e48cbf41
commit 7abbe2f6b5
2 changed files with 10 additions and 51 deletions

View File

@ -526,34 +526,6 @@ QString CppTokenizer::getWord()
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)
{
//remove \n \r;

View File

@ -49,31 +49,18 @@ public:
void clear();
void tokenize(const QStringList& buffer);
void dumpTokens(const QString& fileName);
const PToken& operator[](int i) const {
return mTokenList[i];
}
int tokenCount() const {
return mTokenList.count();
}
static bool isIdentChar(const QChar& ch) {
return ch=='_' || ch.isLetter() ;
}
int lambdasCount() const {
return mLambdas.count();
}
const PToken& operator[](int i) const { return mTokenList[i]; }
int tokenCount() const { return mTokenList.count(); }
static bool isIdentChar(const QChar& ch) { return ch=='_' || ch.isLetter(); }
int lambdasCount() const { return mLambdas.count(); }
int indexOfFirstLambda() const {
return mLambdas.front();
}
void removeFirstLambda() {
mLambdas.pop_front();
}
int indexOfFirstLambda() const { return mLambdas.front(); }
void removeFirstLambda() { mLambdas.pop_front(); }
private:
void addToken(const QString& sText, int iLine, TokenType tokenType);
void advance();
void countLines();
PToken getToken(int index);
// QString getForInit();
QString getNextToken(
@ -81,11 +68,11 @@ private:
QString getNumber();
QString getPreprocessor();
QString getWord();
bool isArguments();
bool isArguments() { return *mCurrent == '('; }
// bool isForInit();
bool isNumber();
bool isPreprocessor();
bool isWord();
bool isNumber() { return isDigitChar(*mCurrent); }
bool isPreprocessor() { return *mCurrent=='#'; }
bool isWord() { return isIdentChar(*mCurrent) && (*(mCurrent+1) != '"') && (*(mCurrent+1) != '\''); }
void simplify(QString& output);
void simplifyArgs(QString& output);
// void skipAssignment();