- fix: '^' is not correctly handled as operator.

This commit is contained in:
Roy Qu 2023-05-24 13:42:46 +08:00
parent a251173a6a
commit 19a85db1f9
5 changed files with 25 additions and 23 deletions

View File

@ -3,6 +3,7 @@ Red Panda C++ Version 2.22
- fix: Crash at startup when current problem in the problem set is connected with source file.
- fix: Double-clicking on touchpad can't select current word.
- fix: foreach-loops are not correctly parsed.
- fix: '^' is not correctly handled as operator.
Red Panda C++ Version 2.21

View File

@ -3981,7 +3981,7 @@ void CppParser::internalParse(const QString &fileName)
if (mTokenizer.tokenCount() == 0)
return;
#ifdef QT_DEBUG
// mTokenizer.dumpTokens(QString("r:\\tokens-%1.txt").arg(extractFileName(fileName)));
mTokenizer.dumpTokens(QString("r:\\tokens-%1.txt").arg(extractFileName(fileName)));
#endif
#ifdef QT_DEBUG
mLastIndex = -1;
@ -3994,8 +3994,8 @@ void CppParser::internalParse(const QString &fileName)
}
// qDebug()<<"parse"<<timer.elapsed();
#ifdef QT_DEBUG
// mStatementList.dumpAll(QString("r:\\all-stats-%1.txt").arg(extractFileName(fileName)));
// mStatementList.dump(QString("r:\\stats-%1.txt").arg(extractFileName(fileName)));
mStatementList.dumpAll(QString("r:\\all-stats-%1.txt").arg(extractFileName(fileName)));
mStatementList.dump(QString("r:\\stats-%1.txt").arg(extractFileName(fileName)));
#endif
//reduce memory usage
internalClear();

View File

@ -1122,26 +1122,26 @@ bool CppPreprocessor::isSpaceChar(const QChar &ch)
return ch == ' ' || ch == '\t';
}
bool CppPreprocessor::isOperatorChar(const QChar &ch)
{
//bool CppPreprocessor::isOperatorChar(const QChar &ch)
//{
switch(ch.unicode()) {
case '+':
case '-':
case '*':
case '/':
case '!':
case '=':
case '<':
case '>':
case '&':
case '|':
case '^':
return true;
default:
return false;
}
}
// switch(ch.unicode()) {
// case '+':
// case '-':
// case '*':
// case '/':
// case '!':
// case '=':
// case '<':
// case '>':
// case '&':
// case '|':
// case '^':
// return true;
// default:
// return false;
// }
//}
bool CppPreprocessor::isMacroIdentChar(const QChar &ch)
{

View File

@ -176,7 +176,7 @@ static bool isSpaceChar(const QChar& ch);
/*
* '+', '-', '*', '/', '!', '=', '<', '>', '&', '|', '^'
*/
static bool isOperatorChar(const QChar& ch);
//static bool isOperatorChar(const QChar& ch);
/*
* 'A'..'Z', 'a'..'z', '_'

View File

@ -373,6 +373,7 @@ QString CppTokenizer::getNextToken(TokenType *pTokenType)
case '|':
case '+':
case '~':
case '^':
if (*(mCurrent + 1) == '=') {
countLines();
result = *mCurrent;