Permalink
Browse files

Add support for `array`, `binary` and `unset` typecasts (fixes #11)

  • Loading branch information...
1 parent ef4e376 commit 5a994352f0cda0249ac05af51a0443edabb1fe78 @joshvarner joshvarner committed Nov 28, 2010
Showing with 47 additions and 22 deletions.
  1. +34 −22 Syntaxes/PHP.plist
  2. +13 −0 Tests/test-cases.php
View
56 Syntaxes/PHP.plist
@@ -1688,28 +1688,6 @@
<string>#strings</string>
</dict>
<dict>
- <key>match</key>
- <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>
- <dict>
- <key>match</key>
- <string>(?i)\b(global|abstract|const|extends|implements|final|p(r(ivate|otected)|ublic)|static)\b</string>
- <key>name</key>
- <string>storage.modifier.php</string>
- </dict>
- <dict>
- <key>include</key>
- <string>#object</string>
- </dict>
- <dict>
- <key>match</key>
- <string>;</string>
- <key>name</key>
- <string>punctuation.terminator.expression.php</string>
- </dict>
- <dict>
<key>captures</key>
<dict>
<key>1</key>
@@ -1770,6 +1748,40 @@
</array>
</dict>
<dict>
+ <key>captures</key>
+ <dict>
+ <key>1</key>
+ <dict>
+ <key>name</key>
+ <string>storage.type.php</string>
+ </dict>
+ </dict>
+ <key>match</key>
+ <string>(?i)\s*\(\s*(array|real|double|float|int(eger)?|bool(ean)?|string|object|binary|unset)\s*\)</string>
+ </dict>
+ <dict>
+ <key>match</key>
+ <string>(?i)\b(array|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>
+ <dict>
+ <key>match</key>
+ <string>(?i)\b(global|abstract|const|extends|implements|final|p(r(ivate|otected)|ublic)|static)\b</string>
+ <key>name</key>
+ <string>storage.modifier.php</string>
+ </dict>
+ <dict>
+ <key>include</key>
+ <string>#object</string>
+ </dict>
+ <dict>
+ <key>match</key>
+ <string>;</string>
+ <key>name</key>
+ <string>punctuation.terminator.expression.php</string>
+ </dict>
+ <dict>
<key>include</key>
<string>#heredoc</string>
</dict>
View
13 Tests/test-cases.php
@@ -687,4 +687,17 @@ function foo(
if (true and false) {}
if (true or (true and false)) {}
+$blah = (binary) $foo;
+$blah = (int) $foo;
+$blah = (integer) $foo;
+$blah = (bool) $foo;
+$blah = (boolean) $foo;
+$blah = (float) $foo;
+$blah = (double) $foo;
+$blah = (real) $foo;
+$blah = (string) $foo;
+$blah = (array) $foo;
+$blah = (object) $foo;
+$blah = (unset) $foo;
+
?>

0 comments on commit 5a99435

Please sign in to comment.