From e5b86be9c1f49c3c16ae48d22319b54bf180f21c Mon Sep 17 00:00:00 2001 From: Marko Njezic Date: Thu, 9 Feb 2012 21:28:40 +0100 Subject: LexPascal folding improvements: - Ignore forward interface declarations as fold points - Fold dispinterface code blocks --- lexers/LexPascal.cxx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lexers/LexPascal.cxx') diff --git a/lexers/LexPascal.cxx b/lexers/LexPascal.cxx index 867b00ea6..1e2be2318 100644 --- a/lexers/LexPascal.cxx +++ b/lexers/LexPascal.cxx @@ -54,6 +54,8 @@ are ignored as fold points 4. Every other situation when class keyword doesn't actually start class declaration ("class procedure", "class function", "class of", "class var", "class property" and "class operator") +5. Forward (disp)interface declarations ("type IMyInterface = interface;") are +ignored as fold points - Folding of code blocks inside preprocessor blocks is disabled (any comments inside them will be folded fine) because there is no guarantee that complete @@ -483,6 +485,24 @@ static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCur if (j >= startPos && styler.SafeGetCharAt(j) == '=') { ignoreKeyword = false; } + if (!ignoreKeyword) { + unsigned int k = SkipWhiteSpace(currentPos, endPos, styler); + if (k < endPos && styler.SafeGetCharAt(k) == ';') { + // Handle forward interface declarations ("type IMyInterface = interface;") + ignoreKeyword = true; + } + } + if (!ignoreKeyword) { + levelCurrent++; + } + } else if (strcmp(s, "dispinterface") == 0) { + // "dispinterface" keyword requires special handling... + bool ignoreKeyword = false; + unsigned int j = SkipWhiteSpace(currentPos, endPos, styler); + if (j < endPos && styler.SafeGetCharAt(j) == ';') { + // Handle forward dispinterface declarations ("type IMyInterface = dispinterface;") + ignoreKeyword = true; + } if (!ignoreKeyword) { levelCurrent++; } -- cgit v1.2.3