[TxMt] MEL Bundle improvements

Dan Weeks textmate at danimal.org
Mon Sep 11 18:00:35 UTC 2006


Well, my email to Chandler was returned to me so here goes my
improvements to the MEL bundle.  I find them very useful and that they
round out the MEL support.

Changes:

* parsing for the function statements to catch 'global proc' and
  'proc' better
* preference to allow function names to be put into the symbol list
* moved global out of keyword.control.mel to keyword.other.mel
* made all scopes point to mel

Take what you want and feel free to point out where I made errors.

Thanks,

Dan

-------------- next part --------------
Index: Bundles/MEL.tmbundle/Preferences/Symbol List.tmPreferences
===================================================================
--- Bundles/MEL.tmbundle/Preferences/Symbol List.tmPreferences	(revision 0)
+++ Bundles/MEL.tmbundle/Preferences/Symbol List.tmPreferences	(revision 0)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>name</key>
+	<string>Symbol List</string>
+	<key>scope</key>
+	<string>meta.function.mel</string>
+	<key>settings</key>
+	<dict>
+		<key>showInSymbolList</key>
+		<integer>1</integer>
+		<key>symbolTransformation</key>
+		<string>  
+		s/(?:(?:global\s*)?proc)\s*(\w+\s*\[?\]?\s+|\s+)/ /g;
+		s/\s*\(.*\)?/ /g;
+ 	</string>
+	</dict>
+	<key>uuid</key>
+	<string>7FC6AD09-BA7B-4A76-BDFC-9D52BE631802</string>
+</dict>
+</plist>
Index: Bundles/MEL.tmbundle/Syntaxes/MEL.plist
===================================================================
--- Bundles/MEL.tmbundle/Syntaxes/MEL.plist	(revision 5159)
+++ Bundles/MEL.tmbundle/Syntaxes/MEL.plist	(working copy)
@@ -36,12 +36,18 @@
 		</dict>
 		<dict>
 			<key>match</key>
-			<string>\b(if|in|else|for|while|break|continue|case|default|do|switch|return|switch|case|global|proc|source|catch|alias)\b</string>
+			<string>\b(if|in|else|for|while|break|continue|case|default|do|switch|return|switch|case|source|catch|alias)\b</string>
 			<key>name</key>
 			<string>keyword.control.mel</string>
 		</dict>
 		<dict>
 			<key>match</key>
+			<string>\b(global)\b</string>
+			<key>name</key>
+			<string>keyword.other.mel</string>
+		</dict>
+		<dict>
+			<key>match</key>
 			<string>\b(null|undefined)\b</string>
 			<key>name</key>
 			<string>constant.language.mel</string>
@@ -73,7 +79,7 @@
 			<key>match</key>
 			<string>\$[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*?\b</string>
 			<key>name</key>
-			<string>variable.other.php</string>
+			<string>variable.other.mel</string>
 		</dict>
 		<dict>
 			<key>begin</key>
@@ -132,19 +138,24 @@
 		</dict>
 		<dict>
 			<key>begin</key>
-			<string>\b(proc)\s+([a-zA-Z_]\w*)\s*\(</string>
+			<string>((?:global\s*)?proc)\s*(\w+\s*\[?\]?\s+|\s+)([A-Za-z_][A-Za-z0-9_]*)\s*\(</string>
 			<key>captures</key>
 			<dict>
 				<key>1</key>
 				<dict>
 					<key>name</key>
-					<string>storage.type.function.asp</string>
+					<string>keyword.other.mel</string>
 				</dict>
 				<key>2</key>
 				<dict>
 					<key>name</key>
-					<string>entity.name.function.asp</string>
+					<string>storage.type.mel</string>
 				</dict>
+				<key>3</key>
+				<dict>
+					<key>name</key>
+					<string>entity.name.function.mel</string>
+				</dict>
 			</dict>
 			<key>end</key>
 			<string>\)</string>
@@ -153,10 +164,8 @@
 			<key>patterns</key>
 			<array>
 				<dict>
-					<key>match</key>
-					<string>[^,)\n]+</string>
-					<key>name</key>
-					<string>variable.parameter.function.asp</string>
+					<key>include</key>
+					<string>$self</string>
 				</dict>
 			</array>
 		</dict>


More information about the textmate mailing list