From 2a32bdcc5e67b568516e9016b9f787510483a500 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Thu, 13 Sep 2012 16:23:15 +0200 Subject: Fix folding of "for" Ruby loops The "for" loops can end with a "do" keyword, and this "do" shouldn't start its own scope. --- lexers/LexRuby.cxx | 7 +++++-- 1 file 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 -- cgit v1.2.3