diff --git a/RedPandaIDE/parser/cppparser.cpp b/RedPandaIDE/parser/cppparser.cpp index 87b36b5d..12b84f8f 100644 --- a/RedPandaIDE/parser/cppparser.cpp +++ b/RedPandaIDE/parser/cppparser.cpp @@ -4686,7 +4686,7 @@ PEvalStatement CppParser::doEvalExpression(const QString& fileName, } return result; } else - return doEvalPointerArithmetic( + return doEvalArithmeticOperation( fileName, phraseExpression, pos, @@ -4695,7 +4695,7 @@ PEvalStatement CppParser::doEvalExpression(const QString& fileName, freeScoped); } -PEvalStatement CppParser::doEvalPointerArithmetic(const QString &fileName, const QStringList &phraseExpression, int &pos, const PStatement &scope, const PEvalStatement &previousResult, bool freeScoped) const +PEvalStatement CppParser::doEvalArithmeticOperation(const QString &fileName, const QStringList &phraseExpression, int &pos, const PStatement &scope, const PEvalStatement &previousResult, bool freeScoped) const { if (pos>=phraseExpression.length()) return PEvalStatement(); @@ -6594,9 +6594,18 @@ QStringList CppParser::splitExpression(const QString &expr) for(int i=0;itokenType()!=QSynedit::TokenType::Comment - && syntaxer.getTokenAttribute()->tokenType()!=QSynedit::TokenType::Space) - result.append(syntaxer.getToken()); + QSynedit::TokenType tokenType = syntaxer.getTokenAttribute()->tokenType(); + QString token = syntaxer.getToken(); + if (tokenType == QSynedit::TokenType::Operator) { + if ( token == ">>" ) { + result.append(">"); + result.append(">"); + } else { + result.append(token); + } + } else if (tokenType!=QSynedit::TokenType::Comment + && tokenType!=QSynedit::TokenType::Space) + result.append(token); syntaxer.next(); } } diff --git a/RedPandaIDE/parser/cppparser.h b/RedPandaIDE/parser/cppparser.h index 0af6fe1e..6a8d9f25 100644 --- a/RedPandaIDE/parser/cppparser.h +++ b/RedPandaIDE/parser/cppparser.h @@ -325,13 +325,15 @@ private: bool freeScoped, bool expandMacros) const; - PEvalStatement doEvalPointerArithmetic( + /* add + / minus - */ + PEvalStatement doEvalArithmeticOperation( const QString& fileName, const QStringList& phraseExpression, int &pos, const PStatement& scope, const PEvalStatement& previousResult, bool freeScoped) const; + /* Pointer to members .* / ->* */ PEvalStatement doEvalPointerToMembers( const QString& fileName, const QStringList& phraseExpression, @@ -341,7 +343,7 @@ private: bool freeScoped) const; /* - * Dereference / Address-of / Type Cast / Prefix increment and decrement + * Dereference * / Address-of & / Type Cast / Prefix increment and decrement * */ PEvalStatement doEvalTypeCast( const QString& fileName,