Discussion:
[ragel-users] The best way to stop and force error state?
Ivan Ristić
2013-11-22 11:12:52 UTC
Permalink
What is the best way to stop the parser from within an action and force
the error state at the same time?

At the moment I am doing this:

%%machine foo

action bar {
do_some_work();
if (error) {
fnext *foo_error;
fbreak;
}
}

I was expecting something like:

action bar {
do_some_work();
if (error) ferror;
}

I like this because it's succinct and does not reference the machine
error state (which simplifies the code reduces the chance of mistakes in
the copy & paste scenarios).
--
Ivan
Adrian Thurston
2013-11-24 19:25:04 UTC
Permalink
Hi Ivan, this is noted in issues/3.txt.
Post by Ivan Ristić
What is the best way to stop the parser from within an action and force
the error state at the same time?
%%machine foo
action bar {
do_some_work();
if (error) {
fnext *foo_error;
fbreak;
}
}
action bar {
do_some_work();
if (error) ferror;
}
I like this because it's succinct and does not reference the machine
error state (which simplifies the code reduces the chance of mistakes in
the copy & paste scenarios).
Loading...