Skip to content

Instantly share code, notes, and snippets.

@bakertim
Created March 13, 2014 20:07
Show Gist options
  • Save bakertim/9535894 to your computer and use it in GitHub Desktop.
Save bakertim/9535894 to your computer and use it in GitHub Desktop.
Sublime Text: PHP namespace highlighting patch
--- /Users/Shared/settings/sublime/Packages/PHP/PHP.tmLanguage
+++ /Users/DoubleBlue/Desktop/PHP.tmLanguage.original
@@ -265,7 +265,7 @@
</dict>
</dict>
<key>match</key>
- <string>(?i)\b(new)\s+(\\)*(?:(\$[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*)|(\w+))|(\w+)(?=::)</string>
+ <string>(?i)\b(new)\s+(?:(\$[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*)|(\w+))|(\w+)(?=::)</string>
</dict>
<key>interpolation</key>
<dict>
@@ -380,7 +380,6 @@
<key>name</key>
<string>variable.other.index.php</string>
</dict>
-
</dict>
<key>comment</key>
<string>Simple syntax: $foo, $foo[0], $foo[$bar], $foo-&gt;bar</string>
@@ -845,7 +844,7 @@
</dict>
<dict>
<key>begin</key>
- <string>(?i)^\s*(abstract|final)?\s*(class)\s+([\\]*[a-z0-9_]+[\\a-z0-9_\\]*[a-z0-9_]+)\s*</string>
+ <string>(?i)^\s*(abstract|final)?\s*(class)\s+([a-z0-9_]+)\s*</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
@@ -885,7 +884,7 @@
</dict>
</dict>
<key>match</key>
- <string>(?i:(extends))\s+([\\]*[a-z0-9_]*[\\a-z0-9_\\]*[a-zA-Z0-9_]+)\s*</string>
+ <string>(?i:(extends))\s+([a-zA-Z0-9_]+)\s*</string>
</dict>
<dict>
<key>begin</key>
@@ -1308,7 +1307,7 @@
</dict>
<dict>
<key>match</key>
- <string>(?i)\b(real|double|float|int(eger)?|bool(ean)?|string|class|clone|var|function|interface|parent|self|object|namespace)\b</string>
+ <string>(?i)\b(real|double|float|int(eger)?|bool(ean)?|string|class|clone|var|function|interface|parent|self|object)\b</string>
<key>name</key>
<string>storage.type.php</string>
</dict>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment