[ragel-users] Re: Problematic machine specification

Matt Mower matt.mo... at gmail.com
Tue Jan 2 13:04:58 UTC 2007


Hi Adrian,

Thanks for your reply.

On 01/01/07, Adrian Thurston <thurs... at cs.queensu.ca> wrote:
> I noticed a couple spots to fix. Since the line machine is given with
> the + operator it requires at least one character. Use * instead and
> empty lines (following +/- etc) will be accepted.
>

Yes, done that, thanks.

> The 'print' builtin machine does not accept tabs, so any diff with tabs
> will fail.
>

That was my major sin. I had just blindly internalized the assumption
that it would and this was throwing off the scanner. It became obvious
once I figured out to print *p when I detected the error state.

> When the machine hits an error it transitions into the error state and
> then breaks out of the loop from there. Look at p[-1] after the loop to
> see on what character the error occurred. Alternatively you can embed an
> error action and look at p[0] from within the action.
>
> If you want to see the state that the error occurred in you'll need to
> embed an error action and look at fcurs (this is macro rewritten by ragel).
>

That's very useful. Zed pointed me to the docs on error actions but I
wasn't able to take it in because I was grappling with everything else
as well. I'm figuring the actions out better now (making use of enter
as well as exit actions) so I'll go back over the guide now that I
have the basic scanner working.

Thanks again & Happy New Year to you too!

Regards,

Matt



More information about the ragel-users mailing list