|parrotcode: Regex stack handling routines for Parrot|
|Contents | C|
src/rxstacks.c - Regex stack handling routines for Parrot
Same as regular stacks,
except they store only
INTVAL values and don't have cleanup routines.
IntStack intstack_new(Interp *interpreter)
INTVAL intstack_depth(Interp *interpreter, IntStack stack)
void intstack_push(Interp *interpreter, IntStack stack, INTVAL data)
dataonto the stack.
INTVAL intstack_pop(Interp *interpreter, IntStack stack)
void intstack_free(Interp *interpreter, IntStack stack)
The integer stack is fairly useless for a complete regex engine. It prevents reentrancy and complicates some of the trickier things that need to be done in regexes. We can drop it anytime, and instead use an integer-only array PMC instead. (Such a PMC exists and is called "intlist.pmc", and uses the same stack engine as the control, user, and pad stacks.)
I would remove the rxstack, but I didn't want to break the closest thing we have to a regex engine until I or someone else managed to release a different working implementation. The particular technique of using a single stack tied directly the interpreter is an evolutionary dead end, however. Good for a proof of concept, but that's it.