Parrot::PIR::Formatter - Given ugly PIR, format it nicely.
use Parrot::PIR::Formatter;
Primarily intended to be used by pirtidy.pl. Given some ugly PIR, format it nicely.
pirtidy.pl
new([code])
Returns $obj as a new instance.
$obj
$obj-
Add more pir to be processed.
$code = $obj-
Return the nicely formatted code for the raw PIR that's been provided.
Many things to muck with line could be done here:
o remove extraneous spaces. o add in "proper" spacing (after commas, etc.) o heredocs could be treated as blocks to set them off visually. o could remove/add explicit declarations of string type o could convert double to single quotes when possible. o could convert strings with embedded newlines to heredocs.
Things that might ease deprecation, but probably won't get done until after these items are already deprecated.
o could fixup Pmc vs. .Pmc o could undo usage of '<reg> = opcode' syntax where that syntax will eventually be prohibited.
Or not. =-)
Does not play well with heredocs. Should arguably be part of IMCC, which already knows how to parse PIR.
To install Parrot::Op, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Parrot::Op
CPAN shell
perl -MCPAN -e shell install Parrot::Op
For more information on module installation, please visit the detailed CPAN module installation guide.