ragel
ragel copied to clipboard
Add stack handling
The current implementation does allow fcall out-of-the-box. Need to add stack
and top
.
Time for a v3 and rethink SaveVars
/GetVars
?
EDIT: stack handling can be implemented via a custom ragel.Interface
Or do something like:
type stub []int
func (s *stub) Run(s *ragel.State, p, pe, eof int) (int, int) {
// ...
top = len(*s)
// ...
*s = (*s)[:top]
}
EDIT: this requires using prepush
postpop
...
Another thing to consider is that the driver API should limit itself to the variables it needs for proper operation: We don't care about the call stack, nor act
.
In fact, act
should be removed from the API and the documentation updated to provide examples for extended implementations of ragel.Interface
with support for act
and a call stack.