PPIx::Regexp::Structure(3pm)

PPIx::Regexp::Structure3pm

Represent a structure.

Usage

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

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.

Overview

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.

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.

Support

Support is by the author. Please file bug reports at <https://github.com/trwyant/perl-PPIx-Regexp/issues> or in electronic mail to the author.

Releases

9 releases since Debian 6.0 (Squeeze); the text changed 8 times.

  1. 6.0
  2. 7
  3. 8
  4. 9
  5. 10
  6. 11
  7. 12
  8. 13
  9. Arch

Author

Thomas R. Wyant, III harryfmudd at comcast dot net

From perl-ppix-regexp 0.092-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.