- fix: Function argument infos are not correctly parsed.
This commit is contained in:
parent
f7eacaa048
commit
f763cec8f4
3
NEWS.md
3
NEWS.md
|
@ -11,7 +11,8 @@ Red Panda C++ Version 2.27
|
|||
- enhancement: Don't force fixed-width when using non fixed-width fonts.
|
||||
- change: Replace non-ascii font with fallback font.
|
||||
- enhancement: Display ascii control chars.
|
||||
- fix: Parser: invalidating file may break class inheritance infos.
|
||||
- fix: Parser: invalidating file may lost class inheritance infos.
|
||||
- fix: Function argument infos are not correctly parsed.
|
||||
|
||||
Red Panda C++ Version 2.26
|
||||
- enhancement: Code suggestion for embedded std::vectors.
|
||||
|
|
|
@ -1460,6 +1460,7 @@ PStatement CppParser::addStatement(const PStatement &parent,
|
|||
QChar ch=mTokenizer[i]->text[0];
|
||||
if (this->isIdentChar(ch)) {
|
||||
QString spaces=(i>argStart)?" ":"";
|
||||
if (args.length()>0 && isWordChar(args.back()))
|
||||
args+=spaces;
|
||||
word += mTokenizer[i]->text;
|
||||
if (!typeGetted) {
|
||||
|
@ -1473,12 +1474,17 @@ PStatement CppParser::addStatement(const PStatement &parent,
|
|||
}
|
||||
word="";
|
||||
} else if (this->isDigitChar(ch)) {
|
||||
args+=" ";
|
||||
} else if (mTokenizer[i]->text=="::") {
|
||||
if (braceLevel==0) {
|
||||
noNameArgs+= mTokenizer[i]->text;
|
||||
}
|
||||
} else {
|
||||
switch(ch.unicode()) {
|
||||
case ',':
|
||||
if (braceLevel==0)
|
||||
if (braceLevel==0) {
|
||||
typeGetted=false;
|
||||
noNameArgs+= mTokenizer[i]->text;
|
||||
}
|
||||
break;
|
||||
case '{':
|
||||
case '[':
|
||||
|
@ -1495,15 +1501,17 @@ PStatement CppParser::addStatement(const PStatement &parent,
|
|||
//todo: * and & processing
|
||||
case '*':
|
||||
case '&':
|
||||
if (braceLevel==0)
|
||||
word+=ch;
|
||||
if (braceLevel==0) {
|
||||
noNameArgs+= mTokenizer[i]->text;
|
||||
}
|
||||
break;
|
||||
}
|
||||
noNameArgs+= mTokenizer[i]->text;
|
||||
}
|
||||
args+=mTokenizer[i]->text;
|
||||
}
|
||||
|
||||
if (!word.isEmpty()) {
|
||||
noNameArgs.append(word);
|
||||
}
|
||||
args="("+args.trimmed()+")";
|
||||
noNameArgs="("+noNameArgs.trimmed()+")";
|
||||
return addStatement(
|
||||
|
|
|
@ -415,9 +415,14 @@ QString CppTokenizer::getNumber()
|
|||
|
||||
QString result;
|
||||
if (offset != mCurrent) {
|
||||
if (*mCurrent=='.') {
|
||||
// keep '.' for decimal
|
||||
mCurrent++;
|
||||
while (isDigitChar(*mCurrent) || isHexChar(*mCurrent)) {
|
||||
mCurrent++;
|
||||
}
|
||||
}
|
||||
result = QString(offset,mCurrent-offset);
|
||||
if (*mCurrent=='.') // keep '.' for decimal
|
||||
result += *mCurrent;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue