Permalink
Browse files

match Ruby 1.9 hash syntax even without space after colon

  • Loading branch information...
1 parent d87cdc1 commit cbbd74f318ee762d5bd7dec2b86e1c00523de9dd @korny korny committed Feb 17, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/coderay/scanners/ruby.rb
@@ -95,13 +95,13 @@ def scan_tokens encoder, options
match = scan(unicode ? /#{patterns::METHOD_NAME}/uo :
/#{patterns::METHOD_NAME}/o)
- if value_expected != :colon_expected && scan(/:(?= )/)
+ kind = patterns::IDENT_KIND[match]
+ if kind == :ident && value_expected != :colon_expected && scan(/:(?!:)/)
value_expected = true
encoder.text_token match, :key
encoder.text_token ':', :operator
else
value_expected = false
- kind = patterns::IDENT_KIND[match]
if kind == :ident
if match[/\A[A-Z]/] && !(match[/[!?]$/] || match?(/\(/))
kind = :constant

0 comments on commit cbbd74f

Please sign in to comment.