Advice on detecting errors

Manoj Rajagopalan ma... at nanorex.com
Fri Mar 28 13:34:44 UTC 2008


Hi all,

   I have two questions.

QUESTION 1:
    I'm not clear on how to detect syntax errors in Ragel. As a simple 
example, if I want allow a statement:

    set <name> = <value>;

for which my pattern would be something like:

    set_stmt = space*  'set'  (alpha alnum*) space* '=' space* digit+ 
space* ';'

and if I provide input like

    set var = 123bad;

How can I get Ragel to point out a syntax error here?



QUESTION 2:
If I set up a scanner with a list of allowed expressions and ragel 
encounters an expression that is not on the list, what does it do? Is it 
possible to create a 'trap' pattern to output an unrecognized or badly 
formed input?


Thanks,
Manoj



More information about the ragel-users mailing list