summaryrefslogtreecommitdiff
path: root/lib/coderay
diff options
context:
space:
mode:
authorKornelius Kalnbach <murphy@rubychan.de>2013-02-17 20:47:48 +0100
committerKornelius Kalnbach <murphy@rubychan.de>2013-02-17 20:47:48 +0100
commitcbbd74f318ee762d5bd7dec2b86e1c00523de9dd (patch)
treedcdeced475329053ea21ee718cc9dce6f596a97c /lib/coderay
parentd87cdc14fed39d0d18fa289cddaaba67253bf4ca (diff)
downloadcoderay-cbbd74f318ee762d5bd7dec2b86e1c00523de9dd.tar.gz
match Ruby 1.9 hash syntax even without space after colon
Diffstat (limited to 'lib/coderay')
-rw-r--r--lib/coderay/scanners/ruby.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/coderay/scanners/ruby.rb b/lib/coderay/scanners/ruby.rb
index 8cd89f0..c5cf1e2 100644
--- a/lib/coderay/scanners/ruby.rb
+++ b/lib/coderay/scanners/ruby.rb
@@ -95,13 +95,13 @@ module Scanners
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