SV: Newbie: Need help designing simple rule

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

SV: Newbie: Need help designing simple rule

Daniel Lidström
Carl Barron scribbled:

>   after reading this again your code might work if the skipper in your
> parse function call is blank_p instead of space_p. Space_p
> eats the end
> of
> line indicator ['\n'].   If you have a file of these lines
> I'd read the
> file line by line
> using std::getline() [the free function in <string> ] to read
> each line
> one at a time,
> The parse the line producing the results in a vector<double>.
> To do this
> easily I recommend using a struct derived from grammar<...>.
> This struct
> can use a reference to the actual vector used. then if the
> parse parses
> the
> whole line you can process your data from this vector.  Also spirit
> provides some common semantic functors one of which is push_back_a
> which will push the result into an STL container supporting push_back.
> the following grammar uses repeat_p to loop according to the above
> statement of the problem:
[snip]

Thank you for your help Carl! Your comments are really helpful.

/Daniel


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general