P6C::IMCC::ExtRegex::CodeGen
Subclass of 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.
(see P6C::IMCC::ExtRegex::Adapter).
Each rewrite method must return an array of list ops implementing the "operation" X
.
- lop
- Shortcut for creating a new list op.
- otherop
- Create a passthru op that inserts a PIR expression directly into the output stream.
- new_local
- Create a new local variable.
Mainly just dispatches to P6C::IMCC::add_localvar,
but also make the variable unique.
Uniquer.
Um...
something.
- 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.
- rewrite_string
- Match a Perl6 string variable.
$atom is a Node corresponding to the string var to match (it will have $atom->var called on it.)
- rewrite_array_literal
- Match a Perl6 array $array by doing an exact match on each element of the array.
Uses rewrite_dynamic_alternate,
defined in the superclass
Regex::Rewrite
.
- rewrite_call
- Call a subrule.
$rule is a
P6C::rx_call
.