Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add code for "=for code" too
  • Loading branch information
Mouq committed Feb 19, 2014
1 parent 91334ce commit a9cf04d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/Perl6/Actions.nqp
Expand Up @@ -603,6 +603,16 @@ class Perl6::Actions is HLL::Actions does STDActions {
make Perl6::Pod::table($/);
}

method pod_block:sym<paragraph_code>($/) {
my $config := $<pod_configuration>.ast;
my @t := Perl6::Pod::merge_twines($<pod_string>);
my $twine := Perl6::Pod::serialize_array(@t).compile_time_value;
make Perl6::Pod::serialize_object(
'Pod::Block::Code', :content($twine),
:config($config),
).compile_time_value
}

method pod_block:sym<abbreviated>($/) {
make Perl6::Pod::any_block($/);
}
Expand Down
13 changes: 11 additions & 2 deletions src/Perl6/Grammar.nqp
Expand Up @@ -739,10 +739,10 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
<pod_content=.pod_textcontent>**0..1
}

token pod_block:sym<paragraph_raw> {
token pod_block:sym<paragraph_comment> {
^^
$<spaces> = [ \h* ]
'=for' \h+ $<type>=[ 'code' | 'comment' ] {}
'=for' \h+ 'comment' {}
:my $*POD_ALLOW_FCODES := nqp::getlexdyn('$*POD_ALLOW_FCODES');
<pod_configuration($<spaces>)> <pod_newline>
$<pod_content> = [ \h* <!before '=' \w> \N+ \n ]+
Expand All @@ -757,6 +757,15 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
[ <!before \h* \n> <table_row>]*
}

token pod_block:sym<paragraph_code> {
^^
$<spaces> = [ \h* ]
'=for' \h+ 'code' {}
:my $*POD_ALLOW_FCODES := 0;
<pod_configuration($<spaces>)> <pod_newline>
[ <!before \h* '=' \w> <pod_string> <pod_newline> ]+
}

token pod_block:sym<abbreviated> {
^^
$<spaces> = [ \h* ]
Expand Down

0 comments on commit a9cf04d

Please sign in to comment.