Boost logo

Boost Users :

From: Larry Knain (yg-boost-users_at_[hidden])
Date: 2003-08-29 16:53:41


I should have said that this was a first attempt at using Spirit and I was just experimenting
with some simple examples.

 There are three examples in the code. The adjustment was made to the second example which is for CSV. The string to
be parsed was originally:

char const *plist_csv = "\"string\",\"string with an embedded \\\"\","
        "12345,0.12345e4";
Changed to:

char const *plist_csv = "\"string\",\"string with an embedded \\\"\","
        "12345,0.12345e4,,2";
These are at line 104.

The original parser line was:

 list_csv_item =
            confix_p('\"', *c_escape_ch_p, '\"')
        | longest_d[real_p | int_p]
        ;
Again, I expected the null item to be omitted from my experience with the tokenizer code but
I didn't expect the 2 to be omitted. After the initial failure I changed the line to:

 list_csv_item =
            confix_p('\"', *c_escape_ch_p, '\"')
        | longest_d[real_p | int_p|~anychar_p]
        ;

It made no difference. Inserting \"\" between the two commas preceding the 2 did make it
get the "null" token and the 2.

HartmutKaiser_at_[hidden] wrote:

> Larry wrote:
>
> > From boost-1.30.2 I built the list_parser.cpp example using
> > MSVC++7.1.
> > In the CSV list I added ",,2" to the end of the line to be
> > parsed.
>
> Could you please be more specific, where did you added the ",,2" ?
>
> > The
> > program ran but the neither of the added elements were included in the
> > output vector. Having used the tokenizer before I know it will
> > generally gobble up adjacent delimiters without any output.
> > You can get
> > the empty token if you ask for the delimiters as well and then just
> > discard the delimiters (sort of). But I was surprised that
> > the 2 didn't
> > make it to the output vector. I expected the empty list entry
> > would not
> > make the output vector. I tried adding ~anychar_p to the rule
> > but that
> > didn't help. If I change the input list to add ",\"\",2" I
> > get "" and 2
> > in the output vector. Applications like spreadsheets do not
> > put missing
> > column values for numeric columns as "" items generally. Maybe I am
> > missing something because it certainly isn't the behavior I
> > would expect
> > (either from the parser or the tokenizer).
>
> Please post a small (minimal) sample, which exposes the behaviour in
> question. This helps us to spot the problem.
>
> Regards
> Hartmut
>
> BTW: Spirit has its own mailing list:
>
> Spirit-general_at_[hidden]
> https://lists.sourceforge.net/lists/listinfo/spirit-general
>
> Please post further questions there. Thanks.
>
>
> Info: <http://www.boost.org>
> Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
> Unsubscribe: <mailto:boost-users-unsubscribe_at_[hidden]>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net