Skip to content

Commit

Permalink
Fix table POD
Browse files Browse the repository at this point in the history
  • Loading branch information
hoelzro committed Sep 4, 2014
1 parent 6869029 commit a3228b9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/Perl6/Actions.nqp
Expand Up @@ -756,6 +756,10 @@ class Perl6::Actions is HLL::Actions does STDActions {
make ~$/
}

method table_row_or_blank($/) {
make ~$/
}

method unitstart($/) {
# Use SET_BLOCK_OUTER_CTX (inherited from HLL::Actions)
# to set dynamic outer lexical context and namespace details
Expand Down
8 changes: 6 additions & 2 deletions src/Perl6/Grammar.nqp
Expand Up @@ -753,7 +753,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
:my $*POD_ALLOW_FCODES := nqp::getlexdyn('$*POD_ALLOW_FCODES');
<pod_configuration($<spaces>)> <pod_newline>+
[
<table_row>*
[ $<table_row>=<.table_row_or_blank> ]*
^^ \h* '=end' \h+ 'table' [ <pod_newline> | $ ]
|| {$/.CURSOR.typed_panic: 'X::Syntax::Pod::BeginWithoutEnd', type => 'table', spaces => ~$<spaces>}
]
Expand Down Expand Up @@ -787,7 +787,11 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
}

token table_row {
\h* <!before '=' \w> \N* \n
\h* <!before '=' \w> \N+ [ \n | $ ]
}

token table_row_or_blank {
<.table_row> | [\h* <!before '=' \w> \n ]
}

token pod_block:sym<finish> {
Expand Down
2 changes: 1 addition & 1 deletion src/Perl6/Pod.nqp
Expand Up @@ -244,7 +244,7 @@ class Perl6::Pod {

our sub process_rows(@rows) {
# remove trailing blank lines
@rows.pop while @rows[+@rows - 1] ~~ /^ \s* $/;
@rows.pop while @rows && @rows[+@rows - 1] ~~ /^ \s* $/;
# find the longest leading whitespace and strip it
# from every row, also remove trailing \n
my $w := -1; # the longest leading whitespace
Expand Down

0 comments on commit a3228b9

Please sign in to comment.