NAME
Parrot::PIR::Formatter - Given ugly PIR, format it nicely.
SYNOPSIS
use Parrot::PIR::Formatter;
DESCRIPTION
Primarily intended to be used by pirtidy.pl. Given some ugly PIR, format it nicely.
Functions
Class Methods
Instance Methods
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. =-)
BUGS
Does not play well with heredocs. No tests. Should arguably be part of IMCC, which already knows how to parse PIR.