Boost logo

Boost :

From: Felipe Magno de Almeida (felipe.m.almeida_at_[hidden])
Date: 2008-04-17 10:51:05


Hi,

I'm trying to use spirit2, first, I downloaded boost 1.35.0 release from
https://svn.boost.org/svn/boost/branches/release

Then I downloaded spirit2 from
https://spirit.svn.sourceforge.net/svnroot/spirit/trunk/final

Tried to use it. It gave me lots of errors, so I downloaded proto
from https://svn.boost.org/svn/boost/branches/proto/v3 and replaced
the boost/xpressive/proto directory.
It worked, except that when compiling example 6 from the lexer, it chokes
on a lot of places:

template <typename Lexer>
struct example6_tokens : lexer_def<Lexer>
{
    typedef typename Lexer::token_set token_set;

    template <typename Self>
    void def (Self& self)
    {
        identifier = "[a-zA-Z_][a-zA-Z0-9_]*";
        constant = "[0-9]+";

        white_space
            = token_def<>("[ \\t\\n]+")
            | "\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\/"
            ;

        self = token_def<>('(') | ')' | '{' | '}' | '=' | ';'; // This
chokes with conversion loses qualifiers

        self.add
            (constant, ID_CONSTANT) // This too
            ("if", ID_IF)
            ("else", ID_ELSE)
            ("while", ID_WHILE)
            (identifier, ID_IDENTIFIER) // This too
        ;

        self("WS") = white_space; // This chokes with other different errors.
    }

    token_def<std::string> identifier;
    token_def<unsigned int> constant;

    token_set white_space;
};

They give these errors:

D:\development\new_boost\last_svn_spirit2\boost/fusion/container/list/cons.hpp(82)
: error C2440: 'initializing' : cannot convert from 'const
boost::spirit::lex::terminal_holder<T,Terminal>' to
'boost::spirit::lex::terminal_holder<T,Terminal> &'
        with
        [
            T=boost::spirit::lex::token_def<> *,
            Terminal=boost::spirit::lex::token_def<>
        ]
        Conversion loses qualifiers
        D:\development\new_boost\last_svn_spirit2\boost/type_traits/is_convertible.hpp(257)
: see reference to function template instantiation
'boost::fusion::cons<Car,Cdr>::cons<T,boost::fusion::nil>(const
boost::fusion::cons<T,Cdr> &)' being compiled
        with
        [
            Car=boost::spirit::lex::terminal_holder<boost::spirit::lex::token_def<>
*,boost::spirit::lex::token_def<>> &,
            Cdr=boost::fusion::nil,
            T=const
boost::spirit::lex::terminal_holder<boost::spirit::lex::token_def<>
*,boost::spirit::lex::token_def<>>
        ]
        D:\development\new_boost\last_svn_spirit2\boost/type_traits/is_convertible.hpp(289)
: see reference to class template instantiation
'boost::detail::is_convertible_basic_impl<From,To>' being compiled
        with
        [
            From=boost::fusion::cons<boost::spirit::lex::terminal_holder<boost::spirit::lex::token_def<>
*,boost::spirit::lex::token_def<>>,boost::fusion::nil> &,
            To=boost::fusion::cons<boost::spirit::lex::terminal_holder<boost::spirit::lex::token_def<>
*,boost::spirit::lex::token_def<>> &,boost::fusion::nil>
        ]
        D:\development\new_boost\last_svn_spirit2\boost/type_traits/is_convertible.hpp(366)
: see reference to class template instantiation
'boost::detail::is_convertible_impl<From,To>' being compiled
        with
        [
            From=boost::fusion::cons<boost::spirit::lex::terminal_holder<boost::spirit::lex::token_def<>
*,boost::spirit::lex::token_def<>>,boost::fusion::nil>,
            To=boost::fusion::cons<boost::spirit::lex::terminal_holder<boost::spirit::lex::token_def<>
*,boost::spirit::lex::token_def<>> &,boost::fusion::nil>
        ]

And goes on.
How should I proceed?

Regards,

-- 
Felipe Magno de Almeida

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