boost::Spirit Grammar for unsorted schema

Posted by Hassan Syed on Stack Overflow See other posts from Stack Overflow or by Hassan Syed
Published on 2010-02-02T09:46:59Z Indexed on 2010/05/09 6:18 UTC
Read the original article Hit count: 357

I have a section of a schema for a model that I need to parse. Lets say it looks like the following.

{
  type = "Standard";
  hostname="x.y.z";
  port="123";
}

The properties are:

  1. The elements may appear unordered.
  2. All elements that are part of the schema must appear, and no other.
  3. All of the elements' synthesised attributes go into a struct.
  4. (optional) The schema might in the future depend on the type field -- i.e., different fields based on type -- however I am not concerned about this at the moment.

© Stack Overflow or respective owner

Related posts about boost-spirit

Related posts about recursive-descent