Permalink
Browse files

Specific scope for symbols when used as hash keys.

Covers both 1.8 and 1.9 syntax. Needs higher precedence than keywords so that keys in hashes like `{ class: foo }` are parsed correctly.
  • Loading branch information...
1 parent b7e9875 commit 99b4e5e34f26ee26eefcb259789604e3d9e4af36 @noniq noniq committed with infininight May 27, 2012
Showing with 32 additions and 16 deletions.
  1. +32 −16 Syntaxes/Ruby.plist
View
@@ -163,6 +163,38 @@
<string>invalid.deprecated.ruby</string>
</dict>
<dict>
+ <key>captures</key>
+ <dict>
+ <key>1</key>
+ <dict>
+ <key>name</key>
+ <string>punctuation.definition.constant.ruby</string>
+ </dict>
+ </dict>
+ <key>comment</key>
+ <string>symbols as hash key (1.9 syntax)</string>
+ <key>match</key>
+ <string>(?&gt;[a-zA-Z_]\w*(?&gt;[?!])?)(:)(?!:)</string>
+ <key>name</key>
+ <string>constant.other.symbol.hashkey.ruby</string>
+ </dict>
+ <dict>
+ <key>captures</key>
+ <dict>
+ <key>1</key>
+ <dict>
+ <key>name</key>
+ <string>punctuation.definition.constant.ruby</string>
+ </dict>
+ </dict>
+ <key>comment</key>
+ <string>symbols as hash key (1.8 syntax)</string>
+ <key>match</key>
+ <string>(?&lt;!:)(:)(?&gt;[a-zA-Z_]\w*(?&gt;[?!])?)(?=\s*=&gt;)</string>
+ <key>name</key>
+ <string>constant.other.symbol.hashkey.ruby</string>
+ </dict>
+ <dict>
<key>comment</key>
<string>everything being a reserved word, not a value and needing a 'end' is a..</string>
<key>match</key>
@@ -1568,22 +1600,6 @@
<string>constant.other.symbol.ruby</string>
</dict>
<dict>
- <key>captures</key>
- <dict>
- <key>1</key>
- <dict>
- <key>name</key>
- <string>punctuation.definition.constant.ruby</string>
- </dict>
- </dict>
- <key>comment</key>
- <string>symbols</string>
- <key>match</key>
- <string>(?&gt;[a-zA-Z_]\w*(?&gt;[?!])?)(:)(?!:)</string>
- <key>name</key>
- <string>constant.other.symbol.ruby.19syntax</string>
- </dict>
- <dict>
<key>begin</key>
<string>^=begin</string>
<key>captures</key>

0 comments on commit 99b4e5e

Please sign in to comment.