From 3d8084c489ef89fe3131e1401fbd43aa4f36c8a4 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sun, 5 Dec 2021 16:45:48 +0800 Subject: [PATCH] work save --- RedPandaIDE/parser/cppparser.cpp | 33 +++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/RedPandaIDE/parser/cppparser.cpp b/RedPandaIDE/parser/cppparser.cpp index 5d452500..3847677c 100644 --- a/RedPandaIDE/parser/cppparser.cpp +++ b/RedPandaIDE/parser/cppparser.cpp @@ -3369,27 +3369,50 @@ PStatement CppParser::doParseSubExpression3(const QString &fileName, if (pos>=phraseExpression.length()) return PStatement(); if (phraseExpression[pos]=="*") { - pos++; - return doParseSubExpression3(fileName, + pos++; //skip "*" + PStatement statement = doParseSubExpression3(fileName, phraseExpression, pos, currentScope, freeScoped); + //todo: + return statement; } else if (phraseExpression[pos]=="&") { - pos++; - return doParseSubExpression3(fileName, + pos++; //skip "&" + PStatement statement = doParseSubExpression3(fileName, phraseExpression, pos, currentScope, freeScoped); + //todo: + return statement; } else if (phraseExpression[pos]=="++" || phraseExpression[pos]=="--") { - pos++; + pos++; //skip "++" or "--" return doParseSubExpression3(fileName, phraseExpression, pos, currentScope, freeScoped); + } else if (phraseExpression[pos]=="(") { + //parse + pos++; + PStatement typeStatement = doFindStatement(fileName,phraseExpression,pos,currentScope,freeScoped); + if (pos >= phraseExpression.length() || phraseExpression[pos]!=")") { + return PStatement(); + } else if (typeStatement && + (typeStatement->kind == StatementKind::skClass + || typeStatement->kind == StatementKind::skEnumType + || typeStatement->kind == StatementKind::skEnumClassType + || typeStatement->kind == StatementKind::skTypedef)) { + PStatement statement = doParseSubExpression3(fileName, + phraseExpression, + pos, + currentScope, + freeScoped); + return typeStatement; + } else + return PStatement(); } return doParseSubExpression2(fileName, phraseExpression,