
Andrzej Krzemienski wrote:
I want to parse numbers separated by "new-lines", however, on my windows system, a "new-line" is represented by two consecutive characters: 13, 10 (or in other words by string "\n\r"). So, only if I encounter a sequence of these two chars do I want to cut the token.
Spirit.Qi would do that handily. Something like this should work: namespace qi = boost::spirit::qi; std::vector<int> data; qi::phrase_parse(input.begin(), input.end(), qi::int_, qi::eol, data);
Thanks for the reply. And could I ask a similar question? I wanted to simplify my real task to make it shorter and clearer to understand, and it look like I changed it to a different one. My apologies. My real task is to check if the data in Windows clip-board is a column of data (copied from a grid or table). Such a column is just text separated with "\n\r" sequences. So, for example these are valid data: "12" - a column of height 1 with data "12", " a\n\r b" - a column of height 2 with two with data " a" and " b" "-1\n\r\n\r3" - a column of height 3 with datum "-1", empty cell, and datum "3". The spirit solution above will skip the empty cell in my third example. On the other hand, I do need the information about empty cells too. It really looks more like a tokenizing task. Or is there a way to do it easily in Spirit? Regards, &rzej