I am trying to parse an object where the order of the attributes doesn't matter.
For example, parsing an employee
employee {surname = "doe", firstname = "john", age = 30}
should be the same as
employee {age = 30, firstname = "john", surname = "doe"}
Ideally, my rule should be something like (not against the lack of a formal definition)
unordered_rule %= lit("employee") >> "{"
>> kwd("surname")["=" > quoted_string]
/ kwd("age")["=" > int_]
/ kwd("firstname")["=" > quoted_string]
/ kwd("age")["=" > int] >> "}";
But first, how do I include separator commas in a parsing rule? And for my C ++ structure struct employee { std::string firstname; ... int age; }, is there an order of attributes or how to increase the value, which keyword matches that attribute, even after the structure has been converted to a merge vector?
It really doesn't work for me even after reading the documentation for the keyword list operators.