Outaspace has asked for the wisdom of the Perl Monks concerning the following question:
# Tokens word : /[a-zA-Z_:][a-zA-Z0-9_:]*/ quotelike : <perl_quotelike> | ( 'qw' '(' word(s?) ')' ) # Start of Perl-File startrule : { $thisparser->StartParsing(); } block_construct(s) { $thisparser->EndParsing($text); } block_construct : sub_definition | pod | package_declaration | end | /[^;\n]*[;\n]/ end : /(__END__)|(__DATA__)/ { $thisparser->EndReached(); } pod : /=((head[1-9])|(over)|(item[1-9])|(back)|(pod))(.|\s)*?(=cut|$)/ + { $thisparser->AddPOD($thisline, @item); } package_declaration : 'package' /[a-zA-Z_:][a-zA-Z0-9_:]*/ ';' { $this +parser->StartNewPackage($thisline, @item); } sub_definition : 'sub' /[a-zA-Z_:][a-zA-Z0-9_:]*(\s*\([$@%\\*]*\))? +/ <perl_codeblock> { $thisparser->AddSub($thisline, @item); }
|
|---|