diff --git a/src/Raku/Actions.nqp b/src/Raku/Actions.nqp index e705614338b..81097892ae9 100644 --- a/src/Raku/Actions.nqp +++ b/src/Raku/Actions.nqp @@ -2787,6 +2787,24 @@ class Raku::Actions is HLL::Actions does Raku::CommonActions { $*CU.replace-finish-content(~$); } + method doc-block:sym($/) { + if $*FROM-SEEN{$/.from}++ { + return; + } + + my $config := extract-config($/); + + my @paragraphs; + if $ -> $lines { + if ~$lines -> $text { + nqp::push(@paragraphs,$text); + } + } + + $*SEEN{$/.from} := RakuAST::Doc::Block.from-paragraphs: + :type, :$config, :@paragraphs; + } + method doc-block:sym($/) { if $*FROM-SEEN{$/.from}++ { return; diff --git a/src/Raku/Grammar.nqp b/src/Raku/Grammar.nqp index 174731160bd..186ade177e8 100644 --- a/src/Raku/Grammar.nqp +++ b/src/Raku/Grammar.nqp @@ -3569,6 +3569,7 @@ if $*COMPILING_CORE_SETTING { proto token doc-block {*} + # handle =finish and friends token doc-block:sym { ^^ \h* [ @@ -3579,6 +3580,23 @@ if $*COMPILING_CORE_SETTING { $ = .* } + # handle =begin comment + token doc-block:sym { + + # save any leading whitespace from start of line + ^^ $=[ \h* ] + + # start of 'begin comment' block + '=begin' \h+ 'comment' )>* + + + # fetch all non-empty lines, *NOT* looking at =pod markers + $=[^^ \h* \N+ \n?]*? + + # until the matching end block + ^^ $ '=end' \h+ 'comment' [ | $] + } + + # handle all the other =begin token doc-block:sym { # save any leading whitespace from start of line @@ -3605,7 +3623,7 @@ if $*COMPILING_CORE_SETTING { # should now be at end of line <.doc-newline>+ - # get any content + # get any doc blocks * # until the end marker