MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / ClassifyPascalPreprocessorFoldPoint

Function ClassifyPascalPreprocessorFoldPoint

scintilla/lexers/LexPascal.cxx:374–405  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

372}
373
374static void ClassifyPascalPreprocessorFoldPoint(int &levelCurrent, int &lineFoldStateCurrent,
375 unsigned int startPos, Accessor &styler) {
376 CharacterSet setWord(CharacterSet::setAlpha);
377
378 char s[11]; // Size of the longest possible keyword + one additional character + null
379 GetForwardRangeLowered(startPos, setWord, styler, s, sizeof(s));
380
381 unsigned int nestLevel = GetFoldInPreprocessorLevelFlag(lineFoldStateCurrent);
382
383 if (strcmp(s, "if") == 0 ||
384 strcmp(s, "ifdef") == 0 ||
385 strcmp(s, "ifndef") == 0 ||
386 strcmp(s, "ifopt") == 0 ||
387 strcmp(s, "region") == 0) {
388 nestLevel++;
389 SetFoldInPreprocessorLevelFlag(lineFoldStateCurrent, nestLevel);
390 lineFoldStateCurrent |= stateFoldInPreprocessor;
391 levelCurrent++;
392 } else if (strcmp(s, "endif") == 0 ||
393 strcmp(s, "ifend") == 0 ||
394 strcmp(s, "endregion") == 0) {
395 nestLevel--;
396 SetFoldInPreprocessorLevelFlag(lineFoldStateCurrent, nestLevel);
397 if (nestLevel == 0) {
398 lineFoldStateCurrent &= ~stateFoldInPreprocessor;
399 }
400 levelCurrent--;
401 if (levelCurrent < SC_FOLDLEVELBASE) {
402 levelCurrent = SC_FOLDLEVELBASE;
403 }
404 }
405}
406
407static unsigned int SkipWhiteSpace(unsigned int currentPos, unsigned int endPos,
408 Accessor &styler, bool includeChars = false) {

Callers 1

FoldPascalDocFunction · 0.85

Calls 3

GetForwardRangeLoweredFunction · 0.85

Tested by

no test coverage detected