P6Regex - compiler and parser for Perl 6 regex

compile_p6regex(PMC source, PMC adverbs :slurpy :named)

Return the result of compiling source according to Perl 6 regex syntax and the associated adverbs. Normally this function is obtained using compreg 'PGE::P6Regex' instead of calling it directly.

Returns the compiled regular expression. If a target named parameter is supplied, then it will return the parse tree (target='parse'), the expression tree (target='exp'), or the resulting PIR code (target='PIR').

regex(PMC mob, PMC adverbs :slurpy :named)

Parses a regex according to Perl 6 regex syntax, and returns the corresponding parse tree. This is installed as a <regex> rule in PGE::Grammar, so one can call it from another regex to parse valid Perl 6 regular expressions.


Initializes the P6Regex parser and other data structures needed for compiling regexes.

parse_term(PMC mob [, PMC adverbs :slurpy :named])

Parses literal strings and whitespace. Return a failed match if the stoptoken is found.

parse_term_ws(PMC mob)

Parses a whitespace term.

parse_quant(PMC mob)

Parses a quantifier, such as *, +, ?, :, and all of their wonderous combinations.

parse_dollar(PMC mob)

Parse things that begin with a dollar sign, such as scalars, anchors, and match subscripts.

parse_subrule(PMC mob)

Parses a subrule token.

parse_enumcharlist(PMC mob)

Extract an enumerated character list.


Parse a modifier.

Functions ^

PIR_closure(string code)

This helper function helps with :lang(PIR) closures in rules by adding a ".sub" wrapper around the code if one isn't already present.