Skip to content

Commit

Permalink
Update pod_comment to handle =begin END, some pod errors (from STD.pm).
Browse files Browse the repository at this point in the history
Remove some trailing spaces.
  • Loading branch information
pmichaud committed Mar 4, 2009
1 parent c08b9bd commit 55fb203
Showing 1 changed file with 23 additions and 14 deletions.
37 changes: 23 additions & 14 deletions src/parser/grammar.pg
Expand Up @@ -117,13 +117,22 @@ token afterws {
token pod_comment {
^^ '=' <.unsp>?
[
| begin \h+ <identifier> .*? \n
'=' <.unsp>? 'end' \h+ $<identifier> >> \N* {*} #= tagged
| begin \h* \n .*? \n
'=' <.unsp>? 'end' >> \N* {*} #= anon
| \N* {*} #= misc
| 'begin' \h+ <identifier> ::
[
|| .*? \n '=' <.unsp>? 'end' \h+ $<identifier> >> \N* {*} #= tagged
|| .* {*} #= end
]
| 'begin' >> :: \h*
[ $$ || '#' || <.panic: "Unrecognized token after =begin"> ]
[ .*? \n '=' <.unsp>? 'end' >> \N* || <.panic: "=begin without =end"> ]
{*} #= anon
| ::
[
<?before .*? ^^ '=cut' \s >
<.panic: "Obsolete pod format, please use =begin/=end instead">
]?
\N* {*} #= misc
]
{*}
}


Expand Down Expand Up @@ -180,10 +189,10 @@ rule statementlist {
## isn't present -- e.g., a closing '}' at the end of a line
## for a <block>.

token terminator {
| <[ ; ) \] } ]>
| '!!'
| '-->'
token terminator {
| <[ ; ) \] } ]>
| '!!'
| '-->'
| [ if | unless | while | until | for | given | when ] >> <.nofun>
}

Expand All @@ -208,15 +217,15 @@ token MARK_STATEMENT_END {
}

token AT_STATEMENT_END {
<?{{
<?{{
$P0 = get_global '$!endstmt'
$P1 = get_global '$!ws'
$P2 = $P1.'from'()
$I0 = iseq $P0, $P2
.return ($I0)
}}>
}



## Parse a single statement, which may be either a bare block
Expand Down Expand Up @@ -778,9 +787,9 @@ token morename {
'::'
[
<?before '(' | <alpha> >
[
[
| <identifier>
| '(' <EXPR> ')'
| '(' <EXPR> ')'
]
]?
}
Expand Down

0 comments on commit 55fb203

Please sign in to comment.