diff --git a/libs/qsynedit/qsynedit/syntaxer/cpp.cpp b/libs/qsynedit/qsynedit/syntaxer/cpp.cpp index 6b39fd83..619a8a04 100644 --- a/libs/qsynedit/qsynedit/syntaxer/cpp.cpp +++ b/libs/qsynedit/qsynedit/syntaxer/cpp.cpp @@ -271,7 +271,7 @@ CppSyntaxer::TokenId CppSyntaxer::getTokenId() } } -void CppSyntaxer::andSymbolProc() +void CppSyntaxer::procAndSymbol() { mTokenId = TokenId::Symbol; if (mRun+1=mLineSize) { - nullProc(); + procNull(); return; } mTokenId = TokenId::Comment; @@ -307,12 +307,12 @@ void CppSyntaxer::ansiCppProc() mRange.state = RangeState::rsUnknown; } -void CppSyntaxer::ansiCProc() +void CppSyntaxer::procAnsiCStyleComment() { bool finishProcess = false; mTokenId = TokenId::Comment; if (mRun>=mLineSize) { - nullProc(); + procNull(); return; } while (mRun= mLineSize) { - nullProc(); + procNull(); return; } mRange.state = RangeState::rsUnknown; @@ -549,7 +549,7 @@ void CppSyntaxer::directiveEndProc() } while (mRun < mLineSize); } -void CppSyntaxer::equalProc() +void CppSyntaxer::procEqual() { mTokenId = TokenId::Symbol; if (mRun+1='0' && mLine[mRun+1]<='7') { - mTokenId=TokenId::Octal; - mRun+=2; - } - } else - mRun+=1; + if (isFloat) { + mTokenId = TokenId::Float; + mRun++; + } else { + mTokenId = TokenId::Number; + if (mRun+1='0' && mLine[mRun+1]<='7') { + mTokenId=TokenId::Octal; + mRun+=2; + } + } else + mRun+=1; + } + switch(mTokenId) { + case TokenId::Hex: + procHexNumber(); + break; + case TokenId::Octal: + procOctNumber(); + break; + default: + procDecNumber(); + } +} + +void CppSyntaxer::procDecNumber() +{ + while (mRun='0' && mLine[mRun+1]<='9') { - numberProc(); + procNumber(true); } else { mRun+=1; } } -void CppSyntaxer::questionProc() +void CppSyntaxer::procQuestion() { mTokenId = TokenId::Symbol; mRun+=1; } -void CppSyntaxer::rawStringProc() +void CppSyntaxer::procRawString() { bool noEscaping = false; mTokenId = TokenId::RawString; @@ -842,7 +890,7 @@ void CppSyntaxer::rawStringProc() mRange.state = RangeState::rsUnknown; } -void CppSyntaxer::roundCloseProc() +void CppSyntaxer::procRoundClose() { mRun += 1; mTokenId = TokenId::Symbol; @@ -852,7 +900,7 @@ void CppSyntaxer::roundCloseProc() popIndents(IndentType::Parenthesis); } -void CppSyntaxer::roundOpenProc() +void CppSyntaxer::procRoundOpen() { mRun += 1; mTokenId = TokenId::Symbol; @@ -860,7 +908,7 @@ void CppSyntaxer::roundOpenProc() pushIndents(IndentType::Parenthesis); } -void CppSyntaxer::semiColonProc() +void CppSyntaxer::procSemiColon() { mRun += 1; mTokenId = TokenId::Symbol; @@ -871,7 +919,7 @@ void CppSyntaxer::semiColonProc() } } -void CppSyntaxer::slashProc() +void CppSyntaxer::procSlash() { if (mRun+1= mLineSize) { mRange.state = RangeState::rsUnknown; @@ -1124,7 +1172,7 @@ void CppSyntaxer::stringProc() mRange.state = RangeState::rsUnknown; } -void CppSyntaxer::stringStartProc() +void CppSyntaxer::procStringStart() { mTokenId = TokenId::String; mRun += 1; @@ -1132,22 +1180,22 @@ void CppSyntaxer::stringStartProc() mRange.state = RangeState::rsUnknown; return; } - stringProc(); + procString(); } -void CppSyntaxer::tildeProc() +void CppSyntaxer::procTilde() { mRun+=1; mTokenId = TokenId::Symbol; } -void CppSyntaxer::unknownProc() +void CppSyntaxer::procUnknown() { mRun+=1; mTokenId = TokenId::Unknown; } -void CppSyntaxer::xorSymbolProc() +void CppSyntaxer::procXor() { mTokenId = TokenId::Symbol; if (mRun+1=mLineSize) { - nullProc(); + procNull(); } else { switch(mLine[mRun].unicode()) { case '&': - andSymbolProc(); + procAndSymbol(); break; case '\'': - asciiCharProc(); + procAsciiChar(); break; case '}': - braceCloseProc(); + procBraceClose(); break; case '{': - braceOpenProc(); + procBraceOpen(); break; case ':': - colonProc(); + procColon(); break; case ',': - commaProc(); + procComma(); break; case '#': - directiveProc(); + procDirective(); break; case '=': - equalProc(); + procEqual(); break; case '>': - greaterProc(); + procGreater(); break; case '?': - questionProc(); + procQuestion(); break; case '<': - lowerProc(); + procLower(); break; case '-': - minusProc(); + procMinus(); break; case '%': - modSymbolProc(); + procMod(); break; case '!': - notSymbolProc(); + procNot(); break; case '\\': - backSlashProc(); + procBackSlash(); break; case '0': case '1': @@ -1218,52 +1266,52 @@ void CppSyntaxer::processChar() case '7': case '8': case '9': - numberProc(); + procNumber(); break; case '|': - orSymbolProc(); + procOr(); break; case '+': - plusProc(); + procPlus(); break; case '.': - pointProc(); + procPoint(); break; case ')': - roundCloseProc(); + procRoundClose(); break; case '(': - roundOpenProc(); + procRoundOpen(); break; case ';': - semiColonProc(); + procSemiColon(); break; case '/': - slashProc(); + procSlash(); break; case ']': - squareCloseProc(); + procSquareClose(); break; case '[': - squareOpenProc(); + procSquareOpen(); break; case '*': - starProc(); + procStar(); break; case '"': - stringStartProc(); + procStringStart(); break; case '~': - tildeProc(); + procTilde(); break; case '^': - xorSymbolProc(); + procXor(); break; default: if (isIdentChar(mLine[mRun])) { - identProc(); + procIdentifier(); } else { - unknownProc(); + procUnknown(); } } } @@ -1409,7 +1457,7 @@ void CppSyntaxer::next() mTokenPos = mRun; do { if (mRun=mLineSize) { - nullProc(); + procNull(); } else if (mLine[mRun]=='\'') { mRange.state = rsUnknown; mTokenId = TokenId::Char; mRun+=1; } else { - asciiCharProc(); + procAsciiChar(); } break; case RangeState::rsDefineIdentifier: //qDebug()<<"*8-0-0*"; - defineIdentProc(); + procDefineIdent(); break; case RangeState::rsDefineRemaining: //qDebug()<<"*9-0-0*"; - defineRemainingProc(); + procDefineRemaining(); break; default: //qDebug()<<"*a-0-0*"; mRange.state = RangeState::rsUnknown; if (mRun>=mLineSize) { //qDebug()<<"*b-0-0*"; - nullProc(); + procNull(); } else if (mRun+1