NAME
predump - Dump a regular expression
SYNOPSIS
predump 'qr{foo}smx'
predump -ordinal 'm/foo/x'
You can use
predump -help
for full documentation on usage.
DESCRIPTION
This Perl script parses the regular expression given on its command line and dumps the results of the parse to standard out. The following options are recognized:
- -default-modifiers text
-
This option specifies default modifiers for the regular expression. You can specify more than one, either as a comma-separated list or by specifying the option multiple times, or both. It is simply passed through to PPIx::Regexp->new().
This option can also be expressed as
-default_modifiers
. - -encoding name
-
This option specifies the encoding of the regular expression. It is simply passed through to PPIx::Regexp->new().
- -files
-
If true, this option specifies that the arguments are files whose regular expressions are to be analyzed. If this options is asserted,
-objectify
and-unescape
are ignored. - -guess
-
If true, this option specifies that the parser guess whether the argument is to be parsed as a regex or a string. If false, it specifies the default parse, which is as a regex. If more than one of
-guess
,-regex
and-string
is specified, the last one parsed (normally the-string
are specified, the last specification parsed (normally the rightmost one) wins.The default is
-noguess
, which specifies the default parse. - -indent number
-
This option specifies the number of spaces to indent each level of the parse hierarchy. It is simply passed through to PPIx::Regexp::Dumper->new().
- -margin number
-
This option specifies the width of the left margin of the dump output. It is simply passed through to PPIx::Regexp::Dumper->new().
- -objectify
-
If true, this option specifies that the arguments should be made into PPI::Token objects before being passed to PPIx::Regexp. This option is ignored if
-files
is asserted. - -ordinal
-
If true, this option specifies that the ordinal value of all PPIx::Regexp::Token::Literal objects be displayed as part of the dump. The default is false. This is simply passed through to PPIx::Regexp::Dumper->new().
- -perl_version
-
If true, this option specifies that the dump include the perl version applicable to each dumped item. The default is false. This is simply passed through to PPIx::Regexp::Dumper->new().
- -postderef
-
If true, this option specifies that postfix dereferences are recognized in code and interpolations. If false (specified as
-nopostderef
) they are not recognized. For the default see the documentation for the tokenizer's new() method. - -regex
-
If true, this option specifies that the parser parse the argument as a regex. If false, it specifies the default parse, which is as a regex, so this option is unnecessary unless the default parse changes. If more than one of
-guess
,-regex
and-string
is specified, the last one parsed (normally the-string
are specified, the last specification parsed (normally the rightmost one) wins.The default is
-noregex
, which specifies the default parse. - -significant
-
If true, this option specifies that the dump include only significant syntax elements. That is, no comments or non-significant white space. The default is false. This is simply passed through to PPIx::Regexp::Dumper->new().
- -string
-
If true, this option specifies that the argument be parsed as a string, not a regex. If false, it specifies the default parse, which is as a regex. If more than one of
-guess
,-regex
and-string
is specified, the last one parsed (normally the-string
are specified, the last specification parsed (normally the rightmost one) wins.The default is
-nostring
, which specifies the default parse. - -test
-
If true, this option specifies that the dump take the form of a predefined set of tests be generated for the regular expression. This option is unsupported in the sense that the author makes no commitment to what it will do, and reserves the right to change it without notice. This is simply passed through to PPIx::Regexp::Dumper->new().
- -tokens
-
If true, this option specifies that only tokenization be done on the regular expression, and the output tokens dumped to standard out. This is simply passed through to PPIx::Regexp::Dumper->new().
- -trace
-
If true, this option specifies the generation of trace output from the parse. It is unsupported in the sense that the author makes no commitment to what it will do, and reserves the right to change it without notice. This is simply passed through to PPIx::Regexp->new().
- -unescape
-
If true, this option causes the argument to be unescaped before processing. You would use it if the argument is a Perl single-quotish string, since Perl's single-quoted syntax differs from that of the usual Unix shell. This option is ignored if
-files
is asserted. - -verbose
-
If true, this option causes more information to be dumped about each object produced by the parse. It is unsupported in the sense that the author makes no commitment to what it will do, and reserves the right to change it without notice. This is simply passed through to PPIx::Regexp::Dumper->new().
SUPPORT
Support is by the author. Please file bug reports at http://rt.cpan.org, or in electronic mail to the author.
AUTHOR
Thomas R. Wyant, III wyant at cpan dot org
COPYRIGHT AND LICENSE
Copyright (C) 2009-2018 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.