From 78ad4e3324b22f7635890acc89475ba2a821bc34 Mon Sep 17 00:00:00 2001 From: "royqh1979@gmail.com" Date: Sat, 14 Aug 2021 12:59:54 +0800 Subject: [PATCH] work save --- RedPandaIDE/parser/cpptokenizer.cpp | 67 ++++++++++++++--------------- 1 file changed, 32 insertions(+), 35 deletions(-) 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()