Fields of type lex::char_

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Fields of type lex::char_

Ryan Molden
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-devel
Reply | Threaded
Open this post in threaded view
|

Re: Fields of type lex::char_

Joel de Guzman-2
On 11/8/2011 1:03 AM, Ryan Molden wrote:
> 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.

Pardon the delay. The list is still active but is somehow superseded
by the Spirit IRC channel where dev related discussions happen.
I'll get back to you later. Right now, I'm typing this in a small
netbook and don't have access to the code.

Regards,
--
Joel de Guzman
http://www.boostpro.com
http://spirit.sf.net


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Spirit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-devel