Skip to content

Commit fc7ed8f

Browse files
committed
• Revise php tag matching in HTML and PHP grammars.
• Add back Special: Return Between PHP Tags. • Replace Special: Return Inside an Empty Tag. Scopes have been updated to support the new meta.embedded and punctuation.whitespace scopes, the scopes will look slightly wonky until I enable them but should work fine in the meantime. git-svn-id: http://svn.textmate.org/trunk/Bundles/PHP.tmbundle@8004 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
1 parent b4b00e8 commit fc7ed8f

File tree

5 files changed

+202
-47
lines changed

5 files changed

+202
-47
lines changed

Commands/Special: Return Inside an Empty Tag.tmCommand

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>beforeRunningCommand</key>
6+
<string>nop</string>
7+
<key>command</key>
8+
<string>exit_insert_snippet "
9+
\$0
10+
?"</string>
11+
<key>fallbackInput</key>
12+
<string>scope</string>
13+
<key>input</key>
14+
<string>selection</string>
15+
<key>keyEquivalent</key>
16+
<string></string>
17+
<key>name</key>
18+
<string>Special: Return Inside an Empty Tag</string>
19+
<key>output</key>
20+
<string>insertAsSnippet</string>
21+
<key>scope</key>
22+
<string>source.php.embedded.line.empty.html source.php</string>
23+
<key>uuid</key>
24+
<string>647C793F-9098-481B-8B5A-BCEF3B48CB03</string>
25+
</dict>
26+
</plist>

Macros/Special: return between empty <?php___?>.tmMacro

Lines changed: 0 additions & 36 deletions
This file was deleted.

Snippets/Special: Return Between PHP Tags.tmSnippet

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>content</key>
6+
<string>
7+
$0
8+
</string>
9+
<key>keyEquivalent</key>
10+
<string></string>
11+
<key>name</key>
12+
<string>Special: Return Between PHP Tags</string>
13+
<key>scope</key>
14+
<string>meta.consecutive-tags.php</string>
15+
<key>uuid</key>
16+
<string>89385241-0117-42AE-BDAE-0471554CC3DF</string>
17+
</dict>
18+
</plist>

Syntaxes/PHP.plist

Lines changed: 149 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,172 @@
1616
<string>PHP</string>
1717
<key>patterns</key>
1818
<array>
19+
<dict>
20+
<key>captures</key>
21+
<dict>
22+
<key>1</key>
23+
<dict>
24+
<key>name</key>
25+
<string>punctuation.whitespace.embedded.leading.php</string>
26+
</dict>
27+
<key>2</key>
28+
<dict>
29+
<key>name</key>
30+
<string>source.php.embedded.line.empty.html</string>
31+
</dict>
32+
<key>3</key>
33+
<dict>
34+
<key>name</key>
35+
<string>punctuation.definition.embedded.begin.php</string>
36+
</dict>
37+
<key>4</key>
38+
<dict>
39+
<key>name</key>
40+
<string>meta.consecutive-tags.php</string>
41+
</dict>
42+
<key>5</key>
43+
<dict>
44+
<key>name</key>
45+
<string>source.php</string>
46+
</dict>
47+
<key>6</key>
48+
<dict>
49+
<key>name</key>
50+
<string>punctuation.definition.embedded.end.php</string>
51+
</dict>
52+
<key>7</key>
53+
<dict>
54+
<key>name</key>
55+
<string>source.php</string>
56+
</dict>
57+
<key>8</key>
58+
<dict>
59+
<key>name</key>
60+
<string>punctuation.whitespace.embedded.trailing.php</string>
61+
</dict>
62+
</dict>
63+
<key>comment</key>
64+
<string>Matches empty tags.</string>
65+
<key>match</key>
66+
<string>(?x)
67+
(^\s*)? # 1 - Leading whitespace
68+
( # 2 - meta.embedded.line.empty.php
69+
( # 3 - Open Tag
70+
(?:
71+
((?&lt;=\?&gt;)&lt;) # 4 - Consecutive tags
72+
| &lt;
73+
)
74+
\?(?i:php|=)?
75+
)
76+
(\s*) # 5 - Loneliness
77+
((\?)&gt;) # 6 - Close Tag
78+
# 7 - Scope ? as scope.php
79+
)
80+
(
81+
\1 # Match nothing if there was no
82+
# leading whitespace...
83+
| (\s*$\n)? # or match trailing whitespace.
84+
)
85+
</string>
86+
</dict>
87+
<dict>
88+
<key>begin</key>
89+
<string>^\s*(?=&lt;\?)</string>
90+
<key>beginCaptures</key>
91+
<dict>
92+
<key>0</key>
93+
<dict>
94+
<key>name</key>
95+
<string>punctuation.whitespace.embedded.leading.php</string>
96+
</dict>
97+
</dict>
98+
<key>comment</key>
99+
<string>Catches tags with preceeding whitespace.</string>
100+
<key>end</key>
101+
<string>(?&lt;=\?&gt;)(\s*$\n)?</string>
102+
<key>endCaptures</key>
103+
<dict>
104+
<key>0</key>
105+
<dict>
106+
<key>name</key>
107+
<string>punctuation.whitespace.embedded.trailing.php</string>
108+
</dict>
109+
</dict>
110+
<key>patterns</key>
111+
<array>
112+
<dict>
113+
<key>begin</key>
114+
<string>&lt;\?(?i:php|=)?</string>
115+
<key>beginCaptures</key>
116+
<dict>
117+
<key>0</key>
118+
<dict>
119+
<key>name</key>
120+
<string>punctuation.definition.embedded.begin.php</string>
121+
</dict>
122+
</dict>
123+
<key>end</key>
124+
<string>(\?)&gt;</string>
125+
<key>endCaptures</key>
126+
<dict>
127+
<key>0</key>
128+
<dict>
129+
<key>name</key>
130+
<string>punctuation.definition.embedded.end.php</string>
131+
</dict>
132+
<key>1</key>
133+
<dict>
134+
<key>name</key>
135+
<string>source.php</string>
136+
</dict>
137+
</dict>
138+
<key>name</key>
139+
<string>source.php.embedded.block.html</string>
140+
<key>patterns</key>
141+
<array>
142+
<dict>
143+
<key>include</key>
144+
<string>#language</string>
145+
</dict>
146+
</array>
147+
</dict>
148+
</array>
149+
</dict>
19150
<dict>
20151
<key>begin</key>
21-
<string>&lt;\?(?i:php|=)?</string>
152+
<string>(((?&lt;=\?&gt;)&lt;)|&lt;)\?(?i:php|=)?</string>
22153
<key>beginCaptures</key>
23154
<dict>
24155
<key>0</key>
25156
<dict>
26157
<key>name</key>
27-
<string>punctuation.section.embedded.begin.php</string>
158+
<string>punctuation.definition.embedded.begin.php</string>
159+
</dict>
160+
<key>2</key>
161+
<dict>
162+
<key>name</key>
163+
<string>meta.consecutive-tags.php</string>
28164
</dict>
29165
</dict>
166+
<key>comment</key>
167+
<string>Catches the remainder.</string>
30168
<key>end</key>
31-
<string>\?&gt;</string>
169+
<string>(\?)&gt;</string>
32170
<key>endCaptures</key>
33171
<dict>
34172
<key>0</key>
35173
<dict>
36174
<key>name</key>
37-
<string>punctuation.section.embedded.end.php</string>
175+
<string>punctuation.definition.embedded.end.php</string>
176+
</dict>
177+
<key>1</key>
178+
<dict>
179+
<key>name</key>
180+
<string>source.php</string>
38181
</dict>
39182
</dict>
183+
<key>name</key>
184+
<string>source.php.embedded.line.html</string>
40185
<key>patterns</key>
41186
<array>
42187
<dict>

