aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexers/LexPascal.cxx
diff options
context:
space:
mode:
authorMarko Njezic <unknown>2012-02-09 21:28:40 +0100
committerMarko Njezic <unknown>2012-02-09 21:28:40 +0100
commite5b86be9c1f49c3c16ae48d22319b54bf180f21c (patch)
treea42af28dc9b8bc8fa3f029866166959864921900 /lexers/LexPascal.cxx
parent5bb80c3a74234ca11aa42bafc3af38f0fe782722 (diff)
downloadscintilla-mirror-e5b86be9c1f49c3c16ae48d22319b54bf180f21c.tar.gz
LexPascal folding improvements:
- Ignore forward interface declarations as fold points - Fold dispinterface code blocks
Diffstat (limited to 'lexers/LexPascal.cxx')
-rw-r--r--lexers/LexPascal.cxx20
1 files changed, 20 insertions, 0 deletions
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
@@ -484,6 +486,24 @@ static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCur
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++;
}
} else if (strcmp(s, "end") == 0) {