Boost logo

Boost :

From: Michael Burbidge (mburbidg_at_[hidden])
Date: 2003-09-13 19:34:37


I'm trying to control how tree generation happens for a typical comma
separated list of integers which represent an argument list for a
c-style language. Here's my rule for argument list:

                        
                        argument_list
                                = integer_literal >> *(discard_node_d[ch_p(',')] >> argument_list)
                                ;

This generates a tree of the following form, for the following argument
list 23,24,54,1:

        argument_list_id
                integer_literal_id(23)
                argument_list_i
                        integer_literal_id(24)
                                argument_list_id
                                        integer_literal_id(54)
                                        integer_literal_id(1)

This is pretty inconvenient to deal with. I would rather that the
intermediate argument lists be collapsed so that the tree looked like:

        argument_list_id
                integer_literal_id(23)
                integer_literal_id(24)
                integer_literal_id(54)
                integer_literal_id(1)

Is there some way that I can get this result using the node directives?

Thanks,
Michael-


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