1PPIx::Regexp::Element(3U)ser Contributed Perl DocumentatiPoPnIx::Regexp::Element(3)
2
3
4
6 PPIx::Regexp::Element - Base of the PPIx::Regexp hierarchy.
7
9 No user-serviceable parts inside.
10
12 "PPIx::Regexp::Element" is not descended from any other class.
13
14 "PPIx::Regexp::Element" is the parent of PPIx::Regexp::Node and
15 PPIx::Regexp::Token.
16
18 This class is the base of the PPIx::Regexp object hierarchy. It
19 provides the same kind of navigational functionality that is provided
20 by PPI::Element.
21
23 This class provides the following public methods. Methods not
24 documented here are private, and unsupported in the sense that the
25 author reserves the right to change or remove them without notice.
26
27 ancestor_of
28 This method returns true if the object is an ancestor of the argument,
29 and false otherwise. By the definition of this method, $self is its own
30 ancestor.
31
32 can_be_quantified
33 $token->can_be_quantified()
34 and print "This element can be quantified.\n";
35
36 This method returns true if the element can be quantified.
37
38 class
39 This method returns the class name of the element. It is the same as
40 "ref $self".
41
42 comment
43 This method returns true if the element is a comment and false
44 otherwise.
45
46 content
47 This method returns the content of the element.
48
49 descendant_of
50 This method returns true if the object is a descendant of the argument,
51 and false otherwise. By the definition of this method, $self is its own
52 descendant.
53
54 is_quantifier
55 $token->is_quantifier()
56 and print "This element is a quantifier.\n";
57
58 This method returns true if the element is a quantifier. You can not
59 tell this from the element's class, because a right curly bracket may
60 represent a quantifier for the purposes of figuring out whether a
61 greediness token is possible.
62
63 next_sibling
64 This method returns the element's next sibling, or nothing if there is
65 none.
66
67 parent
68 This method returns the parent of the element, or undef if there is
69 none.
70
71 perl_version_introduced
72 This method returns the version of Perl in which the element was
73 introduced. This will be at least 5.000. Before 5.006 I am relying on
74 the perldelta, perlre, and perlop documentation, since I have been
75 unable to build earlier Perls. Since I have found no documentation
76 before 5.003, I assume that anything found in 5.003 is also in 5.000.
77
78 Since this all depends on my ability to read and understand masses of
79 documentation, the results of this method should be viewed with
80 caution, if not downright skepticism.
81
82 There are also cases which are ambiguous in various ways. For those see
83 "RESTRICTIONS" in PPIx::Regexp, and especially "Changes in Syntax" in
84 PPIx::Regexp.
85
86 perl_version_removed
87 This method returns the version of Perl in which the element was
88 removed. If the element is still valid the return is "undef".
89
90 All the caveats to perl_version_introduced() apply here also, though
91 perhaps less severely since although many features have been introduced
92 since 5.0, few have been removed.
93
94 previous_sibling
95 This method returns the element's previous sibling, or nothing if there
96 is none.
97
98 significant
99 This method returns true if the element is significant and false
100 otherwise.
101
102 snext_sibling
103 This method returns the element's next significant sibling, or nothing
104 if there is none.
105
106 sprevious_sibling
107 This method returns the element's previous significant sibling, or
108 nothing if there is none.
109
110 tokens
111 This method returns all tokens contained in the element.
112
113 top
114 This method returns the top of the hierarchy.
115
116 unescaped_content
117 This method returns the content of the element, unescaped.
118
119 whitespace
120 This method returns true if the element is whitespace and false
121 otherwise.
122
123 nav
124 This method returns navigation information from the top of the
125 hierarchy to this node. The return is a list of names of methods and
126 references to their argument lists. The idea is that given $elem which
127 is somewhere under $top,
128
129 my @nav = $elem->nav();
130 my $obj = $top;
131 while ( @nav ) {
132 my $method = shift @nav;
133 my $args = shift @nav;
134 $obj = $obj->$method( @{ $args } ) or die;
135 }
136 # At this point, $obj should contain the same object
137 # as $elem.
138
140 Support is by the author. Please file bug reports at
141 <http://rt.cpan.org>, or in electronic mail to the author.
142
144 Thomas R. Wyant, III wyant at cpan dot org
145
147 Copyright (C) 2009-2013 by Thomas R. Wyant, III
148
149 This program is free software; you can redistribute it and/or modify it
150 under the same terms as Perl 5.10.0. For more details, see the full
151 text of the licenses in the directory LICENSES.
152
153 This program is distributed in the hope that it will be useful, but
154 without any warranty; without even the implied warranty of
155 merchantability or fitness for a particular purpose.
156
157
158
159perl v5.16.3 2014-06-10 PPIx::Regexp::Element(3)