
I am writing a class that implements a simple parser. In the costructor I created the rule and the parser...and I recall the functions for the semantic actions. I have implemented this function as member funcions and, for recalled it, I use a pointer to my member function in this manner: #include <boost/spirit.hpp> using namespace boost::spirit; class MYParser { private: //main rules rule<const char*> rLine, rComment; //This are the “semantic action” void AnnounceComment(char const*, char const*); // ...and this is the pointer to my “semantic action” void (SQLParser::*ptrAnnounceComment)(char const*, char const*); public: MYParser(void); //distuttore ͠ MYParser(); }; MYParser::MYParser() { //(SQLParser::*ptrAnnounceComment)();// = &SQLParser::AnnounceComment; //AnnounceComment is my Member functions ptrAnnounceComment=&SQLParser::AnnounceComment; //make the parser rLine = rComment; rSpazi = *space_p; rTerminal = !ch_p(';'); //commento SQL fino a fine riga rComment = str_p("#") >> (*anychar_p)[ this->*ptrAnnounceComment ]; //... } I obtain an error: “no match for ‘operator[]’ in ‘boost::spirit::operator* [with S = boost::spirit::anychar_parser](((const boost::spirit::parser<boost::spirit::anychar_parser>&)((const boost::spirit::parser<boost::spirit::anychar_parser>*)(& boost::spirit::anychar_p))))[((SQLParser*)this)->*((SQLParser*)this)->SQLParser::ptrAnnounceComment]’” on the line: rComment = str_p("#") >> (*anychar_p)[ this->*ptrAnnounceComment ]; But..why? I have only a little experience with C++ and spirit :-( Ciao Claudio -- View this message in context: http://www.nabble.com/Spirit%2C-semantic-actions-and-C%2B%2B-classes-tp22267... Sent from the Boost - Dev mailing list archive at Nabble.com.
participants (1)
-
Claudio La Rosa