Boost logo

Boost :

Subject: Re: [boost] [spirit]
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-06-04 15:35:24


Chandrashekhar Kumar wrote:
> Hi,
>
> I have to parse the file, the contents of which(with a header) is below and
> stuff the double part only to std::vector<double>:
>
> "A","B","C","D"
> 1,2,3,4
> 5,6.7,8
> ........
>
> <snip>
> bool
> parse_numbers(char const* str, vector<double>& v)
> {
> return parse(str,
>
> // Begin grammar
> (
> real_p[push_back_a(v)] >> *(',' >> real_p[push_back_a(v)])
> )
> ,
> // End grammar
>
> space_p).full;
> }
> <snip>
>
> But after running it, I am getting the result as "Parsing failed".
>
> I am going thru the doc to understand it better, but any quick spot will
> help me immensely.
>

The string that you are parsing begins "A","B","C",...

Naturally, it doesn't match a grammar that parses a
list of numbers.

In Christ,
Steven Watanabe


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk