NAME

PPIx::Regexp::Token::GroupType - Represent a grouping parenthesis type.

SYNOPSIS

use PPIx::Regexp::Dumper;
PPIx::Regexp::Dumper->new( 'qr{(?i:foo)}smx' )
    ->print();

INHERITANCE

PPIx::Regexp::Token::GroupType is a PPIx::Regexp::Token.

PPIx::Regexp::Token::GroupType is the parent of PPIx::Regexp::Token::GroupType::Assertion, PPIx::Regexp::Token::GroupType::Atomic_Script_Run, PPIx::Regexp::Token::GroupType::BranchReset, PPIx::Regexp::Token::GroupType::Code, PPIx::Regexp::Token::GroupType::Modifier, PPIx::Regexp::Token::GroupType::NamedCapture, PPIx::Regexp::Token::GroupType::Script_Run, PPIx::Regexp::Token::GroupType::Subexpression and PPIx::Regexp::Token::GroupType::Switch.

DESCRIPTION

This class represents any of the magic sequences of characters that can follow an open parenthesis. This particular class is intended to be abstract.

METHODS

This class provides no public methods beyond those provided by its superclass.

__defining_string

my $string = $class->__defining_string();

This method is private to the PPIx-Regexp package, and is documented for the author's benefit only. It may be changed or revoked without notice.

This method returns an array of strings that define the specific group type. These strings will normally start with '?'.

Optionally, the first returned item may be a hash reference. The only supported key is {suffix}, which is a string to be suffixed to each of the regular expressions made by __make_group_type_matcher() out of the defining strings, inside a (?= ... ), so that it is not included in the match.

This method must be overridden, unless __make_group_type_matcher() is. The override must return the same thing each time, since the results of __make_group_type_matcher() are cached.

__make_group_type_matcher

my $hash_ref = $class->__make_group_type_matcher();

This method is private to the PPIx-Regexp package, and is documented for the author's benefit only. It may be changed or revoked without notice.

This method returns a reference to a hash. The keys are regexp delimiter characters which appear in the defining strings for the group type. For each key, the value is a reference to an array of Regexp objects, properly escaped for the key character. Key '' provides the regular expressions to be used if the regexp delimiter does not appear in any of the defining strings.

If this method is overridden by the subclass, method __defining_string() need not be, unless the overridden __make_group_type_matcher() calls __defining_string().

__match_setup

$class->__match_setup( $tokenizer );

This method is private to the PPIx-Regexp package, and is documented for the author's benefit only. It may be changed or revoked without notice.

This method performs whatever setup is needed once it is determined that the given group type has been detected. This method is called only if the class matched at the current position in the string being parsed. It must perform whatever extra setup is needed for the match. It returns nothing.

This method need not be overridden. The default does nothing.

__setup_class

$class->__setup_class( \%definition, \%opt );

This method is private to the PPIx-Regexp package, and is documented for the author's benefit only. It may be changed or revoked without notice.

This method uses the %definition hash to create the __defining_string(), explain(), perl_version_introduced(), and perl_version_removed() methods for the calling class. Any of these that already exist will not be replaced.

The %definition hash defines all the strings that specify tokens of the invoking class. You can not (unfortunately) use this mechanism if you need a regular expression to recognize a token that belongs to this class. The keys of the %definition hash are strings that specify members of this class. The values are hashes that define the specific member of the class. The following values are supported:

{expl}

This is the explanation of the element, to be returned by the explain() method.

{intro}

This is the Perl version that introduced the element, as a string. The default is the value of constant MINIMUM_PERL.

{remov}

This is the Perl version that removed the element, as a string. The default is undef, meaning that the element is still present in the highest released version of Perl, whether development or production.

The %opt hash is optional, and defaults to the empty hash. It is used, basically, for ad-hocery. The supported keys are:

{suffix}

If this element is defined, the first element returned by the generated __defining_string() method is a hash containing this key and value.

SUPPORT

Support is by the author. Please file bug reports at https://rt.cpan.org/Public/Dist/Display.html?Name=PPIx-Regexp, https://github.com/trwyant/perl-PPIx-Regexp/issues, or in electronic mail to the author.

AUTHOR

Thomas R. Wyant, III wyant at cpan dot org

COPYRIGHT AND LICENSE

Copyright (C) 2009-2023 by Thomas R. Wyant, III

This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For more details, see the full text of the licenses in the directory LICENSES.

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.