[ragel-users] How to avoid % action being called when the match continues?

Iñaki Baz Castillo ibc at aliax.net
Mon Dec 7 14:49:17 UTC 2009


El Lunes, 7 de Diciembre de 2009, Adrian Thurston escribió:
> When the '%' is seen it is unknown whether ragel is trying to parse more
> of node name, or the start of L_BRACKET. Since it can't know, it does
> both. Refactor like this:
> 
> step      = node_name L_BRACKET @command .....
> 
> Now when command is called, it is no longer unclear what is being
> parsed. The node_name is ended.

Thanks, that makes sense but it's not 100% valid for me as I've more kind of 
valid "speps":

step1     = node_name
step2     = node_name L_BRACKET position R_BRACKET
step3     = node_name L_BRACKET attr R_BRACKET L_BRACKET position R_BRACKET
step      = step1 | step2 | step3

The separator after any step could be "/" or eof, so it wouldn't be very 
ellegant if I must inspect the remaining char (or chars as L_BRACKET) to 
decide where "node_name" ends.

However I already resolved it by adding a "sempaphore".

Thanks a lot.

-- 
Iñaki Baz Castillo <ibc at aliax.net>




More information about the ragel-users mailing list