Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Accept empty code block + unshift recursive stucture
Prior, "=begin code\n=end code" would die. As well, it's more effecient
to start with the already made ast and unshift new elements constructing
the tail-recursive delimited_code_content
  • Loading branch information
Mouq committed Feb 19, 2014
1 parent f3b5470 commit efce067
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Perl6/Actions.nqp
Expand Up @@ -580,15 +580,18 @@ class Perl6::Actions is HLL::Actions does STDActions {
}

method delimited_code_content($/) {
my @t := [];
@t := $<delimited_code_content>.ast
if $<delimited_code_content><pod_string>;
if $<pod_string> {
my @t := Perl6::Pod::merge_twines($<pod_string>);
@t.push($<delimited_code_content>.ast)
if $<delimited_code_content><pod_string>;
make @t;
for Perl6::Pod::merge_twines($<pod_string>) {
@t.unshift($_);
}
} elsif $<delimited_code_content> {
# Empty line
make $*W.add_constant('Str', 'str', '').compile_time_value;
@t.unshift($*W.add_constant('Str', 'str', '').compile_time_value);
}
make @t;
}

method pod_block:sym<paragraph>($/) {
Expand Down

0 comments on commit efce067

Please sign in to comment.