Permalink
Browse files

Promote to a first-class grammar.

  • Loading branch information...
infininight committed Nov 18, 2011
1 parent 56b535b commit 6f756d94ff2c140ebaf1021726d9713f0ab077c2
Showing with 179 additions and 141 deletions.
  1. +17 −7 Commands/Special: Return Inside an Empty Tag.tmCommand
  2. +162 −134 Syntaxes/PHP.plist
@@ -1,27 +1,37 @@
<?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">
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
- <string>exit_insert_snippet "
+ <string>#!/usr/bin/env bash
+[[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] &amp;&amp; . "${TM_SUPPORT_PATH}/lib/bash_init.sh"
+
+exit_insert_snippet "
\$0
?"</string>
<key>fallbackInput</key>
<string>scope</string>
<key>input</key>
<string>selection</string>
+ <key>inputFormat</key>
+ <string>text</string>
<key>keyEquivalent</key>
- <string>
-</string>
+ <string></string>
<key>name</key>
<string>Special: Return Inside an Empty Tag</string>
- <key>output</key>
- <string>insertAsSnippet</string>
+ <key>outputCaret</key>
+ <string>afterOutput</string>
+ <key>outputFormat</key>
+ <string>snippet</string>
+ <key>outputLocation</key>
+ <string>replaceInput</string>
<key>scope</key>
- <string>meta.embedded.line.empty.html source.php</string>
+ <string>meta.embedded.line.empty.php source.php</string>
<key>uuid</key>
<string>647C793F-9098-481B-8B5A-BCEF3B48CB03</string>
+ <key>version</key>
+ <integer>2</integer>
</dict>
</plist>
View
@@ -7,121 +7,181 @@
• Try to improve parameters list syntax – scope numbers, ‘=’, ‘,’ and possibly be intelligent about entity ordering
• Is meta.function-call the correct scope? I've added it to my theme but by default it's not highlighted</string>
<key>fileTypes</key>
- <array/>
+ <array>
+ <string>php</string>
+ <string>php3</string>
+ <string>php4</string>
+ <string>php5</string>
+ <string>phpt</string>
+ <string>phtml</string>
+ <string>aw</string>
+ <string>ctp</string>
+ </array>
<key>firstLineMatch</key>
<string>^#!.*(?&lt;!-)php[0-9]{0,1}\b</string>
<key>foldingStartMarker</key>
<string>(/\*|\{\s*$|&lt;&lt;&lt;HTML)</string>
<key>foldingStopMarker</key>
<string>(\*/|^\s*\}|^HTML;)</string>
- <key>name</key>
- <string>PHP</string>
- <key>patterns</key>
- <array>
+ <key>injections</key>
+ <dict>
+ <key>text.html.php - (meta.embedded | meta.tag), meta.tag string.quoted</key>
<dict>
- <key>captures</key>
- <dict>
- <key>1</key>
- <dict>
- <key>name</key>
- <string>punctuation.whitespace.embedded.leading.php</string>
- </dict>
- <key>2</key>
- <dict>
- <key>name</key>
- <string>meta.embedded.line.empty.html</string>
- </dict>
- <key>3</key>
- <dict>
- <key>name</key>
- <string>punctuation.section.embedded.begin.php</string>
- </dict>
- <key>4</key>
- <dict>
- <key>name</key>
- <string>meta.consecutive-tags.php</string>
- </dict>
- <key>5</key>
- <dict>
- <key>name</key>
- <string>source.php</string>
- </dict>
- <key>6</key>
- <dict>
- <key>name</key>
- <string>punctuation.section.embedded.end.php</string>
- </dict>
- <key>7</key>
- <dict>
- <key>name</key>
- <string>source.php</string>
- </dict>
- <key>8</key>
+ <key>patterns</key>
+ <array>
<dict>
- <key>name</key>
- <string>punctuation.whitespace.embedded.trailing.php</string>
- </dict>
- </dict>
- <key>comment</key>
- <string>Matches empty tags.</string>
- <key>match</key>
- <string>(?x)
- (^\s*)? # 1 - Leading whitespace
- ( # 2 - meta.embedded.line.empty.php
- ( # 3 - Open Tag
- (?:
- ((?&lt;=\?&gt;)&lt;) # 4 - Consecutive tags
- | &lt;
+ <key>captures</key>
+ <dict>
+ <key>1</key>
+ <dict>
+ <key>name</key>
+ <string>punctuation.whitespace.embedded.leading.php</string>
+ </dict>
+ <key>2</key>
+ <dict>
+ <key>name</key>
+ <string>meta.embedded.line.empty.php</string>
+ </dict>
+ <key>3</key>
+ <dict>
+ <key>name</key>
+ <string>punctuation.section.embedded.begin.php</string>
+ </dict>
+ <key>4</key>
+ <dict>
+ <key>name</key>
+ <string>meta.consecutive-tags.php</string>
+ </dict>
+ <key>5</key>
+ <dict>
+ <key>name</key>
+ <string>source.php</string>
+ </dict>
+ <key>6</key>
+ <dict>
+ <key>name</key>
+ <string>punctuation.section.embedded.end.php</string>
+ </dict>
+ <key>7</key>
+ <dict>
+ <key>name</key>
+ <string>source.php</string>
+ </dict>
+ <key>8</key>
+ <dict>
+ <key>name</key>
+ <string>punctuation.whitespace.embedded.trailing.php</string>
+ </dict>
+ </dict>
+ <key>comment</key>
+ <string>Matches empty tags.</string>
+ <key>match</key>
+ <string>(?x)
+ (^\s*)? # 1 - Leading whitespace
+ ( # 2 - meta.embedded.line.empty.php
+ ( # 3 - Open Tag
+ (?:
+ ((?&lt;=\?&gt;)&lt;) # 4 - Consecutive tags
+ | &lt;
+ )
+ \?(?i:php|=)?
+ )
+ (\s*) # 5 - Loneliness
+ ((\?)&gt;) # 6 - Close Tag
+ # 7 - Scope ? as scope.php
)
- \?(?i:php|=)?
+ (
+ \1 # Match nothing if there was no
+ # leading whitespace...
+ | (\s*$\n)? # or match trailing whitespace.
)
- (\s*) # 5 - Loneliness
- ((\?)&gt;) # 6 - Close Tag
- # 7 - Scope ? as scope.php
- )
- (
- \1 # Match nothing if there was no
- # leading whitespace...
- | (\s*$\n)? # or match trailing whitespace.
- )
- </string>
- </dict>
- <dict>
- <key>begin</key>
- <string>^\s*(?=&lt;\?)</string>
- <key>beginCaptures</key>
- <dict>
- <key>0</key>
- <dict>
- <key>name</key>
- <string>punctuation.whitespace.embedded.leading.php</string>
+ </string>
</dict>
- </dict>
- <key>comment</key>
- <string>Catches tags with preceeding whitespace.</string>
- <key>end</key>
- <string>(?&lt;=\?&gt;)(\s*$\n)?</string>
- <key>endCaptures</key>
- <dict>
- <key>0</key>
<dict>
- <key>name</key>
- <string>punctuation.whitespace.embedded.trailing.php</string>
+ <key>begin</key>
+ <string>^\s*(?=&lt;\?)</string>
+ <key>beginCaptures</key>
+ <dict>
+ <key>0</key>
+ <dict>
+ <key>name</key>
+ <string>punctuation.whitespace.embedded.leading.php</string>
+ </dict>
+ </dict>
+ <key>comment</key>
+ <string>Catches tags with preceeding whitespace.</string>
+ <key>end</key>
+ <string>(?&lt;=\?&gt;)(\s*$\n)?</string>
+ <key>endCaptures</key>
+ <dict>
+ <key>0</key>
+ <dict>
+ <key>name</key>
+ <string>punctuation.whitespace.embedded.trailing.php</string>
+ </dict>
+ </dict>
+ <key>patterns</key>
+ <array>
+ <dict>
+ <key>begin</key>
+ <string>&lt;\?(?i:php|=)?</string>
+ <key>beginCaptures</key>
+ <dict>
+ <key>0</key>
+ <dict>
+ <key>name</key>
+ <string>punctuation.section.embedded.begin.php</string>
+ </dict>
+ </dict>
+ <key>contentName</key>
+ <string>source.php</string>
+ <key>end</key>
+ <string>(\?)&gt;</string>
+ <key>endCaptures</key>
+ <dict>
+ <key>0</key>
+ <dict>
+ <key>name</key>
+ <string>punctuation.section.embedded.end.php</string>
+ </dict>
+ <key>1</key>
+ <dict>
+ <key>name</key>
+ <string>source.php</string>
+ </dict>
+ </dict>
+ <key>name</key>
+ <string>meta.embedded.block.php</string>
+ <key>patterns</key>
+ <array>
+ <dict>
+ <key>include</key>
+ <string>#language</string>
+ </dict>
+ </array>
+ </dict>
+ </array>
</dict>
- </dict>
- <key>patterns</key>
- <array>
<dict>
<key>begin</key>
- <string>&lt;\?(?i:php|=)?</string>
+ <string>(((?&lt;=\?&gt;)&lt;)|&lt;)\?(?i:php|=)?</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.section.embedded.begin.php</string>
</dict>
+ <key>2</key>
+ <dict>
+ <key>name</key>
+ <string>meta.consecutive-tags.php</string>
+ </dict>
</dict>
+ <key>comment</key>
+ <string>Catches the remainder.</string>
+ <key>contentName</key>
+ <string>source.php</string>
<key>end</key>
<string>(\?)&gt;</string>
<key>endCaptures</key>
@@ -138,7 +198,7 @@
</dict>
</dict>
<key>name</key>
- <string>meta.embedded.block.html</string>
+ <string>meta.embedded.line.php</string>
<key>patterns</key>
<array>
<dict>
@@ -149,48 +209,16 @@
</dict>
</array>
</dict>
+ </dict>
+ <key>keyEquivalent</key>
+ <string>^~P</string>
+ <key>name</key>
+ <string>PHP</string>
+ <key>patterns</key>
+ <array>
<dict>
- <key>begin</key>
- <string>(((?&lt;=\?&gt;)&lt;)|&lt;)\?(?i:php|=)?</string>
- <key>beginCaptures</key>
- <dict>
- <key>0</key>
- <dict>
- <key>name</key>
- <string>punctuation.section.embedded.begin.php</string>
- </dict>
- <key>2</key>
- <dict>
- <key>name</key>
- <string>meta.consecutive-tags.php</string>
- </dict>
- </dict>
- <key>comment</key>
- <string>Catches the remainder.</string>
- <key>end</key>
- <string>(\?)&gt;</string>
- <key>endCaptures</key>
- <dict>
- <key>0</key>
- <dict>
- <key>name</key>
- <string>punctuation.section.embedded.end.php</string>
- </dict>
- <key>1</key>
- <dict>
- <key>name</key>
- <string>source.php</string>
- </dict>
- </dict>
- <key>name</key>
- <string>meta.embedded.line.html</string>
- <key>patterns</key>
- <array>
- <dict>
- <key>include</key>
- <string>#language</string>
- </dict>
- </array>
+ <key>include</key>
+ <string>text.html.basic</string>
</dict>
</array>
<key>repository</key>

2 comments on commit 6f756d9

@therik

This comment has been minimized.

Show comment Hide comment
@therik

therik Mar 16, 2013

This commit actually broke the compatibility with sublime text 2. Technically speaking, the commit before broke it, but even if I revert the change from previous commit in this one, it makes sublime crash. I'm surprised about that.

This commit actually broke the compatibility with sublime text 2. Technically speaking, the commit before broke it, but even if I revert the change from previous commit in this one, it makes sublime crash. I'm surprised about that.

@infininight

This comment has been minimized.

Show comment Hide comment
@infininight

infininight Mar 16, 2013

Owner

We have added some grammar features in 2.0 that (I don't believe) Sublime has added yet. You'll need to use the 1.x branch until it does.

https://github.com/textmate/php.tmbundle/tree/textmate-1.x

This would apply to any bundles under the textmate user.

Owner

infininight replied Mar 16, 2013

We have added some grammar features in 2.0 that (I don't believe) Sublime has added yet. You'll need to use the 1.x branch until it does.

https://github.com/textmate/php.tmbundle/tree/textmate-1.x

This would apply to any bundles under the textmate user.

Please sign in to comment.