added support for here-docs and ''' in parameters.

master
Timo Paulssen 2011-04-30 21:58:43 +02:00 committed by Joey Hess
parent 8028d97942
commit 1c58634068
1 changed files with 20 additions and 2 deletions

View File

@ -1392,10 +1392,14 @@ sub preprocess ($$$;$$) {
| |
"([^"]*?)" # 3: single-quoted value "([^"]*?)" # 3: single-quoted value
| |
(\S+) # 4: unquoted value '''(.*?)''' # 4: triple-single-quote
|
<<(?<start>[a-zA-Z]+)\n(?<heredoc>.*?)\n\k<start> # 5, 6: heredoc'd value.
|
(\S+) # 7: unquoted value
) )
(?:\s+|$) # delimiter to next param (?:\s+|$) # delimiter to next param
}sgx) { }msgx) {
my $key=$1; my $key=$1;
my $val; my $val;
if (defined $2) { if (defined $2) {
@ -1410,6 +1414,12 @@ sub preprocess ($$$;$$) {
elsif (defined $4) { elsif (defined $4) {
$val=$4; $val=$4;
} }
elsif (defined $7) {
$val=$7;
}
elsif (defined $+{heredoc}) {
$val=$+{heredoc};
}
if (defined $key) { if (defined $key) {
push @params, $key, $val; push @params, $key, $val;
@ -1478,6 +1488,10 @@ sub preprocess ($$$;$$) {
| |
"[^"]*?" # single-quoted value "[^"]*?" # single-quoted value
| |
<<(?<start>[a-zA-Z]+)\n(?<heredoc>.*?)\n\k<start> # heredoc'd value.
|
'''.*?''' # triple-single-quoted value
|
[^"\s\]]+ # unquoted value [^"\s\]]+ # unquoted value
) )
\s* # whitespace or end \s* # whitespace or end
@ -1501,6 +1515,10 @@ sub preprocess ($$$;$$) {
| |
"[^"]*?" # single-quoted value "[^"]*?" # single-quoted value
| |
'''.*?''' # triple-single-quoted value
|
<<(?<start>[a-zA-Z]+)\n(?<heredoc>.*?)\n\k<start> # heredoc'd value.
|
[^"\s\]]+ # unquoted value [^"\s\]]+ # unquoted value
) )
\s* # whitespace or end \s* # whitespace or end