[ragel-users] Breaking out of a scanner

Matthieu Tourne matthieu.tourne at gmail.com
Sun Feb 21 13:48:54 PST 2010


Is there a good way to convert a scanner grammar to a plain state machine
grammar ?

I'm actually not using ts for backtracking at buffer boundaries. The data I
receive is split in non contiguous buffers, and I want to avoid
re-allocating space and copying data over from previous buffers, for
performance reasons.

Thanks,

Matthieu.

On Feb 21, 2010 12:06 PM, "Adrian Thurston" <thurston at complang.org> wrote:

I would just set ts = 0 before breaking out. Usually the code I use to
manage the buffer when tokens cross buffer boundaries starts with

if ( ts != 0 ) {

}

The idea is that if no token is currently being matched (true when the
buffer actually ends on a token boundary) then there is nothing to do.

It might make sense for ragel to do that automatically, but I don't like
that because it rules out the possibility of making use of ts for the times
when it is actually wanted.

-Adrian

Matthieu Tourne wrote:

> >
> > I have a scanner, that if an optional final state is reached can be
> simplified to accept any inp...
> ------------------------------------------------------------------------
>
> _______________________________________________
> ragel-users mailing list
> ragel-users at complang.org
> http://www.complang.org/mailman/listinfo/ragel-users
>

_______________________________________________
ragel-users mailing list
ragel-users at complang.org
http://www.complang.org/mailman/listinfo/ragel-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.complang.org/pipermail/ragel-users/attachments/20100221/abc23ab4/attachment-0001.html>


More information about the ragel-users mailing list