Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Support comments in function arguments that only have one argument
  • Loading branch information
Marshall Roch committed Oct 4, 2010
commit d75a8544767dfc0dc8d5050af477e35e1f7c20b9
6 changes: 3 additions & 3 deletions Syntaxes/PHP.plist
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@
(?:
\s*(?:(=)\s*(?:(null)|((?:\S*?\(\))|(?:\S*?)))) # A default value
)?
\s*(?=,|\)|$) # A closing parentheses (end of argument list) or a comma
\s*(?=,|\)|/[/*]|\#|$) # A closing parentheses (end of argument list) or a comma or a comment
</string>
<key>name</key>
<string>meta.function.argument.array.php</string>
Expand Down Expand Up @@ -522,7 +522,7 @@
</dict>
</dict>
<key>match</key>
<string>(\s*&amp;)?\s*((\$+)[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*)\s*(?=,|\))</string>
<string>(\s*&amp;)?\s*((\$+)[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*)\s*(?=,|\)|/[/*]|\#)</string>
<key>name</key>
<string>meta.function.argument.no-default.php</string>
</dict>
Expand Down Expand Up @@ -553,7 +553,7 @@
</dict>
</dict>
<key>end</key>
<string>(?=,|\))</string>
<string>(?=,|\)|/[/*]|\#)</string>
<key>name</key>
<string>meta.function.argument.default.php</string>
<key>patterns</key>
Expand Down
18 changes: 17 additions & 1 deletion Tests/uncommon-comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,27 @@ function foo()
}
}

function foo(/* blah */ $bar, /* one */ array $foo, /* blah */ stdClass $another)
function foo(/* blah */ $bar, /* one */ array $foo, /* blah */ stdClass $another/*, ... */)
{
// blah
}

function foo($bar/*, ... */) {
// blah
}

function foo(
$bar // blah
) {
// blah
}

function foo(
$bar # blah
) {
// blah
}

function foo(
$foo, // blah
$x = 2, // for other stuff
Expand Down