Discussion:
[ragel-users] Best way to use error conditions
Peter Gervais
2012-10-27 19:24:31 UTC
Permalink
I need to parse an input set of characters with the following results :
If char = 'a' goto next state else call error
This logic would be used for every character in the string. The intent is to show exactly where the failure has occurred on the input string versus the expected string.
Ideally the error call could have a parameter such as an offset to indicate where within the string the match failed.
Any ideas would be greatly appreciated.

Pete Gervais



Sent from my iPhone
Adrian Thurston
2012-11-01 00:48:03 UTC
Permalink
Post by Peter Gervais
If char = 'a' goto next state else call error
You can do this by intersecting with 'm'.

action a { if ( !foo ) error(); }
Post by Peter Gervais
This logic would be used for every character in the string. The intent is to show exactly where the failure has occurred on the input string versus the expected string.
Ideally the error call could have a parameter such as an offset to indicate where within the string the match failed.
Any ideas would be greatly appreciated.
Also, you may want to use an error action.

-Adrian

Loading...