info.plist

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
<array>
1111
<string>6FABC1A4-8CD0-11D9-B507-000D93C8BE28</string>
1212
<string>D723521E-CC93-419A-8056-D5178F28615B</string>
13-
<string>9E187BE5-3E25-49A1-9FA1-D7EF18DF027D</string>
13+
<string>9E187BE5-3E25-49A1-9FA1-D7EF18DF027D</string>
14+
<string>ADE95F8E-EC59-482C-AAD6-0212D5D7AB61</string>
1415
</array>
1516
<key>description</key>
1617
<string>&lt;a href="http://www.php.net/"&gt;PHP&lt;/a&gt; is a widely-used general-purpose scripting language that is especially suited for web development and can be embedded into HTML.</string>
@@ -20,9 +21,8 @@
2021
<array>
2122
<string>26BC937A-5A0B-493E-B51F-1AF6E6FEFAD4</string>
2223
<string>6F7E7868-F5A2-4B7D-ACFB-2A8DE2CD04E2</string>
23-
<string>ADE95F8E-EC59-482C-AAD6-0212D5D7AB61</string>
24-
<string>C77638F5-A539-4D72-AB94-E1355A7835D4</string>
25-
<string>5DC3AA9D-32F7-4ECF-A8CB-303AF9E3ABDF</string>
24+
<string>89385241-0117-42AE-BDAE-0471554CC3DF</string>
25+
<string>647C793F-9098-481B-8B5A-BCEF3B48CB03</string>
2626
</array>
2727
<key>items</key>
2828
<array>
@@ -55,6 +55,7 @@
5555
<string>------------------------------------</string>
5656
<string>6F3ABAC6-EEC9-4797-8D4A-6FD549094852</string>
5757
<string>9C891C7B-CFA8-4860-B76F-4E3AD60B0E13</string>
58+
<string>C1B97DFD-7F2E-4CF8-881D-F63843DE8BD5</string>
5859
</array>
5960
<key>submenus</key>
6061
<dict>
@@ -236,9 +237,10 @@
236237
<string>CA15DF69-E80D-46DA-BD45-E88C68E92117</string>
237238
<string>F15B444C-13E3-4A3C-83E1-4A6E0C1A84F3</string>
238239
<string>5157F71C-2801-4385-92EA-3D0B72AEE7C5</string>
239-
<string>C77638F5-A539-4D72-AB94-E1355A7835D4</string>
240-
<string>5DC3AA9D-32F7-4ECF-A8CB-303AF9E3ABDF</string>
241-
<string>ADE95F8E-EC59-482C-AAD6-0212D5D7AB61</string>
240+
<string>C1B97DFD-7F2E-4CF8-881D-F63843DE8BD5</string>
241+
<string>77F2D17D-A48A-4E19-B2A4-B2FBCBD1264D</string>
242+
<string>89385241-0117-42AE-BDAE-0471554CC3DF</string>
243+
<string>647C793F-9098-481B-8B5A-BCEF3B48CB03</string>
242244
</array>
243245
<key>uuid</key>
244246
<string>467A1966-6227-11D9-BFB1-000D93589AF6</string>

0 commit comments

Comments
 (0)