Ryan Molden | 7 Nov 18:03
Picon

Fields of type lex::char_

Sorry if this is duplicated, I originally sent it two days ago but I never saw it appear back in my inbox as a list message (I actually haven't seen *any* messages to this list yet...is it still active?), nor have I seen any follow-up, so I thought I would send it again in case I hadn't been properly registered as one allowed to send mail when I sent it the first time.

I am having some problems having fields on my lexer of type lex::char_, specifically I get the following errors in Visual Studio 2010 SP1 with Boost 1.47
 
C2146: syntax error : missing ';' before identifier 'simple'
C2886: 'boost::spirit::standard::char_' : symbol cannot be used in a member using-declaration
C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C2146: syntax error : missing ';' before identifier 'simple'
C2886: 'boost::spirit::standard::char_' : symbol cannot be used in a member using-declaration
C4430: missing type specifier - int assumed. Note: C++ does not support default-int
 
This is with the following simplified repro
 
#include <boost/spirit/include/lex_lexertl.hpp>
 
namespace lex = boost::spirit::lex;
 
template <typename Lexer>
struct lexer : lex::lexer<Lexer>
{
    lexer()
    {
        simple = lex::char_('.');
        this->self += simple;
 
        //This works, but I need/want to store the char_ object so I can later reference its token ID from the parser level:
        //this->self += lex::char_('.');
        //
        //as does this (though in my real lexer I have LOTS of token_defs and as I add more the compile time gets worse and worse):
        //
        //this->self += lex::token_def<>('.');
    }
    lex::char_ simple;
};
 
struct token_processor
{
    template <typename Token>
    bool operator()(Token const& t) const
    {
        return true;
    }
};
 
int main(int argc, char**argv[])
{
    std::string str (".");
    char const* first = str.c_str();
    char const* last = &first[str.size()];
 
    lexer<lex::lexertl::actor_lexer<> > l;
    bool r = lex::tokenize(first, last, l, token_processor());
    
    return 0;
}
 
Is this a Visual Studio 'issue' or something I am doing wrong?
 
Ryan
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Spirit-devel mailing list
Spirit-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spirit-devel

Gmane