Commits

Georg Brandl committed a2b92eb Merge

Merged in rmetzler/pygments-main/fix-873-ruby-hash-symbols (pull request #259)

fix bug 873 ruby 1.9 symbols in hashes

  • Participants
  • Parent commits 5ee077a, 1e9250b

Comments (0)

Files changed (2)

File pygments/lexers/agile.py

             (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'(?<!\.)`', String.Backtick, 'simple-backtick'),

File tests/examplefiles/hash_syntax.rb

+{ :old_syntax => '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' }