[ragel-users] A scanner within a scanner?

Adrian Thurston thurston at complang.org
Sun Feb 15 17:07:26 UTC 2009


No you don't have to stash them. You can jump to a new scanner in a 
pattern action just fine. Once the pattern action is executed the 
machine is finished with these variables. Immediately after the action 
it will set tokstart = 0 but this is for the user's sake only. That is 
done so the user can tell if a token is active on the boundary between 
buffers.

One thing you can't do however, is return to, or jump into the middle of 
a pattern match. You shouldn't need to though. I can't think of a 
parsing problem that would require it. Just break scanner patterns on 
call boundaries and you should be fine.

-Adrian

Eric Brown wrote:
> Hi,
> 
> If I want a scanner inside a scanner, do I have to stash any variables  
> (like ts, te & act) while I'm in the inner scanner? If so, what do I  
> initialize the new ts, te & act variables to. Is there a cleaner way  
> of doing this than doing it manually in my action?
> 
> Cheers,
> Eric
> 
> 
> _______________________________________________
> ragel-users mailing list
> ragel-users at complang.org
> http://www.complang.org/mailman/listinfo/ragel-users




More information about the ragel-users mailing list