Skip to content

Commit cbbd74f

Browse files
committed
match Ruby 1.9 hash syntax even without space after colon
1 parent d87cdc1 commit cbbd74f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/coderay/scanners/ruby.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,13 @@ def scan_tokens encoder, options
9595
match = scan(unicode ? /#{patterns::METHOD_NAME}/uo :
9696
/#{patterns::METHOD_NAME}/o)
9797

98-
if value_expected != :colon_expected && scan(/:(?= )/)
98+
kind = patterns::IDENT_KIND[match]
99+
if kind == :ident && value_expected != :colon_expected && scan(/:(?!:)/)
99100
value_expected = true
100101
encoder.text_token match, :key
101102
encoder.text_token ':', :operator
102103
else
103104
value_expected = false
104-
kind = patterns::IDENT_KIND[match]
105105
if kind == :ident
106106
if match[/\A[A-Z]/] && !(match[/[!?]$/] || match?(/\(/))
107107
kind = :constant

0 commit comments

Comments
 (0)