Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Implement paragraph and abbreviated Pod comments
With this, NQP implements all forms of pod comment defined in S26, except
for the multiline declaration comment (left out on purpose, it's useless
without a metamodel) and paragraph blocks which are terminated by the
start of a delimited block (a corner case that STD fails too).
  • Loading branch information
sorear committed Apr 2, 2010
1 parent becd0e9 commit 31b97cc
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/NQP/Grammar.pm
Expand Up @@ -63,10 +63,14 @@ token pod_comment {
|| .*? \n \h* '=' 'end' » \N*
|| <.panic: '=begin without matching =end'>
]
| <identifier>
.*? ^^ <?before \h* [
'='
[ 'cut' »
<.panic: 'Obsolete pod format, please use =begin/=end instead'> ]?
| \n ]>
|
[ <?before .*? ^^ '=cut' » >
<.panic: 'Obsolete pod format, please use =begin/=end instead'> ]?
[ <alpha> || \s || <.panic: 'Illegal pod directive'> ]
[ \s || <.panic: 'Illegal pod directive'> ]
\N*
]
}
Expand Down
34 changes: 33 additions & 1 deletion t/nqp/05-comments.t
Expand Up @@ -2,7 +2,7 @@

# check comments

say('1..4');
say('1..7');

#Comment preceding
say("ok 1");
Expand All @@ -14,3 +14,35 @@ say("ok 2"); #Comment following

{ say('ok 3'); } # comment
{ say('ok 4'); }

=for comment
say("not ok 5");
=for comment say("not ok 6");
=begin comment
say("not ok 7");
say("not ok 8");
=end comment

=comment say("not ok 9");
say("not ok 10");
=for comment blah
say("ok 5");

=begin comment
=end comment
say("ok 6");

# This doesn't quite work right... but it doesn't work in STD either
#=for comment
#=begin comment
#=end comment
#=say("ok 7");

=comment

say("ok 7");

0 comments on commit 31b97cc

Please sign in to comment.