ragel icon indicating copy to clipboard operation
ragel copied to clipboard

Add stack handling

Open db47h opened this issue 6 years ago • 2 comments

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

db47h avatar Sep 24 '18 13:09 db47h

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...

db47h avatar Sep 24 '18 13:09 db47h

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.

db47h avatar Sep 24 '18 14:09 db47h