| 418 | } |
| 419 | |
| 420 | static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCurrent, |
| 421 | int startPos, unsigned int endPos, |
| 422 | unsigned int lastStart, unsigned int currentPos, Accessor &styler) { |
| 423 | char s[100]; |
| 424 | GetRangeLowered(lastStart, currentPos, styler, s, sizeof(s)); |
| 425 | |
| 426 | if (strcmp(s, "record") == 0) { |
| 427 | lineFoldStateCurrent |= stateFoldInRecord; |
| 428 | levelCurrent++; |
| 429 | } else if (strcmp(s, "begin") == 0 || |
| 430 | strcmp(s, "asm") == 0 || |
| 431 | strcmp(s, "try") == 0 || |
| 432 | (strcmp(s, "case") == 0 && !(lineFoldStateCurrent & stateFoldInRecord))) { |
| 433 | levelCurrent++; |
| 434 | } else if (strcmp(s, "class") == 0 || strcmp(s, "object") == 0) { |
| 435 | // "class" & "object" keywords require special handling... |
| 436 | bool ignoreKeyword = false; |
| 437 | unsigned int j = SkipWhiteSpace(currentPos, endPos, styler); |
| 438 | if (j < endPos) { |
| 439 | CharacterSet setWordStart(CharacterSet::setAlpha, "_"); |
| 440 | CharacterSet setWord(CharacterSet::setAlphaNum, "_"); |
| 441 | |
| 442 | if (styler.SafeGetCharAt(j) == ';') { |
| 443 | // Handle forward class declarations ("type TMyClass = class;") |
| 444 | // and object method declarations ("TNotifyEvent = procedure(Sender: TObject) of object;") |
| 445 | ignoreKeyword = true; |
| 446 | } else if (strcmp(s, "class") == 0) { |
| 447 | // "class" keyword has a few more special cases... |
| 448 | if (styler.SafeGetCharAt(j) == '(') { |
| 449 | // Handle simplified complete class declarations ("type TMyClass = class(TObject);") |
| 450 | j = SkipWhiteSpace(j, endPos, styler, true); |
| 451 | if (j < endPos && styler.SafeGetCharAt(j) == ')') { |
| 452 | j = SkipWhiteSpace(j, endPos, styler); |
| 453 | if (j < endPos && styler.SafeGetCharAt(j) == ';') { |
| 454 | ignoreKeyword = true; |
| 455 | } |
| 456 | } |
| 457 | } else if (setWordStart.Contains(styler.SafeGetCharAt(j))) { |
| 458 | char s2[11]; // Size of the longest possible keyword + one additional character + null |
| 459 | GetForwardRangeLowered(j, setWord, styler, s2, sizeof(s2)); |
| 460 | |
| 461 | if (strcmp(s2, "procedure") == 0 || |
| 462 | strcmp(s2, "function") == 0 || |
| 463 | strcmp(s2, "of") == 0 || |
| 464 | strcmp(s2, "var") == 0 || |
| 465 | strcmp(s2, "property") == 0 || |
| 466 | strcmp(s2, "operator") == 0) { |
| 467 | ignoreKeyword = true; |
| 468 | } |
| 469 | } |
| 470 | } |
| 471 | } |
| 472 | if (!ignoreKeyword) { |
| 473 | levelCurrent++; |
| 474 | } |
| 475 | } else if (strcmp(s, "interface") == 0) { |
| 476 | // "interface" keyword requires special handling... |
| 477 | bool ignoreKeyword = true; |
no test coverage detected