logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

PPIx::Regexp::Structure - Represent a structure.

Author

       Thomas R. Wyant, III wyantatcpandotorg

Description

       This class represents a bracketed construction of some sort. The brackets are considered part of the
       structure, but not inside it. So the "elements()" method returns the brackets if they are defined, but
       the "children()" method does not.

Inheritance

       "PPIx::Regexp::Structure" is a PPIx::Regexp::Node.

       "PPIx::Regexp::Structure" is the parent of PPIx::Regexp::Structure::Assertion,
       PPIx::Regexp::Structure::BranchReset, PPIx::Regexp::Structure::Capture,
       PPIx::Regexp::Structure::CharClass, PPIx::Regexp::Structure::Code, PPIx::Regexp::Structure::Main,
       PPIx::Regexp::Structure::Modifier, PPIx::Regexp::Structure::Quantifier,
       PPIx::Regexp::Structure::Script_Run, PPIx::Regexp::Structure::Subexpression,
       PPIx::Regexp::Structure::Switch and PPIx::Regexp::Structure::Unknown.

Methods

       This class provides the following public methods. Methods not documented here are private, and
       unsupported in the sense that the author reserves the right to change or remove them without notice.

   elements
       This override returns all components of the structure, including those that define it.

   finish
        my $elem = $struct->finish();
        my @elem = $struct->finish();
        my $elem = $struct->finish( 0 );

       Returns the finishing structure element. This is included in the "elements" but not in the "children".

       The finishing element is actually an array, though it should never have more than one element. Calling
       "finish" in list context gets you all elements of the array. Calling it in scalar context gets you an
       element of the array, defaulting to element 0 if no argument is passed.

   start
        my $elem = $struct->start();
        my @elem = $struct->start();
        my $elem = $struct->start( 0 );

       Returns the starting structure element. This is included in the "elements" but not in the "children".

       The starting element is actually an array. The first element (element 0) is the actual starting
       delimiter. Subsequent elements, if any, are insignificant elements (comments or white space) absorbed
       into the start element for ease of parsing subsequent elements.

       Calling "start" in list context gets you all elements of the array.  Calling it in scalar context gets
       you an element of the array, defaulting to element 0 if no argument is passed.

   type
        my $elem = $struct->type();
        my @elem = $struct->type();
        my $elem = $struct->type( 0 );

       Returns the group type if any. This will be the leading PPIx::Regexp::Token::GroupType token if any. This
       is included in "elements" but not in "children".

       The type is actually an array. The first element (element 0) is the actual type determiner. Subsequent
       elements, if any, are insignificant elements (comments or white space) absorbed into the type element for
       consistency with the way the start element is handled.

       Calling "type" in list context gets you all elements of the array.  Calling it in scalar context gets you
       an element of the array, defaulting to element 0 if no argument is passed.

Name

       PPIx::Regexp::Structure - Represent a structure.

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.

Synopsis

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

See Also