Permalink
Browse files

(minor) macro buglets

  - allow parameter-less macros
  - allow macro body to start on next line
  • Loading branch information...
1 parent 3103d68 commit 8e3ee2f9c11bcce2bdc85fd31453f4b5ab6a022b @sitaramc committed Dec 13, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/syntactic-sugar/macros
View
4 src/syntactic-sugar/macros
@@ -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;

0 comments on commit 8e3ee2f

Please sign in to comment.