From 584974c292edbca8be0b6c2ccf8dc9dc1ba6e15a Mon Sep 17 00:00:00 2001 From: Richard Metzler Date: Sat, 7 Dec 2013 01:20:50 +0100 Subject: FIX 873 Ruby 1.9 hash syntax, symbol with underscore as key not highlighted properly Bugreport: https://bitbucket.org/birkenfeld/pygments-main/issue/873/ruby-19-hash-syntax-symbol-with-underscore Example: https://gist.github.com/rmetzler/7833554 --- pygments/lexers/agile.py | 2 +- tests/examplefiles/hash_syntax.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 tests/examplefiles/hash_syntax.rb diff --git a/pygments/lexers/agile.py b/pygments/lexers/agile.py index 1f81365e..b5fc287c 100644 --- a/pygments/lexers/agile.py +++ b/pygments/lexers/agile.py @@ -532,7 +532,7 @@ class RubyLexer(ExtendedRegexLexer): (r":'(\\\\|\\'|[^'])*'", String.Symbol), (r"'(\\\\|\\'|[^'])*'", String.Single), (r':"', String.Symbol, 'simple-sym'), - (r'([a-zA-Z_][a-zA-Z0-9]*)(:)(?!:)', + (r'([a-zA-Z_][a-zA-Z0-9_]*)(:)(?!:)', bygroups(String.Symbol, Punctuation)), # Since Ruby 1.9 (r'"', String.Double, 'simple-string'), (r'(? 'ok' } +{ 'stings as key' => 'should be ok' } +{ new_syntax: 'broken until now' } +{ withoutunderscore: 'should be ok' } +{ _underscoreinfront: 'might be ok, if I understand the pygments code correct' } -- cgit v1.2.1