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

Commit

Permalink
[nqp]: Allow comments after statement-terminating close brace (TT #13…
Browse files Browse the repository at this point in the history
…07).
  • Loading branch information
pmichaud committed Nov 18, 2009
1 parent da7048b commit 8aa6c0f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/NQP/Grammar.pm
Expand Up @@ -23,7 +23,10 @@ token deflongname {
}

token ENDSTMT {
[ \h* $$ <.ws> <?MARKER('endstmt')> ]?
[
| \h* $$ <.ws> <?MARKER('endstmt')>
| <.unv>? $$ <.ws> <?MARKER('endstmt')>
]?
}

token ws {
Expand All @@ -36,6 +39,15 @@ token ws {
<?MARKER('ws')>
}

token unv {
# :dba('horizontal whitespace')
[
| ^^ <?before \h* '=' [ \w | '\\'] > <.pod_comment>
| \h* '#' \N*
| \h+
]
}

token pod_comment {
^^ \h* '='
[
Expand Down
3 changes: 3 additions & 0 deletions t/nqp/05-comments.t
Expand Up @@ -11,3 +11,6 @@ say("ok 2"); #Comment following

#say("not ok 3");
# say("not ok 4");

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

0 comments on commit 8aa6c0f

Please sign in to comment.