1PPIx::Regexp::StructureU(s3e)r Contributed Perl DocumentaPtPiIoxn::Regexp::Structure(3)
2
3
4
6 PPIx::Regexp::Structure - Represent a structure.
7
9 use PPIx::Regexp::Dumper;
10 PPIx::Regexp::Dumper->new( 'qr{(foo)}' )->print();
11
13 "PPIx::Regexp::Structure" is a PPIx::Regexp::Node.
14
15 "PPIx::Regexp::Structure" is the parent of
16 PPIx::Regexp::Structure::Assertion,
17 PPIx::Regexp::Structure::BranchReset, PPIx::Regexp::Structure::Capture,
18 PPIx::Regexp::Structure::CharClass, PPIx::Regexp::Structure::Code,
19 PPIx::Regexp::Structure::Main, PPIx::Regexp::Structure::Modifier,
20 PPIx::Regexp::Structure::Quantifier,
21 PPIx::Regexp::Structure::Script_Run,
22 PPIx::Regexp::Structure::Subexpression, PPIx::Regexp::Structure::Switch
23 and PPIx::Regexp::Structure::Unknown.
24
26 This class represents a bracketed construction of some sort. The
27 brackets are considered part of the structure, but not inside it. So
28 the elements() method returns the brackets if they are defined, but the
29 children() method does not.
30
32 This class provides the following public methods. Methods not
33 documented here are private, and unsupported in the sense that the
34 author reserves the right to change or remove them without notice.
35
36 elements
37 This override returns all components of the structure, including those
38 that define it.
39
40 finish
41 my $elem = $struct->finish();
42 my @elem = $struct->finish();
43 my $elem = $struct->finish( 0 );
44
45 Returns the finishing structure element. This is included in the
46 "elements" but not in the "children".
47
48 The finishing element is actually an array, though it should never have
49 more than one element. Calling "finish" in list context gets you all
50 elements of the array. Calling it in scalar context gets you an element
51 of the array, defaulting to element 0 if no argument is passed.
52
53 start
54 my $elem = $struct->start();
55 my @elem = $struct->start();
56 my $elem = $struct->start( 0 );
57
58 Returns the starting structure element. This is included in the
59 "elements" but not in the "children".
60
61 The starting element is actually an array. The first element (element
62 0) is the actual starting delimiter. Subsequent elements, if any, are
63 insignificant elements (comments or white space) absorbed into the
64 start element for ease of parsing subsequent elements.
65
66 Calling "start" in list context gets you all elements of the array.
67 Calling it in scalar context gets you an element of the array,
68 defaulting to element 0 if no argument is passed.
69
70 type
71 my $elem = $struct->type();
72 my @elem = $struct->type();
73 my $elem = $struct->type( 0 );
74
75 Returns the group type if any. This will be the leading
76 PPIx::Regexp::Token::GroupType token if any. This is included in
77 "elements" but not in "children".
78
79 The type is actually an array. The first element (element 0) is the
80 actual type determiner. Subsequent elements, if any, are insignificant
81 elements (comments or white space) absorbed into the type element for
82 consistency with the way the start element is handled.
83
84 Calling "type" in list context gets you all elements of the array.
85 Calling it in scalar context gets you an element of the array,
86 defaulting to element 0 if no argument is passed.
87
89 Support is by the author. Please file bug reports at
90 <https://rt.cpan.org/Public/Dist/Display.html?Name=PPIx-Regexp>,
91 <https://github.com/trwyant/perl-PPIx-Regexp/issues>, or in electronic
92 mail to the author.
93
95 Thomas R. Wyant, III wyant at cpan dot org
96
98 Copyright (C) 2009-2023 by Thomas R. Wyant, III
99
100 This program is free software; you can redistribute it and/or modify it
101 under the same terms as Perl 5.10.0. For more details, see the full
102 text of the licenses in the directory LICENSES.
103
104 This program is distributed in the hope that it will be useful, but
105 without any warranty; without even the implied warranty of
106 merchantability or fitness for a particular purpose.
107
108
109
110perl v5.38.0 2023-07-21 PPIx::Regexp::Structure(3)