Basic parser question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
K M
Reply | Threaded
Open this post in threaded view
|

Basic parser question

K M
Hi,
 
i'm am making a simple parser to parse a string passed to a function.
to be direct here is an example:
"unsigned int _cdecl MyFunction(unsigned int, bool)"
 
example output: (console)
*stored in a vector for example
=============
unsigned int
_cdecl
MyFunction
unsigned int
bool
 
i've tried to modify the number_list.cpp example from BOOST.Spirit website, change it to something like:
 
 
bool
parse_text(char const* str, vector<const char*>& v)
{
    return parse(str,
        //  Begin grammar
        (
            alpha_p[push_back_a(v)] >> *(',' >> alpha_p[push_back_a(v)])
        )
        ,
        //  End grammar
        space_p).full;
}
I get error with this code...
 
I think what i need to do first is to create a STRING parser comma delimited.
Also how about storing the string to a vector, since push_back_a doesn't work out...
 
How do i do that?
 
Thanks.