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

Iñaki Baz Castillo ibc at aliax.net
Fri Dec 4 23:55:57 UTC 2009


Hi, I have a simple grammar:

  pchar     = ALPHA | DIGIT | ("%" HEXDIG HEXDIG);
  L_BRACKET = "%5b";
  node_name = ( pchar )+ -- L_BRACKET
  step      = node_name %command L_BRACKET ..... 

As you can see, when parsing "step" Ragel calls "command" action when 
L_BRACKET is detected. However, if any other hex-escaped appears into 
node_name then Ragel runs "command" action and then continues still into 
"node_name".

This is: when Ragel is parsing "node_name" and founds "%" (even if it's "%99" 
rather than "%5b") then it runs "command" action. I expected that Ragel 
wouldn't run the leaving action as it remains into node_name.

Why doe Ragel run the % leaving action when finding "%"? perhaps because Ragel 
must take the decision per byte without reading more than one byte?
If so, is there any way to avoid "command" action being called several times 
for the same node_name?

To clarify: if "step" is:
  qqq%00www%11eee%5bzzz

then Ragel calls "command" action 3 times (each times it finds "%").

Thanks for any help.


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




More information about the ragel-users mailing list