diff options
author | Georg Brandl <georg@python.org> | 2011-06-18 11:43:36 +0200 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2011-06-18 11:43:36 +0200 |
commit | 562ff26ebb78e487310bbacc19e172e56dbd8cbe (patch) | |
tree | b6e61569df4e65ccbaf1799d8d85bedc1d783b7f /pygments/lexers/agile.py | |
parent | e9d162a0a9156db681297fe1625d4cdbb3420641 (diff) | |
download | pygments-562ff26ebb78e487310bbacc19e172e56dbd8cbe.tar.gz |
Fix Ruby no-whitespace-regex rule (#672).
Diffstat (limited to 'pygments/lexers/agile.py')
-rw-r--r-- | pygments/lexers/agile.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/pygments/lexers/agile.py b/pygments/lexers/agile.py index 38256eea..d4449bd9 100644 --- a/pygments/lexers/agile.py +++ b/pygments/lexers/agile.py @@ -484,11 +484,11 @@ class RubyLexer(ExtendedRegexLexer): def gen_rubystrings_rules(): def intp_regex_callback(self, match, ctx): - yield match.start(1), String.Regex, match.group(1) # begin + yield match.start(1), String.Regex, match.group(1) # begin nctx = LexerContext(match.group(3), 0, ['interpolated-regex']) for i, t, v in self.get_tokens_unprocessed(context=nctx): yield match.start(3)+i, t, v - yield match.start(4), String.Regex, match.group(4) # end[mixounse]* + yield match.start(4), String.Regex, match.group(4) # end[mixounse]* ctx.pos = match.end() def intp_string_callback(self, match, ctx): @@ -496,7 +496,7 @@ class RubyLexer(ExtendedRegexLexer): nctx = LexerContext(match.group(3), 0, ['interpolated-string']) for i, t, v in self.get_tokens_unprocessed(context=nctx): yield match.start(3)+i, t, v - yield match.start(4), String.Other, match.group(4) # end + yield match.start(4), String.Other, match.group(4) # end ctx.pos = match.end() states = {} @@ -661,7 +661,8 @@ class RubyLexer(ExtendedRegexLexer): # multiline regex (in method calls) (r'(?<=\(|,)/', String.Regex, 'multiline-regex'), # multiline regex (this time the funny no whitespace rule) - (r'(\s+)(/[^\s=])', String.Regex, 'multiline-regex'), + (r'(\s+)(/)(?![\s=])', bygroups(Text, String.Regex), + 'multiline-regex'), # lex numbers and ignore following regular expressions which # are division operators in fact (grrrr. i hate that. any # better ideas?) |