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 If true, postfix dereferences are recognized in code and
79 interpolations. See the tokenizer's new() for details.
80
81 strict boolean
82 This option is passed on to the parser, where it specifies whether
83 the parse should assume "use re 'strict'" is in effect.
84
85 The 'strict' pragma was introduced in Perl 5.22, and its
86 documentation says that it is experimental, and that there is no
87 commitment to backward compatibility. The same applies to the parse
88 produced when this option is asserted.
89
90 The default is false.
91
92 significant boolean
93 If true, this option causes only significant elements to be dumped.
94
95 The default is false.
96
97 test boolean
98 If true, this option causes the output to be formatted as a
99 regression test rather than as a straight dump. The output produced
100 by asserting this option is explicitly undocumented, in the sense
101 that the author reserves the right to change the generated output
102 without notice of any kind.
103
104 The default is false.
105
106 tokens boolean
107 If true, this option causes a dump of tokenizer output rather than
108 of a full parse of the regular expression. This is forced true if
109 the dump is of a PPIx::Regexp::Tokenizer.
110
111 The default is false.
112
113 trace number
114 If greater than zero, this option causes a trace of the parse. This
115 option is unsupported in the sense that the author reserves the
116 right to change it without notice.
117
118 The default is zero.
119
120 verbose number
121 If greater than zero, this option causes additional information to
122 be given about the elements found. This option is unsupported in
123 the sense that the author reserves the right to change it without
124 notice.
125
126 The default is zero.
127
128 If the thing to be dumped was a string, unrecognized arguments are
129 passed to "PPIx::Regexp::Tokenizer->new()". Otherwise they are ignored.
130
131 list
132 print map { "$_\n" } $dumper->list();
133
134 This method produces an array containing the dump output, one line per
135 element. The output has no left margin applied, and no newlines.
136
137 print
138 $dumper->print();
139
140 This method simply prints the result of "string" to standard out.
141
142 string
143 print $dumper->string();
144
145 This method adds left margin and newlines to the output of "list",
146 concatenates the result into a single string, and returns that string.
147
149 Support is by the author. Please file bug reports at
150 <http://rt.cpan.org>, or in electronic mail to the author.
151
153 Thomas R. Wyant, III wyant at cpan dot org
154
156 Copyright (C) 2009-2018 by Thomas R. Wyant, III
157
158 This program is free software; you can redistribute it and/or modify it
159 under the same terms as Perl 5.10.0. For more details, see the full
160 text of the licenses in the directory LICENSES.
161
162 This program is distributed in the hope that it will be useful, but
163 without any warranty; without even the implied warranty of
164 merchantability or fitness for a particular purpose.
165
166
167
168perl v5.28.0 2018-08-12 PPIx::Regexp::Dumper(3)