I've tried that without much success, I have a union with all my scanner
patterns, wrapped in ()**.
I have also replaced all the => { do_stuff(); } in the scanner with @{
do_stuff(); } for each pattern.So, I'm back to using a scanner construction, but resetting the backtracking in between buffers, and it seems to work fine. Are there any concerns with doing something like that ? Thanks, Matthieu. On Sun, Feb 21, 2010 at 2:18 PM, Adrian Thurston <[email protected]>wrote: > If you don't want any backtracking you can union all the scanner patterns, > then wrap them in ( )**. Note using ** and not * is critical. > > -Adrian > > Matthieu Tourne wrote: > >> 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" <[email protected]<mailto: >>> [email protected]>> 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 >>> [email protected] <mailto:[email protected]> >>> >>> http://www.complang.org/mailman/listinfo/ragel-users >>> >>> >>> _______________________________________________ >>> ragel-users mailing list >>> [email protected] <mailto:[email protected]> >>> >>> http://www.complang.org/mailman/listinfo/ragel-users >>> >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> ragel-users mailing list >> [email protected] >> http://www.complang.org/mailman/listinfo/ragel-users >> > > _______________________________________________ > ragel-users mailing list > [email protected] > http://www.complang.org/mailman/listinfo/ragel-users > -- Matthieu Tourne
_______________________________________________ ragel-users mailing list [email protected] http://www.complang.org/mailman/listinfo/ragel-users
