(minor) macro buglets

- allow parameter-less macros
  - allow macro body to start on next line
This commit is contained in:
Sitaram Chamarty 2012-12-13 20:15:17 +05:30
parent 3103d68a75
commit 8e3ee2f9c1

View file

@ -12,11 +12,11 @@ sub sugar_script {
my @out = ();
my $l = join("\n", @$lines);
while ($l =~ s/^macro (\w+) (.*?)\nend//ms) {
while ($l =~ s/^macro (\w+)\b(.*?)\nend//ms) {
$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];
return $lines;