[ragel-users] Silly question

Adrian Thurston thurs... at cs.queensu.ca
Mon Mar 12 14:46:08 UTC 2007


You're right, Ragel doesn't support recursion since it works with regular
languages. Though it is possible to handle it using manual coding tricks. It
can be done using actions which increment and decrement a counter and then
jump to the appropriate place based on the current value. Look at the
processing of '{' and '}' in the ragel source for an example.

You can also use conditions to balance paretheses. Have a look at cond6.rl
for an example.


ralsina wrote:
> Hi,
> I am trying to use ragel to validate grammars defined in RFCs, and
> when doing a piece of RFC2822, I find this:
>     comment = '(' (FWS? ccontent)* FWS? ')';
>     ccontent = ctext | quoted_pair | comment;
> As you can see, each one depends on the other. This is illegal in
> ragel, right? Or is there a way around it?

More information about the ragel-users mailing list