2013/11/1 beet <r.berlich@gemfony.eu>
Dear all,

For all of the following, please see the attached test-case.

I would like to specify certain characterstics of variables in the
following way: d(MY_DPAR_01,-10.3,12.8,100) . So in this case there is a
type-identifyer (d stands for "double") and then, in parantheses, a
variable name (or alternatively an index), a lower and upper boundary
and some integer parameter. What is contained in the list depends on the
parameter type.

It should then be possible to specify any number of variables, including
their properties, in a comma-separated list.

So I need to dissect a string like the following:

"d(MY_DPAR_01,-10.3,12.8,100), d(0,-10.3,12.8,100), i(SOME_IPAR_17,
0,5), b(SOME_BPAR)"

The first step, as I see it, is to seperate the "outer" list and to
store each variable description in a boost::tuple<char, std::string>,
where the char holds the type identifier and the std::string the part
inside the parantheses. Then, in the second step, I want to parse that
string according to what is expected for this particular type.

I have now run into the problem that the following rule in Boost.Spirit
"swallows" all non-alphanumeric characters.

qi::rule<std::string::const_iterator, std::string(), ascii::space_type>
varSpec = +(alnum | '_' | ',' | '.' | '+' | '-');

Note '_' is actually qi::lit('_'), which exposes *no* attribute, unlike qi::char_ (and qi::alnum, etc) which gives you a char.
I'd suggest +qi::char_("a-zA-Z0-9_,.+-") for varSpec.


HTH