Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit39cbd37

Browse files
committed
add support for Ruby 2.2 quoted hash keys
KNOWN ISSUE: string interpolation will not work!
1 parent080f8a8 commit39cbd37

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎lib/coderay/scanners/ruby.rb‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,18 @@ def scan_tokens encoder, options
164164
end
165165

166166
elsifmatch=scan(/ ' (?:(?>[^'\\]*) ')? | " (?:(?>[^"\\\#]*) ")? /mx)
167-
encoder.begin_group:string
168167
ifmatch.size ==1
168+
encoder.begin_group:string
169169
encoder.text_tokenmatch,:delimiter
170170
state=self.class::StringState.new:string,match =='"',match# important for streaming
171171
else
172+
kind=value_expected ==true &&scan(/:/) ?:key ::string
173+
encoder.begin_groupkind
172174
encoder.text_tokenmatch[0,1],:delimiter
173175
encoder.text_tokenmatch[1..-2],:contentifmatch.size >2
174176
encoder.text_tokenmatch[-1,1],:delimiter
175-
encoder.end_group:string
177+
encoder.end_groupkind
178+
encoder.text_token':',:operatorifkind ==:key
176179
value_expected=false
177180
end
178181

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp