realworldocaml / examples

All the examples in Real World OCaml
The Unlicense
376 stars 81 forks source link

Error in rule `rev_object_fields`—leading comma required for JSON objects #29

Open keleshev opened 9 years ago

keleshev commented 9 years ago

The following example seems to have an error:

object_fields: obj = rev_object_fields { List.rev obj };

rev_object_fields:
  | (* empty *) { [] }
  | obj = rev_object_fields; COMMA; k = ID; COLON; v = value
    { (k, v) :: obj }
  ;

It only parses JSON objects with leading comma, like: {,"foo": "bar"}.