Represent a regular expression of some sort
The purpose of the _PPIx-Regexp_ package is to parse regular expressions in
a manner similar to the way the PPI package parses Perl. This class forms
the root of the parse tree, playing a role similar to PPI::Document.
This package shares with PPI the property of being round-trip safe. That
is,
my $expr = 's/ ( \d+ ) ( \D+ ) /$2$1/smxg';
my $re = PPIx::Regexp->new( $expr );
print $re->content() eq $expr ? "yes\n" : "no\n"
should print 'yes' for any valid regular expression.
Navigation is similar to that provided by PPI. That is to say, things like
'children', 'find_first', 'snext_sibling' and so on all work pretty much
the same way as in PPI.
The class hierarchy is also similar to PPI. Except for some utility classes
(the dumper, the lexer, and the tokenizer) all classes are descended from
PPIx::Regexp::Element, which provides basic navigation. Tokens are
descended from PPIx::Regexp::Token, which provides content. All containers
are descended from PPIx::Regexp::Node, which provides for children, and all
structure elements are descended from PPIx::Regexp::Structure, which
provides beginning and ending delimiters, and a type.
There are two features of PPI that this package does not provide -
mutability and operator overloading. There are no plans for serious
mutability, though something like PPI's 'prune' functionality might be
considered. Similarly there are no plans for operator overloading, which
appears to the author to represent a performance hit for little tangible
gain.
- Developed at devel:languages:perl
- Sources inherited from project openSUSE:Factory
-
3
derived packages
- Download package
-
Checkout Package
osc -A https://api.opensuse.org checkout openSUSE:Factory:RISCV/perl-PPIx-Regexp && cd $_
- Create Badge
Source Files
Filename | Size | Changed |
---|---|---|
PPIx-Regexp-0.024.tar.gz | 0000145003 142 KB | |
perl-PPIx-Regexp.changes | 0000006085 5.94 KB | |
perl-PPIx-Regexp.spec | 0000003483 3.4 KB |
Revision 11 (latest revision is 70)
- updated to 0.024 Reinstate author test xt/author/manifest.t, which was clobbered shortly before the release of 0.021_10. Correct address of FSF in the version of the GPL distributed in LICENSES/Copying. Thanks to Petr Pisar for picking this up. Correct various documentation errors. The default-modifier functionality is no longer considered experimental. Don't initialize effective modifiers with '^', since that wrongly asserts that /d has been seen somewhere along the line. Implement negation of match-semantic modifiers (e.g. 'no re /u;') by setting the relevant datum to undef. THE DEFAULT-MODIFIER FUNCTIONALITY IS EXPERIMENTAL, AND MAY BE CHANGED WITHOUT NOTICE until the next production release. Support for default modifiers. This includes: * default_modifiers argument to new() in PPIx::Regexp, PPIx::Regexp::Tokenizer, and PPIx::Regexp::Dumper * Public method modifier_asserted() on PPIx::Regexp, to return whether a given modifier is actually in effect. The results of the modifier() method are unchanged. THIS FUNCTIONALITY IS EXPERIMENTAL, AND MAY BE CHANGED OR REVOKED WITHOUT WARNING. Require Test::More 0.88 for installation. Eliminate all the 'eval { require ... }' logic in favor of 'use Test::More 0.88'. Have Makefile.PL make use of {BUILD_REQUIRES} if it is available. Fix PPIx::Regexp::Token::Whitespace->can_be_quantified() to return false. Modified tokenizer to correctly handle a back slash used as a delimiter. I believe. PPIx::Regexp::Dumper now dumps the results of ppi() if that method is
Comments 0