I should point out that I haven't optimized find_o out for readability purposes, and that in "real life", this would look like:start: exactf "f", find_o advance quit goto start find_o: # non-greedy, by the way goto find_bar find_o_real: exactf "o", find_o goto start find_bar: exactf "bar", done goto find_o_real done: end quit: fail
This feels like drawing a DFA... honestly. I'm not sure where save and restore are going to come into play in this particular example -- it seems not at all.start: exactf "f", find_bar advance quit goto start find_o_real: exactf "o", find_bar goto start find_bar: exactf "bar", done goto find_o_real done: end quit: fail
_____________________________________________________
Jeff[japhy]Pinyan:
Perl,
regex,
and perl
hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;
In reply to Re: Re: Re: Flattening REs into opcodes for Perl 6
by japhy
in thread Flattening REs into opcodes for Perl 6
by BrentDax
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |