Boost
C++ Libraries
...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
This is an older version of Boost and was released in 2022. The current version is 1.89.0.
Parsers in Spirit are fully
attributed. Spirit.X3 parsers always expose
an attribute specific to their type. This is called synthesized
attribute as it is returned from a successful match representing
the matched input sequence. For instance, numeric parsers, such as int_ or double_,
return the int or double value converted from the matched input
sequence. Other primitive parser components have other intuitive attribute
types, such as for instance int_
which has int, or ascii::char_ which has char.
Primitive parsers apply the normal C++ convertibility rules: you can use
any C++ type to receive the parsed value as long as the attribute type of
the parser is convertible to the type provided. The following example shows
how a synthesized parser attribute (the int
value) is extracted by calling the API function x3::parse:
int value = 0; std::string str("123"); std::string::iterator strbegin = str.begin(); x3::parse(strbegin, str.end(), int_, value); // value == 123
For a full list of available parser primitives and their attribute types please see the sections X3 Parsers.