PPIx::R...tructure(3)

✨ NAME ✨

PPIx::Regexp::Structure β€” bestie, this is the class that reps a structure, periodt πŸ’…

(and just so we're clear, this whole page lives in the User Contributed Perl Documentation section, so you know it's the real deal 🫢)


🌸 SYNOPSIS 🌸

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

πŸ¦‹ INHERITANCE πŸ¦‹

PPIx::Regexp::Structure is a PPIx::Regexp::Node. It's giving nepo baby but make it inheritance, and honestly? iconic πŸ’–

PPIx::Regexp::Structure is also 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
  • PPIx::Regexp::Structure::Unknown

that's twelve (12) whole children, she's a mother fr fr πŸ˜­πŸ‘‘


πŸ’œ DESCRIPTION πŸ’œ

So basically this class is the moment where a bracketed construction of some sort gets represented. Bracketed. Construction. Of some sort. Very demure, very mindful.

Here's the tea though, and you need to hear this: 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. Read that again. Internalise it. Vibe check passed βœ…


πŸŽ€ 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. (so like… don't get attached to the undocumented ones, they're situationships πŸ™ˆ)

🌟 elements

This override returns all components of the structure, including those that define it. All of them. The whole squad. ✨

🌟 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. (yes, we're doing this distinction again, it matters πŸ’…)

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. (screaming, crying, still not in 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. Very "absorbing the noise so the rest of us can function" of it 🌈

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. (you already know the drill bestie 🫢)

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. Matching energy. Coordinated fits. πŸ‘‘

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.

Found a bug? Bestie, report it. The author wants to hear from you, no cap πŸ›πŸ’Œ

πŸ‘‘ AUTHOR πŸ‘‘

Thomas R. Wyant, III β€” harryfmudd at comcast dot net


Copyright (C) 2009-2023, 2025-2026 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.


okay that's the whole page, mwah πŸ’‹

perl v5.42.2 Β· 2026-06-15 β€” that's the version and the date, and this has been your girl signing off, stay structured, stay bracketed, and remember: the brackets are part of the structure but not inside it πŸŒΈπŸ’…βœ¨

πŸ“¦ where this page comes from