From d75a8544767dfc0dc8d5050af477e35e1f7c20b9 Mon Sep 17 00:00:00 2001 From: Marshall Roch Date: Sun, 3 Oct 2010 17:08:47 -0700 Subject: [PATCH] Support comments in function arguments that only have one argument --- Syntaxes/PHP.plist | 6 +++--- Tests/uncommon-comments.php | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Syntaxes/PHP.plist b/Syntaxes/PHP.plist index 3e65a87..0bd62e9 100644 --- a/Syntaxes/PHP.plist +++ b/Syntaxes/PHP.plist @@ -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 name meta.function.argument.array.php @@ -522,7 +522,7 @@ match - (\s*&)?\s*((\$+)[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*)\s*(?=,|\)) + (\s*&)?\s*((\$+)[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*)\s*(?=,|\)|/[/*]|\#) name meta.function.argument.no-default.php @@ -553,7 +553,7 @@ end - (?=,|\)) + (?=,|\)|/[/*]|\#) name meta.function.argument.default.php patterns diff --git a/Tests/uncommon-comments.php b/Tests/uncommon-comments.php index 32806da..b4bf940 100644 --- a/Tests/uncommon-comments.php +++ b/Tests/uncommon-comments.php @@ -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