Boost logo

Boost Users :

Subject: [Boost-users] [spirit] Parsing std::string phrase into attribute struct
From: Michael Powell (mwpowellhtx_at_[hidden])
Date: 2013-09-01 14:36:34


Hello,

Question re: parsing string into a Fusion-adapted struct.

First, magic! Wow, I like it.

Question about the immediate result, true/false.

Let's say the operation fails for whatever reason. In our use-case,
we'll be reading some text in from a Linux /sysfs -provided API. We'll
parse the contents into a struct instance.

If the operation fails for whatever reason, does not match the
grammar, are any values mapped into the structure? My first guess, is
possibly: a partial (though still failing) match, would partially
populate the instance?

I am using the employee-example as our boiler plate.

http://www.boost.org/doc/libs/1_54_0/libs/spirit/example/qi/employee.cpp

The outcome of which would be whether to consider the instance valid
for reporting further into user-space, or what else to do with the
outcome from there.

Thank you...

Regards,

Michael Powell


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net