diff --git a/RedPandaIDE/parser/cpptokenizer.cpp b/RedPandaIDE/parser/cpptokenizer.cpp index 2cf23d7a..2f70cc14 100644 --- a/RedPandaIDE/parser/cpptokenizer.cpp +++ b/RedPandaIDE/parser/cpptokenizer.cpp @@ -378,41 +378,38 @@ void cpptokenizer::skipPair(const QChar &cStart, const QChar cEnd, const QSet '''' then - SkipRawString // don't do it inside AnsiString! - else - Inc(pCurrent); - end else if pCurrent^ = '"' then begin - if cStart <> '''' then - SkipDoubleQuotes // don't do it inside AnsiString! - else - Inc(pCurrent); - end else if pCurrent^ = '''' then begin - SkipSingleQuote; - end else if pCurrent^ = '/' then begin - if (pCurrent + 1)^ = '/' then - SkipToEOL - else if (pCurrent + 1)^ = '*' then - SkipCStyleComment // skips over */ - else - Inc(pCurrent); - end else if pCurrent^ in FailChars then begin - Exit; - end else - Inc(pCurrent); - end; + if ((*mCurrent == '(') && !failChars.contains('(')) { + skipPair('(', ')', failChars); + } else if ((*mCurrent == '[') && !failChars.contains('[')) { + skipPair('[', ']', failChars); + } else if ((*mCurrent == '{') && !failChars.contains('{')) { + skipPair('{', '}', failChars); + } else if (*mCurrent == cStart) { + skipPair(cStart, cEnd, failChars); + } else if (*mCurrent == cEnd) { + mCurrent++; // skip over end + break; + } else if ((*mCurrent == 'R') && (*(mCurrent+1) == '"')) { + if (cStart != '\'' && cStart!='\"') + skipRawString(); // don't do it inside AnsiString! + else + mCurrent++; + } else if (*mCurrent == '"') { + if (cStart != '\'' && cStart!='\"') + skipDoubleQuotes(); // don't do it inside AnsiString! + else + mCurrent++; + } else if (*mCurrent == '\'') { + if (cStart != '\'' && cStart!='\"') + skipSingleQuote(); // don't do it inside AnsiString! + else + mCurrent++; + } else if (failChars.contains(*mCurrent)) { + break; + } else { + mCurrent++; + } + } } void cpptokenizer::advance()