aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorColomban Wendling <ban@herbesfolles.org>2012-09-13 16:23:15 +0200
committerColomban Wendling <ban@herbesfolles.org>2012-09-13 16:23:15 +0200
commit4d11ddd074a1d6107dfc2617f6bdf1024fa37de6 (patch)
tree0939397e5214701e73b1fbe2f68ca040adbeb1cf
parent942d2811f0944ccf704eea3f2b631a2e6657093e (diff)
downloadscintilla-mirror-4d11ddd074a1d6107dfc2617f6bdf1024fa37de6.tar.gz
Fix folding of "for" Ruby loops
The "for" loops can end with a "do" keyword, and this "do" shouldn't start its own scope.
-rw-r--r--lexers/LexRuby.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/lexers/LexRuby.cxx b/lexers/LexRuby.cxx
index 23115e6e0..22364c19c 100644
--- a/lexers/LexRuby.cxx
+++ b/lexers/LexRuby.cxx
@@ -1436,7 +1436,8 @@ static bool keywordIsAmbiguous(const char *prevWord)
|| !strcmp(prevWord, "do")
|| !strcmp(prevWord, "while")
|| !strcmp(prevWord, "unless")
- || !strcmp(prevWord, "until")) {
+ || !strcmp(prevWord, "until")
+ || !strcmp(prevWord, "for")) {
return true;
} else {
return false;
@@ -1554,6 +1555,7 @@ static bool keywordIsModifier(const char *word,
#define WHILE_BACKWARDS "elihw"
#define UNTIL_BACKWARDS "litnu"
+#define FOR_BACKWARDS "rof"
// Nothing fancy -- look to see if we follow a while/until somewhere
// on the current line
@@ -1591,7 +1593,8 @@ static bool keywordDoStartsLoop(int pos,
*dst = 0;
// Did we see our keyword?
if (!strcmp(prevWord, WHILE_BACKWARDS)
- || !strcmp(prevWord, UNTIL_BACKWARDS)) {
+ || !strcmp(prevWord, UNTIL_BACKWARDS)
+ || !strcmp(prevWord, FOR_BACKWARDS)) {
return true;
}
// We can move pos to the beginning of the keyword, and then