- enhancement: better highlight processing for preprocess directives

This commit is contained in:
Roy Qu 2021-12-19 09:24:48 +08:00
parent 41336cf31f
commit 109ea5a0ae
2 changed files with 32 additions and 21 deletions

View File

@ -1,6 +1,7 @@
Version 0.11.3 For Dev-C++ 7 Beta Version 0.11.3 For Dev-C++ 7 Beta
- fix: use pixel size for fonts, to fit different dpi in multiple displays - fix: use pixel size for fonts, to fit different dpi in multiple displays
- enhancement: use the new expression parser to parse info for tips - enhancement: use the new expression parser to parse info for tips
- enhancement: better highlight processing for preprocess directives
Version 0.11.2 For Dev-C++ 7 Beta Version 0.11.2 For Dev-C++ 7 Beta
- fix: button "run all problem cases" not disabled when compiling or debugging - fix: button "run all problem cases" not disabled when compiling or debugging

View File

@ -420,28 +420,38 @@ void SynEditCppHighlighter::directiveProc()
return; return;
} }
mTokenId = TokenKind::Directive; mTokenId = TokenKind::Directive;
do { mRun+=1;
switch(mLine[mRun].unicode()) { //skip spaces
case '/': //comment? while (mLine[mRun]!=0 && isSpaceChar(mLine[mRun])) {
switch (mLine[mRun+1].unicode()) {
case '/': // is end of directive as well
mRange.state = RangeState::rsUnknown;
return;
case '*': // might be embeded only
mRange.state = RangeState::rsDirectiveComment;
return;
}
break;
case '\\': // yet another line?
if (mLine[mRun+1] == 0) {
mRun+=1;
mRange.state = RangeState::rsMultiLineDirective;
return;
}
break;
}
mRun+=1; mRun+=1;
} while (mLine[mRun]!=0); }
while (mLine[mRun]!=0 && isIdentChar(mLine[mRun])) {
mRun+=1;
}
mRange.state = RangeState::rsUnknown;
// do {
// switch(mLine[mRun].unicode()) {
// case '/': //comment?
// switch (mLine[mRun+1].unicode()) {
// case '/': // is end of directive as well
// mRange.state = RangeState::rsUnknown;
// return;
// case '*': // might be embeded only
// mRange.state = RangeState::rsDirectiveComment;
// return;
// }
// break;
// case '\\': // yet another line?
// if (mLine[mRun+1] == 0) {
// mRun+=1;
// mRange.state = RangeState::rsMultiLineDirective;
// return;
// }
// break;
// }
// mRun+=1;
// } while (mLine[mRun]!=0);
} }
void SynEditCppHighlighter::directiveEndProc() void SynEditCppHighlighter::directiveEndProc()