NAME

WeBWorK::PG::Critic::Utils - Utility methods for PG Critic policies.

DESCRIPTION

Utility methods for PG Critic policies.

FUNCTIONS

getDeprecatedMacros

my @deprecatedMacros = getDeprecatedMacros();

Returns a list of deprecated macros. These are the macros found in the macros/deprecated directory.

parsePGMLBlock

my $pgmlElements = parsePGMLBlock(@lines);

Parses the given @lines of code from a PGML block and returns a reference to a hash containing details of the PGML blocks found.

If any [@ ... @] blocks are found in the PGML code, then the return hash will contain the key commands which will be a reference to an array of PPI::Document objects representing the Perl code within the [@ ... @] blocks found.

If the PGML content or a block within fails to parse, then the return hash will contain the key errors with a reference to an array of errors that occurred.

Also if there are any warnings that occur in the parsing, those will be in the warnings key of the return hash.

parseTextBlock

my $textElements = parseTextBlock(@lines);

Parses the given @lines of code from a BEGIN_TEXT/END_TEXT, BEGIN_HINT/END_HINT, or BEGIN_SOLUTION/END_SOLUTION block and returns a reference to a hash containing details of the elements found.

If any \{ ... \} blocks are found in the code, then the return hash will contain the key commands which will be a reference to an array of PPI::Document objects representing the Perl code within the \{ ... \} blocks found.

If a block within fails to parse, then the return hash will contain the key errors which is a reference to an array of errors that occurred.