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 $self as a new instance.
$self
add_pir($code, $code, ...)
Add more pir to be processed.
$code = format()
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 turn opcode, <OUT>, <IN> into <OUT> = opcode <IN> o heredocs could be treated as blocks to set them off visually. o could remove explicit declarations of string type when not needed. o could add in single quotes wrapping .sub names. o could convert double to single quotes when possible. o could fixup Pmc vs. .Pmc o could convert strings with embedded newlines to heredocs.
Or not. =-)
Does not play well with heredocs. No tests. 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.