Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the PPI CPAN distribution.

Report information
The Basics
Id: 67831
Status: resolved
Priority: 0/
Queue: PPI

People
Owner: Nobody in particular
Requestors: bdfoy [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.215
Fixed in: (no value)

Attachments
0001-Add-a-lexer-hint-to-Package.patch
0002-Check-for-5.12-package-statements-with-blocks.patch



Subject: Handle Perl 5.12 package statements with blocks
Download (untitled) / with headers
text/plain 375b
Perl 5.12 adds another form of package: package NAME VERSION BLOCK This means that the package statement isn't necessarily finished by a statement separator. The lexer needs to know that a package statement ended with a block. These patches fix ::Package to tell the lexer that it's no longer normal, and fixes the lexer to recognize the package ending with a block.
Subject: 0002-Check-for-5.12-package-statements-with-blocks.patch
From 70381c816ed793ef164c56a1251f4d318d85f063 Mon Sep 17 00:00:00 2001 From: brian d foy <brian.d.foy@gmail.com> Date: Fri, 29 Apr 2011 07:36:42 -0500 Subject: [PATCH 2/2] Check for 5.12 package statements with blocks These blocks might implicitly end the package statement (that is, without a statement separator). It's not really a compound like if() or while(), so I make its own special case. --- lib/PPI/Lexer.pm | 27 +++++++++++++++++++++++---- 1 files changed, 23 insertions(+), 4 deletions(-) diff --git a/lib/PPI/Lexer.pm b/lib/PPI/Lexer.pm index 553dcd2..cc7eb0e 100644 --- a/lib/PPI/Lexer.pm +++ b/lib/PPI/Lexer.pm @@ -710,10 +710,29 @@ sub _continues { return ''; } - # Alrighty then, there are only five implied end statement types, - # ::Scheduled blocks, ::Sub declarations, ::Compound, ::Given, and ::When - # statements. - unless ( ref($Statement) =~ /\b(?:Scheduled|Sub|Compound|Given|When)$/ ) { + # Alrighty then, there are only six implied end statement types, + # ::Scheduled blocks, ::Sub declarations, ::Compound, ::Package, + # ::Given, and ::When statements. + unless ( ref($Statement) =~ /\b(?:Scheduled|Sub|Compound|Given|When|Package)$/ ) { + return 1; + } + + # Package is a bit weird because it can terminate in two ways. + # The Perl 5.12 syntax allows it to end with a block, and that's + # the only case we need to handle here. The other case is handled + # elsewhere automatically. + if ( $Statement->isa('PPI::Statement::Package') ) { + # This should be one of the following + # package Foo; + # package Foo VERSION; + # package Foo BLOCK + # package Foo VERSION BLOCK + my @schildren = $Statement->schildren; + + if ( $schildren[-1]->isa('PPI::Structure::Block') ) { + return 0; + } + return 1; } -- 1.6.5.4
Subject: 0001-Add-a-lexer-hint-to-Package.patch
From 88fe798fcbb7aaf5954ac619245da63caf521147 Mon Sep 17 00:00:00 2001 From: brian d foy <brian.d.foy@gmail.com> Date: Fri, 29 Apr 2011 07:35:11 -0500 Subject: [PATCH 1/2] Add a lexer hint to ::Package The package statement now can end implicitly with a block, so we have to let the lexer guess if it's continuing or stopping. --- lib/PPI/Statement/Package.pm | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/lib/PPI/Statement/Package.pm b/lib/PPI/Statement/Package.pm index 8c48adf..7a992e3 100644 --- a/lib/PPI/Statement/Package.pm +++ b/lib/PPI/Statement/Package.pm @@ -73,6 +73,10 @@ BEGIN { @ISA = 'PPI::Statement'; } +# clues for the lexer. The Perl 5.12 syntax muddies the waters a bit because +# we can end with a statement terminator or a block. +sub __LEXER__normal { '' } + =pod =head2 namespace -- 1.6.5.4
This issue is not being tracked on GitHub as https://github.com/adamkennedy/PPI/pull/73
Download (untitled) / with headers
text/plain 322b
On Wed Nov 12 09:29:27 2014, MOREGAN wrote: Show quoted text
> This issue is not being tracked on GitHub as > https://github.com/adamkennedy/PPI/pull/73
It is **now** being tracked. I almost made a new issue because it was **not** being tracked. Thanks for modifying my stuff to fit into PPI. I'm closing this ticket as resolved (here).


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.