Skip to content

Commit

Permalink
Apk: support comments at the end of a line
Browse files Browse the repository at this point in the history
  • Loading branch information
mlschroe committed Dec 6, 2024
1 parent 6a0a615 commit b61443e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Build/Apk.pm
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ sub expandvars {
sub quote {
my ($str, $q, $vars) = @_;
$str = expandvars($str, $vars) if $q ne "'" && $str =~ /\$/;
$str =~ s/([ \t\"\'\$])/sprintf("%%%02X", ord($1))/ge;
$str =~ s/([ \t\"\'\$#])/sprintf("%%%02X", ord($1))/ge;
$str = "%00" if $str eq ''; # so that split sees something
return $str;
}
Expand All @@ -149,7 +149,9 @@ sub unquotesplit {
my ($str, $vars, $unbalanced) = @_;
$str =~ s/%/%25/g;
$str =~ s/^[ \t]+//;
while ($str =~ /([\"\'])/) {
my $re = $unbalanced ? qr{([\"\'\#])} : qr{([\"\'])};
while ($str =~ /$re/) {
last if $1 eq '#';
my $q = $1;
if ($str !~ s/$q(.*?)$q/quote($1, $q, $vars)/se) {
return (undef) if $unbalanced;
Expand Down

0 comments on commit b61443e

Please sign in to comment.