From a3228b9e15d5aacc14effbc6c4fb278067d6d444 Mon Sep 17 00:00:00 2001 From: Rob Hoelz Date: Wed, 3 Sep 2014 22:32:53 -0500 Subject: [PATCH] Fix table POD --- src/Perl6/Actions.nqp | 4 ++++ src/Perl6/Grammar.nqp | 8 ++++++-- src/Perl6/Pod.nqp | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Perl6/Actions.nqp b/src/Perl6/Actions.nqp index 0563f90bcce..d4bef0d168c 100644 --- a/src/Perl6/Actions.nqp +++ b/src/Perl6/Actions.nqp @@ -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 diff --git a/src/Perl6/Grammar.nqp b/src/Perl6/Grammar.nqp index 1d530677d8c..dfb574d56fb 100644 --- a/src/Perl6/Grammar.nqp +++ b/src/Perl6/Grammar.nqp @@ -753,7 +753,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD { :my $*POD_ALLOW_FCODES := nqp::getlexdyn('$*POD_ALLOW_FCODES'); )> + [ - * + [ $=<.table_row_or_blank> ]* ^^ \h* '=end' \h+ 'table' [ | $ ] || {$/.CURSOR.typed_panic: 'X::Syntax::Pod::BeginWithoutEnd', type => 'table', spaces => ~$} ] @@ -787,7 +787,11 @@ grammar Perl6::Grammar is HLL::Grammar does STD { } token table_row { - \h* \N* \n + \h* \N+ [ \n | $ ] + } + + token table_row_or_blank { + <.table_row> | [\h* \n ] } token pod_block:sym { diff --git a/src/Perl6/Pod.nqp b/src/Perl6/Pod.nqp index 8bf2129a0ef..97a8426c72a 100644 --- a/src/Perl6/Pod.nqp +++ b/src/Perl6/Pod.nqp @@ -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