[ragel-users] Exit action

Eric Brown yogieric at mac.com
Tue Feb 23 10:50:25 PST 2010


Hi Adrian,

Thanks. I'd missed the longest-match kleene star documentation.

Sorry if this is a stupid question -- I'm looking for the best of both worlds. How do I get a longest-match kleene star machine to start over if there is an error?

For example, a document of "mailto:email1 at x ... mailto:email2 at y ... mailto:invalid_email ... mailto:email4 at z" will find the first two but will exit on the third invalid_email when I really want it to keep going and find email4 at z.

Thanks,
Eric

On Feb 21, 2010, at 11:42 , Adrian Thurston wrote:

> Use:
> 
> mail := (any | mailto)**;
> 
> For the answer why, please see chapter four of the manual.
> 
> Regards,
> Adrian
> 
> 
> 
> Eric Brown wrote:
>> If I have two ORed machines, is there a leaving action I can get when a machine is finally exiting?
>> For example, I believe this is a simplified form of my parser:
>> host = [A-Za-z0-9\-.]+;
>> mailto = (/mailto:/i sender_chars+ '@' (host %mailto_end)) $mailto;
>> mail := (any | mailto)*;
>> The %mailto_end will get executed on every single character of host. I just want it to pick up the last character of host. Is there a way?
>> Cheers,
>> Eric
>> _______________________________________________
>> 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





More information about the ragel-users mailing list