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::Subexpression, PPIx::Regexp::Structure::Switch
22 and PPIx::Regexp::Structure::Unknown.
23
25 This class represents a bracketed construction of some sort. The
26 brackets considered part of the structure, but not inside it. So the
27 "elements()" method returns the brackets if they are defined, but the
28 "children()" method does not.
29
31 This class provides the following public methods. Methods not
32 documented here are private, and unsupported in the sense that the
33 author reserves the right to change or remove them without notice.
34
35 finish
36 my $elem = $struct->finish();
37 my @elem = $struct->finish();
38 my $elem = $struct->finish( 0 );
39
40 Returns the finishing structure element. This is included in the
41 "elements" but not in the "children".
42
43 The finishing element is actually an array, though it should never have
44 more than one element. Calling "finish" in list context gets you all
45 elements of the array. Calling it in scalar context gets you an element
46 of the array, defaulting to element 0 if no argument is passed.
47
48 start
49 my $elem = $struct->start();
50 my @elem = $struct->start();
51 my $elem = $struct->start( 0 );
52
53 Returns the starting structure element. This is included in the
54 "elements" but not in the "children".
55
56 The starting element is actually an array. The first element (element
57 0) is the actual starting delimiter. Subsequent elements, if any, are
58 insignificant elements (comments or white space) absorbed into the
59 start element for ease of parsing subsequent elements.
60
61 Calling "start" in list context gets you all elements of the array.
62 Calling it in scalar context gets you an element of the array,
63 defaulting to element 0 if no argument is passed.
64
65 type
66 my $elem = $struct->type();
67 my @elem = $struct->type();
68 my $elem = $struct->type( 0 );
69
70 Returns the group type if any. This will be the leading
71 PPIx::Regexp::Token::GroupType token if any. This is included in
72 "elements" but not in "children".
73
74 The type is actually an array. The first element (element 0) is the
75 actual type determiner. Subsequent elements, if any, are insignificant
76 elements (comments or white space) absorbed into the type element for
77 consistency with the way the start element is handled.
78
79 Calling "type" in list context gets you all elements of the array.
80 Calling it in scalar context gets you an element of the array,
81 defaulting to element 0 if no argument is passed.
82
84 Support is by the author. Please file bug reports at
85 <http://rt.cpan.org>, or in electronic mail to the author.
86
88 Thomas R. Wyant, III wyant at cpan dot org
89
91 Copyright (C) 2009-2013 by Thomas R. Wyant, III
92
93 This program is free software; you can redistribute it and/or modify it
94 under the same terms as Perl 5.10.0. For more details, see the full
95 text of the licenses in the directory LICENSES.
96
97 This program is distributed in the hope that it will be useful, but
98 without any warranty; without even the implied warranty of
99 merchantability or fitness for a particular purpose.
100
101
102
103perl v5.16.3 2014-06-10 PPIx::Regexp::Structure(3)