(minor) macro buglets

- allow parameter-less macros
  - allow macro body to start on next line
redis
Sitaram Chamarty 2012-12-13 20:15:17 +05:30
parent 3103d68a75
commit 8e3ee2f9c1
1 changed files with 2 additions and 2 deletions

View File

@ -12,11 +12,11 @@ sub sugar_script {
my @out = (); my @out = ();
my $l = join("\n", @$lines); my $l = join("\n", @$lines);
while ($l =~ s/^macro (\w+) (.*?)\nend//ms) { while ($l =~ s/^macro (\w+)\b(.*?)\nend//ms) {
$macro{$1} = $2; $macro{$1} = $2;
} }
$l =~ s/^((\w+) .*)/$macro{$2} ? expand($1) : $1/gem; $l =~ s/^((\w+)\b.*)/$macro{$2} ? expand($1) : $1/gem;
$lines = [split "\n", $l]; $lines = [split "\n", $l];
return $lines; return $lines;