From 99b4e5e34f26ee26eefcb259789604e3d9e4af36 Mon Sep 17 00:00:00 2001 From: Stefan Daschek Date: Sun, 27 May 2012 23:03:33 +0200 Subject: [PATCH] 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. --- Syntaxes/Ruby.plist | 48 ++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 09e1482..97198de 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -162,6 +162,38 @@ name invalid.deprecated.ruby + + captures + + 1 + + name + punctuation.definition.constant.ruby + + + comment + symbols as hash key (1.9 syntax) + match + (?>[a-zA-Z_]\w*(?>[?!])?)(:)(?!:) + name + constant.other.symbol.hashkey.ruby + + + captures + + 1 + + name + punctuation.definition.constant.ruby + + + comment + symbols as hash key (1.8 syntax) + match + (?<!:)(:)(?>[a-zA-Z_]\w*(?>[?!])?)(?=\s*=>) + name + constant.other.symbol.hashkey.ruby + comment everything being a reserved word, not a value and needing a 'end' is a.. @@ -1567,22 +1599,6 @@ name constant.other.symbol.ruby - - captures - - 1 - - name - punctuation.definition.constant.ruby - - - comment - symbols - match - (?>[a-zA-Z_]\w*(?>[?!])?)(:)(?!:) - name - constant.other.symbol.ruby.19syntax - begin ^=begin