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 indent number
52 This argument is the number of additional spaces to indent each
53 level of the parse hierarchy. This is ignored if either the "test"
54 or "tokens" argument is true.
55
56 The default is 2.
57
58 margin number
59 This is the number of spaces to indent the top level of the parse
60 hierarchy. This is ignored if the "test" argument is true.
61
62 The default is zero.
63
64 ordinal boolean
65 If true, this option causes the "ordinal" values of
66 PPIx::Regexp::Token::Literal objects to be dumped.
67
68 perl_version boolean
69 If true, this option causes the "perl_version_introduced" and
70 "perl_version_removed" values associated with each object dumped to
71 be displayed.
72
73 significant boolean
74 If true, this option causes only significant elements to be dumped.
75
76 The default is false.
77
78 test boolean
79 If true, this option causes the output to be formatted as a
80 regression test rather than as a straight dump. The output produced
81 by asserting this option is explicitly undocumented, in the sense
82 that the author reserves the right to change the generated output
83 without notice of any kind.
84
85 The default is false.
86
87 tokens boolean
88 If true, this option causes a dump of tokenizer output rather than
89 of a full parse of the regular expression. This is forced true if
90 the dump is of a PPIx::Regexp::Tokenizer.
91
92 The default is false.
93
94 trace number
95 If greater than zero, this option causes a trace of the parse. This
96 option is unsupported in the sense that the author reserves the
97 right to change it without notice.
98
99 The default is zero.
100
101 verbose number
102 If greater than zero, this option causes additional information to
103 be given about the elements found. This option is unsupported in
104 the sense that the author reserves the right to change it without
105 notice.
106
107 The default is zero.
108
109 If the thing to be dumped was a string, unrecognized arguments are
110 passed to "PPIx::Regexp::Tokenizer->new()". Otherwise they are ignored.
111
112 list
113 print map { "$_\n" } $dumper->list();
114
115 This method produces an array containing the dump output, one line per
116 element. The output has no left margin applied, and no newlines.
117
118 print
119 $dumper->print();
120
121 This method simply prints the result of "string" to standard out.
122
123 string
124 print $dumper->string();
125
126 This method adds left margin and newlines to the output of "list",
127 concatenates the result into a single string, and returns that string.
128
130 Support is by the author. Please file bug reports at
131 <http://rt.cpan.org>, or in electronic mail to the author.
132
134 Thomas R. Wyant, III wyant at cpan dot org
135
137 Copyright (C) 2009-2013 by Thomas R. Wyant, III
138
139 This program is free software; you can redistribute it and/or modify it
140 under the same terms as Perl 5.10.0. For more details, see the full
141 text of the licenses in the directory LICENSES.
142
143 This program is distributed in the hope that it will be useful, but
144 without any warranty; without even the implied warranty of
145 merchantability or fitness for a particular purpose.
146
147
148
149perl v5.16.3 2014-06-10 PPIx::Regexp::Dumper(3)