Please sign in to comment.
RT #72151: 5.14 re pragma and
PCP::RegularExpressions::RequireDotMatchAnything, ::RequireExtendedFormatting, ::RequireLineBoundaryMatching THIS COMMIT REQUIRES PPix::Regexp 0.022 The requester asked that Perl::Critic honor the Perl 5.14 'use re /modifiers' pragma. The implementation is divided between Perl::Critic (which figures out which default modifiers are in-scope) and PPIx::Regexp (which figures out what modifiers are actually in effect based on the modifiers actually asserted, and the in-scope default modifiers if any). The Perl::Critic portion involved: * Adding method element_is_in_lexical_scope_after_statement_containing() to Perl::Critic::Document. There is no current reason for this code to be here rather than in one of the utility packages, but this way caching of scope objects can be done without changing the interface. * Modified Perl::Critic::Document method ppix_regexp_from_element() to make use of the above to find all the default modifier pragmas in-scope and pass them to PPIx::Regexp->new(). The PPIx::Regexp objects are already cached, the overhead of finding the pragmas should only be incurred once for a given regexp. * Converting the relevant policies to use the new PPIx::Regexp modifier_asserted() method (which takes the defaults into account) rather than using the PPIx::Regexp modifiers() method (to return the object representing the modifiers present on the regexp) or the PPI::Token::Regexp get_modifiers method (ditto). This included: - ControlStructures::ProhibitMutatingListFunctions - RegularExpressions::RequireExtendedFormatting * - RegularExpressions::ProhibitUnusedCapture - RegularExpressions::ProhinitFixedStringMatches - RegularExpressions::RequireDotMatchAnything * = RegularExpressions::RequireLineBoundaryMatching * The starred policies had their t/*.run files updated as well. * Boosting the version of PPIx::Regexp required to 0.022. The so-called 'extra credit' portion of the ticket (handling Regexp::DefaultFlags as well) is not in this commit. Or anywhere else at the moment. git-svn-id: http://perlcritic.tigris.org/svn/perlcritic/trunk/distributions/Perl-Critic@4095 7ac2fd03-a204-0410-b7b1-b9f6acf132f9
- Loading branch information...
Showing with 258 additions and 28 deletions.
- +4 −0 Changes
- +1 −1 inc/Perl/Critic/BuildUtilities.pm
- +95 −1 lib/Perl/Critic/Document.pm
- +13 −6 lib/Perl/Critic/Policy/ControlStructures/ProhibitMutatingListFunctions.pm
- +4 −3 lib/Perl/Critic/Policy/RegularExpressions/ProhibitFixedStringMatches.pm
- +1 −2 lib/Perl/Critic/Policy/RegularExpressions/ProhibitUnusedCapture.pm
- +6 −5 lib/Perl/Critic/Policy/RegularExpressions/RequireDotMatchAnything.pm
- +5 −5 lib/Perl/Critic/Policy/RegularExpressions/RequireExtendedFormatting.pm
- +6 −5 lib/Perl/Critic/Policy/RegularExpressions/RequireLineBoundaryMatching.pm
- +41 −0 t/RegularExpressions/RequireDotMatchAnything.run
- +41 −0 t/RegularExpressions/RequireExtendedFormatting.run
- +41 −0 t/RegularExpressions/RequireLineBoundaryMatching.run
Oops, something went wrong.