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