1

I have the following grammar:

#include <boost/spirit.hpp>

struct point_grammar
: public boost::spirit::grammar<point_grammar>
{
   template <typename Scanner>
   struct definition
   {
      boost::spirit::rule<Scanner> E, S, V;

      definition(const point_grammar &self)
      {
         using namespace boost::spirit;
         E = S >> V;
         S = '@' >> +(~ch_p('@') - V);
         V = str_p(".PV@") | str_p(".CV@");
      }

      const boost::spirit::rule<Scanner> &start()
                  {
         return E;
                  }
   };
};

When I compile, the compiler show me the following warning:

/usr/include/boost/spirit.hpp:18:4: warning: "This header is deprecated. Please use: boost/spirit/include/classic.hpp"

But when change the #include for boost/spirit/include/classic.hpp, I have the following error:

(expected template-name before ‘<’ token) in the line where is: : public boost::spirit::grammar.

What I can do it?

manuell
  • 7,528
  • 5
  • 31
  • 58

1 Answers1

5

You should upgrade to Spirit V2. I actually showed you how to do this in "Problems with grammar" :)
Seriously. Boost 1_36 was released August 14th 2008.

Now, the docs (http://boost-spirit.com/home/doc/) explain

To avoid namespace conflicts with the new Spirit V2 library we moved Spirit Classic into the namespace boost::spirit::classic. All references to the former namespace boost::spirit need to be adjusted as soon as the header names are corrected as described above. As an alternative you can define the preprocessor constant BOOST_SPIRIT_USE_OLD_NAMESPACE, which will force the Spirit Classic code to be in the namespace boost::spirit as before. This is not recommended, though, as it may result in naming clashes.

(source page: http://www.boost.org/doc/libs/1_55_0/libs/spirit/doc/html/spirit/what_s_new.html under "Classic")

So, you could continue using the same code if you update the namespace references.

Community
  • 1
  • 1
sehe
  • 374,641
  • 47
  • 450
  • 633