Skip to content

Commit

Permalink
Get our comment parsing more STD-ish by introducing the comment proto…
Browse files Browse the repository at this point in the history
…regex, and add support for #`(...) to fix a regression from alpha.
  • Loading branch information
jnthn committed May 29, 2010
1 parent d42fd31 commit a4dc280
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/Perl6/Grammar.pm
Expand Up @@ -207,9 +207,9 @@ token vws {
token ws {
|| <?MARKED('ws')>
|| <!ww>
[ \s+
| '#' \N*
| ^^ <.pod_comment>
[
| \s+
| <.unv>
]*
<?MARKER('ws')>
}
Expand All @@ -218,11 +218,21 @@ token unv {
# :dba('horizontal whitespace')
[
| ^^ <?before \h* '=' [ \w | '\\'] > <.pod_comment>
| \h* '#' \N*
| \h* <comment>
| \h+
]
}

proto token comment { <...> }

token comment:sym<#> {
'#' {} \N*
}

token comment:sym<#`(...)> {
'#`' {}
[ <quote_EXPR> || <.panic: "Opening bracket is required for #` comment"> ]
}

token pod_comment {
^^ \h* '='
Expand Down

0 comments on commit a4dc280

Please sign in to comment.