|
Boost : |
Subject: Re: [boost] [spirit]
From: Thomas Klimpel (Thomas.Klimpel_at_[hidden])
Date: 2009-06-05 05:34:06
Chandrashekhar Kumar wrote:
> But it is not working for the below as well:
>
> 1.0,2.0,3.0,4.0
> 5.0,6.0,7.0,8.0
The question why this doesn't work can be simplified to the question why
bool matches =
parse ("1.0,2.0,3.0,4.0\n5.0,6.0,7.0,8.0",
real_p >> *(',' >> real_p)
, space_p).full;
will result in matches being "false".
I think the reason is that the skip parser "space_p" will eat the "\n" between "4.0" and "5.0", but it will not insert a ','. A potential solution might be to make ',' optional by writing !',':
bool matches =
parse ("1.0,2.0,3.0,4.0\n5.0,6.0,7.0,8.0",
real_p >> *(!',' >> real_p)
, space_p).full;
will probably result in matches being "true".
Regards,
Thomas
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk