Regex::Rewrite (found in languages/regex/lib) for generating code that requires Perl6-specific functionality.
Regex::Rewrite calls methods named
rewrite_X for every tree opcode
X generated by the parser or adapter.
Each rewrite method must return an array of list ops implementing the "operation"
- Shortcut for creating a new list op.
- Create a passthru op that inserts a PIR expression directly into the output stream.
- Create a new local variable.
Mainly just dispatches to P6C::IMCC::add_localvar,
but also make the variable unique.
- The intent is to create a variable that is local to the currently-being-rewritten rule match.
The reason why it can't just bounce over to the P6C routine is because we could generate multiple rule matches within one subroutine,
so we need to ensure that their local variables do not collide.
- Match a Perl6 string variable.
$atom is a Node corresponding to the string var to match (it will have $atom->var called on it.)
- Match a Perl6 array $array by doing an exact match on each element of the array.
defined in the superclass
- Call a subrule.
$rule is a