| 452 | // Function folding OScript code. |
| 453 | |
| 454 | static void FoldOScriptDoc(unsigned int startPos, int length, int initStyle, |
| 455 | WordList *[], Accessor &styler) { |
| 456 | bool foldComment = styler.GetPropertyInt("fold.comment") != 0; |
| 457 | bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0; |
| 458 | bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; |
| 459 | int endPos = startPos + length; |
| 460 | int visibleChars = 0; |
| 461 | int lineCurrent = styler.GetLine(startPos); |
| 462 | int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; |
| 463 | int levelCurrent = levelPrev; |
| 464 | char chNext = styler[startPos]; |
| 465 | int styleNext = styler.StyleAt(startPos); |
| 466 | int style = initStyle; |
| 467 | int lastStart = 0; |
| 468 | |
| 469 | for (int i = startPos; i < endPos; i++) { |
| 470 | char ch = chNext; |
| 471 | chNext = styler.SafeGetCharAt(i + 1); |
| 472 | int stylePrev = style; |
| 473 | style = styleNext; |
| 474 | styleNext = styler.StyleAt(i + 1); |
| 475 | bool atLineEnd = (ch == '\r' && chNext != '\n') || (ch == '\n'); |
| 476 | |
| 477 | if (foldComment && IsBlockComment(style)) { |
| 478 | if (!IsBlockComment(stylePrev)) { |
| 479 | levelCurrent++; |
| 480 | } else if (!IsBlockComment(styleNext) && !atLineEnd) { |
| 481 | // Comments do not end at end of line and the next character |
| 482 | // may not be styled. |
| 483 | levelCurrent--; |
| 484 | } |
| 485 | } |
| 486 | if (foldComment && atLineEnd && IsLineComment(lineCurrent, styler)) { |
| 487 | if (!IsLineComment(lineCurrent - 1, styler) && |
| 488 | IsLineComment(lineCurrent + 1, styler)) |
| 489 | levelCurrent++; |
| 490 | else if (IsLineComment(lineCurrent - 1, styler) && |
| 491 | !IsLineComment(lineCurrent+1, styler)) |
| 492 | levelCurrent--; |
| 493 | } |
| 494 | if (foldPreprocessor) { |
| 495 | if (ch == '#' && IsPreprocessor(style)) { |
| 496 | UpdatePreprocessorFoldLevel(levelCurrent, i + 1, styler); |
| 497 | } |
| 498 | } |
| 499 | |
| 500 | if (stylePrev != SCE_OSCRIPT_KEYWORD && style == SCE_OSCRIPT_KEYWORD) { |
| 501 | lastStart = i; |
| 502 | } |
| 503 | if (stylePrev == SCE_OSCRIPT_KEYWORD) { |
| 504 | if(IsIdentifierChar(ch) && !IsIdentifierChar(chNext)) { |
| 505 | UpdateKeywordFoldLevel(levelCurrent, lastStart, i, styler); |
| 506 | } |
| 507 | } |
| 508 | |
| 509 | if (!IsASpace(ch)) |
| 510 | visibleChars++; |
| 511 |
nothing calls this directly
no test coverage detected