[TxMt] perl: embedded xml in heredoc

Grant Hollingworth grant at antiflux.org
Mon Nov 27 19:54:15 UTC 2006


Attached is a little patch to add embedded XML to Perl.

For example:

    my $foo = <<XML;
    <?xml version="1.0" encoding="UTF-8"?>
    <example>foo</example>
    XML
-------------- next part --------------
Index: Perl.tmbundle/Syntaxes/Perl.plist
===================================================================
--- Perl.tmbundle/Syntaxes/Perl.plist	(revision 6230)
+++ Perl.tmbundle/Syntaxes/Perl.plist	(working copy)
@@ -1303,6 +1303,47 @@
 		</dict>
 		<dict>
 			<key>begin</key>
+			<string>((<<) *"XML").*\n?</string>
+			<key>captures</key>
+			<dict>
+				<key>0</key>
+				<dict>
+					<key>name</key>
+					<string>punctuation.definition.string.perl</string>
+				</dict>
+				<key>1</key>
+				<dict>
+					<key>name</key>
+					<string>string.unquoted.heredoc.doublequote.perl</string>
+				</dict>
+				<key>2</key>
+				<dict>
+					<key>name</key>
+					<string>punctuation.definition.heredoc.perl</string>
+				</dict>
+			</dict>
+			<key>contentName</key>
+			<string>text.xml.embedded.perl</string>
+			<key>end</key>
+			<string>(^XML$)</string>
+			<key>patterns</key>
+			<array>
+				<dict>
+					<key>include</key>
+					<string>#escaped_char</string>
+				</dict>
+				<dict>
+					<key>include</key>
+					<string>#variable</string>
+				</dict>
+				<dict>
+					<key>include</key>
+					<string>text.xml</string>
+				</dict>
+			</array>
+		</dict>
+		<dict>
+			<key>begin</key>
 			<string>((<<) *"CSS").*\n?</string>
 			<key>captures</key>
 			<dict>
@@ -1496,6 +1537,39 @@
 		</dict>
 		<dict>
 			<key>begin</key>
+			<string>((<<) *'XML').*\n?</string>
+			<key>captures</key>
+			<dict>
+				<key>0</key>
+				<dict>
+					<key>name</key>
+					<string>punctuation.definition.string.perl</string>
+				</dict>
+				<key>1</key>
+				<dict>
+					<key>name</key>
+					<string>string.unquoted.heredoc.quote.perl</string>
+				</dict>
+				<key>2</key>
+				<dict>
+					<key>name</key>
+					<string>punctuation.definition.heredoc.perl</string>
+				</dict>
+			</dict>
+			<key>contentName</key>
+			<string>text.xml.embedded.perl</string>
+			<key>end</key>
+			<string>(^XML$)</string>
+			<key>patterns</key>
+			<array>
+				<dict>
+					<key>include</key>
+					<string>text.xml</string>
+				</dict>
+			</array>
+		</dict>
+		<dict>
+			<key>begin</key>
 			<string>((<<) *'CSS').*\n?</string>
 			<key>captures</key>
 			<dict>
@@ -1699,6 +1773,47 @@
 		</dict>
 		<dict>
 			<key>begin</key>
+			<string>((<<) *XML\b).*\n?</string>
+			<key>captures</key>
+			<dict>
+				<key>0</key>
+				<dict>
+					<key>name</key>
+					<string>punctuation.definition.string.perl</string>
+				</dict>
+				<key>1</key>
+				<dict>
+					<key>name</key>
+					<string>string.unquoted.heredoc.perl</string>
+				</dict>
+				<key>2</key>
+				<dict>
+					<key>name</key>
+					<string>punctuation.definition.heredoc.perl</string>
+				</dict>
+			</dict>
+			<key>contentName</key>
+			<string>text.xml.embedded.perl</string>
+			<key>end</key>
+			<string>(^XML$)</string>
+			<key>patterns</key>
+			<array>
+				<dict>
+					<key>include</key>
+					<string>#escaped_char</string>
+				</dict>
+				<dict>
+					<key>include</key>
+					<string>#variable</string>
+				</dict>
+				<dict>
+					<key>include</key>
+					<string>text.xml</string>
+				</dict>
+			</array>
+		</dict>
+		<dict>
+			<key>begin</key>
 			<string>((<<) *SQL\b).*\n?</string>
 			<key>captures</key>
 			<dict>


More information about the textmate mailing list