NAME ^

Parrot::Pmc2c::Parser - PMC Parser

SYNOPSIS ^

    use Parrot::Pmc2c::Parser;

DESCRIPTION ^

Parrot::Pmc2c::Parser parses a sudo C syntax into a perl hash that is then dumped.

parse_pmc() ^

    $parsed_pmc_hash = parse_pmc($pmc2cMain, $filename);

Purpose: Parse PMC code and return a hash ref of pmc attributes.

Arguments: List of two arguments:

Return Values: Reference to a Parrot::Pmc2c::PMC object

Comments: Called by dump_pmc().

parse_top_level() ^

    my ($preamble, $pmcname, $flags, $parents, $pmcbody, $post, $chewed_lines)
        = parse_top_level(\$code);

Purpose: Extract a pmc signature from the code ref.

Argument: PMC file contents slurped by parse_pmc().

Return Values: List of seven elements:

Comments: Called internally by parse_pmc().

parse_flags() ^

    my ($flags, $parents) = parse_flags($attributes, $pmcname);

Purpose: Extract a pmc signature from the code ref.

Argument: PMC file contents slurped by parse_pmc().

Return Values: List of two elements:

Comments: Called internally by parse_top_level().

extract_balanced() ^

    ($pmcbody, $post) = extract_balanced($code);

Purpose: Remove a balanced {} construct from the beginning of $code. Return it and the remaining code.

Argument: The code ref which was the first argument provided to parse_pmc().

Return Values: List of two elements:

Comments: Called twice within parse_pmc(). Will die with error message Badly balanced if not balanced.

parse_method_attrs() ^

    $attrs = parse_method_attrs($method_attributes);

Purpose: Parse a list of method attributes and return a hash ref of them.

Arguments: String captured from regular expression.

Return Values: Reference to hash of attribute values.

Comments: Called within parse_pmc().


parrot