allow single quote delimiters for macro parameters

This commit is contained in:
Graham Knop 2009-02-23 04:25:17 +00:00
parent af5ad84fc8
commit 65a0c7bbae
2 changed files with 38 additions and 9 deletions

View file

@ -161,26 +161,38 @@ sub _processMacro {
$parameters =~ s/^\(//;
$parameters =~ s/\)$//;
# there are two possible matches and only one will ever match at a time, so we filter out the undef ones
my @params = grep { defined $_ } ($parameters =~ /
my @params;
while ($parameters =~ /
(?<!\z) # don't try to match if we are at the end of the string
(?: # either
\s* " # white space followed by quotes
\s* " # white space followed by a double quote
( (?: # capture inside
[^"\\] # something other than a quote or backslash
[^"\\] # something other than backslash or double quote
| # or
\\. # a backslash followed by any character
) * ) # as many times as needed
" \s* # end quote and any white space
" \s* # end quote and any white space
| # or
([^,]*) # anything but a comma
\s* ' # same as above, but with single quotes
( (?:
[^'\\]
|
\\.
) * )
' \s*
| # or
([^,]*) # anything but a comma
)
(?: # followed by
\z # end of the string
| # or
, # a comma
)
/xg);
/xg) {
# three matches, only one will exist per run
push @params, defined $1 ? $1 : defined $2 ? $2 : $3;
}
for my $param (@params) {
$param =~ s/\\(.)/$1/xmsg; # deal with backslash escapes
process($session, \$param)