Like this:

error_handler := any* :>> '\n' @{fgoto main;};

main := whatever $!{fgoto error_handler;};

-Adrian

Julian Morrison wrote:
> It certainly does help, thanks.
> 
> OK, next, I wasn't able to figure out how to do an error recovery. That 
> is, when one of the (line*) starts to match, then fails, the error 
> action should log the error, jump to another regex that matches (any*) 
> :>> '\n', jump back and pick right back up trying to match more lines. 
> It's plainly obvious that Ragel can do that, but the wizardry level is a 
> bit above me. Please elucidate?
> 
> 2009/1/23 Adrian Thurston <[email protected] 
> <mailto:[email protected]>>
> 
>     In short, there isn't!
> 
>     Ragel does not make any assumption about the input, and this includes
>     not assuming line-based input. If you want to anchor to something you
>     just put that something into the grammar at the end. If you want to see
>     if the machine finished in a final state (and thus consumed that
>     something) you test cs against machine_first_final.
> 
>     Hope this helps,
>      Adrian
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> 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

Reply via email to