[TxMt] perl "=>" operator

Grant Hollingworth grant at antiflux.org
Thu Nov 23 21:45:57 UTC 2006


* Allan Odgaard <throw-away-1 at macromates.com> [2006-11-23 13:49]:
>In property lists we scope it constant.other.key[.plist] -- here  
>format is to be considered a key in the key/value data structure.

Okay.  I was going to use string.quoted because the key is turned into a string  (e.g., {'this' => 'that'} and {this => 'that'} are identical structures) but it looks wrong to see them as strings.  Perl can think of them as strings, but to us they're keys.

I added the related case of bareword subscripts.  For example, in

    { format => 'html' }->{ format }

the first format is constant.other.key.perl, and the second is constant.other.bareword.perl.  Maybe constant.other.subscript is better?

I used (?<={)\s*\w+\s*(?=}) for the match, so the spaces around the second format are in the same scope.  Is that a problem?
-------------- next part --------------
Index: Perl.tmbundle/Syntaxes/Perl.plist
===================================================================
--- Perl.tmbundle/Syntaxes/Perl.plist	(revision 6201)
+++ Perl.tmbundle/Syntaxes/Perl.plist	(working copy)
@@ -845,6 +845,18 @@
 			</array>
 		</dict>
 		<dict>
+			<key>match</key>
+			<string>\b\w+\s*(?==>)</string>
+			<key>name</key>
+			<string>constant.other.key.perl</string>
+		</dict>
+		<dict>
+			<key>match</key>
+			<string>(?<={)\s*\w+\s*(?=})</string>
+			<key>name</key>
+			<string>constant.other.bareword.perl</string>
+		</dict>
+		<dict>
 			<key>captures</key>
 			<dict>
 				<key>1</key>


More information about the textmate mailing list