1PPIx::Regexp::Dumper(3)User Contributed Perl DocumentatioPnPIx::Regexp::Dumper(3)
2
3
4
6 PPIx::Regexp::Dumper - Dump the results of parsing regular expressions
7
9 use PPIx::Regexp::Dumper;
10 PPIx::Regexp::Dumper->new( 'qr{foo}smx' )
11 ->print();
12
14 "PPIx::Regexp::Dumper" is a PPIx::Regexp::Support.
15
16 "PPIx::Regexp::Dumper" has no descendants.
17
19 This class generates a formatted dump of a PPIx::Regexp::Element object
20 (or any subclass thereof), a PPIx::Regexp::Tokenizer object, or a
21 string that can be made into one of these.
22
24 This class provides the following public methods. Methods not
25 documented here are private, and unsupported in the sense that the
26 author reserves the right to change or remove them without notice.
27
28 new
29 my $dumper = PPIx::Regexp::Dumper->new(
30 '/foo/', ordinal => 1,
31 );
32
33 This static method instantiates the dumper. It takes the string,
34 PPI::Element, PPIx::Regexp::Element, or PPIx::Regexp::Tokenizer to be
35 dumped as the first argument. Optional further arguments may be passed
36 as name/value pairs.
37
38 The following options are recognized:
39
40 default_modifiers array_reference
41 This argument is a reference to a list of default modifiers to be
42 applied to the statement being parsed. See PPIx::Regexp new() for
43 the details.
44
45 encoding name
46 This argument is the name of the encoding of the regular
47 expression. If specified, it is passed through to
48 PPIx::Regexp->new(). It also causes an "Encode::encode" to be done
49 on any parse content dumped.
50
51 explain Boolean
52 If true, this option causes the "explain()" output of each object
53 to be dumped.
54
55 indent number
56 This argument is the number of additional spaces to indent each
57 level of the parse hierarchy. This is ignored if either the "test"
58 or "tokens" argument is true.
59
60 The default is 2.
61
62 margin number
63 This is the number of spaces to indent the top level of the parse
64 hierarchy. This is ignored if the "test" argument is true.
65
66 The default is zero.
67
68 ordinal Boolean
69 If true, this option causes the "ordinal" values of
70 PPIx::Regexp::Token::Literal objects to be dumped.
71
72 perl_version Boolean
73 If true, this option causes the "perl_version_introduced" and
74 "perl_version_removed" values associated with each object dumped to
75 be displayed.
76
77 postderef Boolean
78 THIS ARGUMENT IS DEPRECATED. See DEPRECATION NOTICE in
79 PPIx::QuoteLike for the details.
80
81 If true, postfix dereferences are recognized in code and
82 interpolations. See the tokenizer's new() for details.
83
84 ppi Boolean
85 If true, any Perl code contained in the object will be dumped.
86
87 short Boolean
88 If true, leading 'PPIx::Regexp::' will be removed from the class
89 names in the output.
90
91 strict Boolean
92 This option is passed on to the parser, where it specifies whether
93 the parse should assume "use re 'strict'" is in effect.
94
95 The 'strict' pragma was introduced in Perl 5.22, and its
96 documentation says that it is experimental, and that there is no
97 commitment to backward compatibility. The same applies to the parse
98 produced when this option is asserted.
99
100 The default is false.
101
102 significant Boolean
103 If true, this option causes only significant elements to be dumped.
104
105 The default is false.
106
107 test Boolean
108 If true, this option causes the output to be formatted as a
109 regression test rather than as a straight dump. The output produced
110 by asserting this option is explicitly undocumented, in the sense
111 that the author reserves the right to change the generated output
112 without notice of any kind.
113
114 The default is false.
115
116 tokens Boolean
117 If true, this option causes a dump of tokenizer output rather than
118 of a full parse of the regular expression. This is forced true if
119 the dump is of a PPIx::Regexp::Tokenizer.
120
121 The default is false.
122
123 trace number
124 If greater than zero, this option causes a trace of the parse. This
125 option is unsupported in the sense that the author reserves the
126 right to change it without notice.
127
128 The default is zero.
129
130 verbose number
131 If greater than zero, this option causes additional information to
132 be given about the elements found. This option is unsupported in
133 the sense that the author reserves the right to change it without
134 notice.
135
136 The default is zero.
137
138 If the thing to be dumped was a string, unrecognized arguments are
139 passed to "PPIx::Regexp::Tokenizer->new()". Otherwise they are ignored.
140
141 list
142 print map { "$_\n" } $dumper->list();
143
144 This method produces an array containing the dump output, one line per
145 element. The output has no left margin applied, and no newlines.
146
147 print
148 $dumper->print();
149
150 This method simply prints the result of "string" to standard out.
151
152 string
153 print $dumper->string();
154
155 This method adds left margin and newlines to the output of "list",
156 concatenates the result into a single string, and returns that string.
157
159 Support is by the author. Please file bug reports at
160 <https://rt.cpan.org/Public/Dist/Display.html?Name=PPIx-Regexp>,
161 <https://github.com/trwyant/perl-PPIx-Regexp/issues>, or in electronic
162 mail to the author.
163
165 Thomas R. Wyant, III wyant at cpan dot org
166
168 Copyright (C) 2009-2022 by Thomas R. Wyant, III
169
170 This program is free software; you can redistribute it and/or modify it
171 under the same terms as Perl 5.10.0. For more details, see the full
172 text of the licenses in the directory LICENSES.
173
174 This program is distributed in the hope that it will be useful, but
175 without any warranty; without even the implied warranty of
176 merchantability or fitness for a particular purpose.
177
178
179
180perl v5.34.1 2022-03-22 PPIx::Regexp::Dumper(3)