PPIx::Regexp::Dumper - Dump the results of parsing regular expressions |
PPIx::Regexp::Dumper - Dump the results of parsing regular expressions
use PPIx::Regexp::Dumper; PPIx::Regexp::Dumper->new( 'qr{foo}smx' ) ->print();
PPIx::Regexp::Dumper
is a
PPIx::Regexp::Support.
PPIx::Regexp::Dumper
has no descendants.
This class generates a formatted dump of a PPIx::Regexp::Element object (or any subclass thereof), a PPIx::Regexp::Tokenizer object, or a string that can be made into one of these.
This class provides the following public methods. Methods not documented here are private, and unsupported in the sense that the author reserves the right to change or remove them without notice.
my $dumper = PPIx::Regexp::Dumper->new( '/foo/', ordinal => 1, );
This static method instantiates the dumper. It takes the string, PPI::Element, PPIx::Regexp::Element, or PPIx::Regexp::Tokenizer to be dumped as the first argument. Optional further arguments may be passed as name/value pairs.
The following options are recognized:
Encode::encode
to be done on any parse content dumped.
explain()
output of each object to be
dumped.
test
or tokens
argument is true.
The default is 2.
test
argument is true.
The default is zero.
ordinal
values of
PPIx::Regexp::Token::Literal objects to
be dumped.
perl_version_introduced
and
perl_version_removed
values associated with each object dumped to be
displayed.
use re 'strict'
is in effect.
The 'strict'
pragma was introduced in Perl 5.22, and its
documentation says that it is experimental, and that there is no
commitment to backward compatibility. The same applies to the
parse produced when this option is asserted.
The default is false.
The default is false.
The default is false.
The default is false.
The default is zero.
The default is zero.
If the thing to be dumped was a string, unrecognized arguments are
passed to PPIx::Regexp::Tokenizer->new()
. Otherwise they are
ignored.
print map { "$_\n" } $dumper->list();
This method produces an array containing the dump output, one line per element. The output has no left margin applied, and no newlines.
$dumper->print();
This method simply prints the result of string to standard out.
print $dumper->string();
This method adds left margin and newlines to the output of list, concatenates the result into a single string, and returns that string.
Support is by the author. Please file bug reports at http://rt.cpan.org, or in electronic mail to the author.
Thomas R. Wyant, III wyant at cpan dot org
Copyright (C) 2009-2016 by Thomas R. Wyant, III
This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For more details, see the full text of the licenses in the directory LICENSES.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.
PPIx::Regexp::Dumper - Dump the results of parsing regular expressions |