Hi list !

I am sure this question has been answered a thousand times, but I
could not find the list archives (all pages from google point to
"group not found").

Anyway: I am implementing a json like parser and want to use recursion:

This is what I want to parse:
"{ url:'foo' opts:{ bar:4.5 }}"

To cope with the hash in the hash, I want to open a new parser after each key:

"{ url:" ===> new parser with "'foo' opts:{ bar:4.5 }}", returns
number of eaten chars

I then want to update the position of *p. This is the code:

action hash_value {
  p++;
  p += tmp_val.from_string(p);
  tmp_h.set(key, tmp_val);
  key = "";
}

My problem: closing '}' is not parsed correctly and then "@hash" is
never executed.

Regex:
  ...
  hash      = '{' (ws* string ':' >hash_value)* ws* '}';
  main     := ws* (string @string | number @number | hash @hash);

Many thanks for your help !

Gaspard

_______________________________________________
ragel-users mailing list
[email protected]
http://www.complang.org/mailman/listinfo/ragel-users

Reply via email to