diff --git a/src/NQP/Grammar.pm b/src/NQP/Grammar.pm index 92def32..aa394f7 100644 --- a/src/NQP/Grammar.pm +++ b/src/NQP/Grammar.pm @@ -63,10 +63,14 @@ token pod_comment { || .*? \n \h* '=' 'end' » \N* || <.panic: '=begin without matching =end'> ] + | + .*? ^^ ]? + | \n ]> | - [ - <.panic: 'Obsolete pod format, please use =begin/=end instead'> ]? - [ || \s || <.panic: 'Illegal pod directive'> ] + [ \s || <.panic: 'Illegal pod directive'> ] \N* ] } diff --git a/t/nqp/05-comments.t b/t/nqp/05-comments.t index 1b9fdc1..a26b29b 100644 --- a/t/nqp/05-comments.t +++ b/t/nqp/05-comments.t @@ -2,7 +2,7 @@ # check comments -say('1..4'); +say('1..7'); #Comment preceding say("ok 1"); @@ -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");