title: expected unqualified-id before 'namespace' error in working with boost spirit qi
body: <p>I am writing a c++ application with several complex structs and</p>
  
  <p>I want to read a string and fill those structs by data provided in that text.</p>
  
  <p>But for easier understanding and debugging, i've wrote easy program with same problem.</p>
  
  <p>This is my code:</p>
  
  <pre><code>#include &lt;string&gt;
  #include &lt;iostream&gt;
  
  #define FUSION_MAX_VECTOR_SIZE  30
  #define BOOST_PHOENIX_USE_V2_OVER_V3
  
  #include &lt;boost/spirit/home/phoenix/bind/bind_function.hpp&gt;
  #include &lt;boost/phoenix/bind.hpp&gt;
  #include &lt;boost/fusion/adapted.hpp&gt;
  #include &lt;boost/spirit/include/qi.hpp&gt;
  
  
  namespace qi = boost::spirit::qi;
  namespace ascii = boost::spirit::ascii;
  namespace phoenix = boost::phoenix;
  
  using qi::double_;
  using qi::char_;
  using qi::lexeme;
  using qi::int_;
  using qi::lit;
  using qi::_1;
  using ascii::space;
  using phoenix::ref;
  using qi::parser;
  
  
  class Test 
  {
      // Class fields
      std::string test_str;
      public:
  
          Test(std::string&amp; sample_str)
          {
              test_str = sample_str;
          }
  
          struct fruit
          {
              std::string name;
              std::string color;
          };
          BOOST_FUSION_ADAPT_STRUCT
              (
               fruit,
               (std::string, name)
               (std::string, color)
              );      
          struct person
          {
              std::string name;
              int age;
          };
  
          BOOST_FUSION_ADAPT_STRUCT
              (
               person,
               (std::string, name)
               (int, age)
              );
  
          void received_person(person&amp; p)
          {
              std::cout &lt;&lt; p.name &lt;&lt; " with age"&lt;&lt; p.age&lt;&lt; " has been seen!"&lt;&lt;std::endl;
          }
          void received_fruit(fruit&amp; f)
          {
              std::cout &lt;&lt; f.name&lt;&lt;" is "&lt;&lt;f.color&lt;&lt;std::endl;
          }
  
          template &lt;typename Iterator&gt;
              struct MyGrammar : boost::spirit::qi::grammar&lt;Iterator, void()&gt;
          {
              MyGrammar() : MyGrammar::base_type(my_item)
              {
                  my_item = *(fruit[ boost::phoenix::bind(&amp;received_fruit, boost::spirit::_1 )]
                          |
                          _person[ boost::phoenix::bind(&amp;received_person, boost::spirit::_1 )]
                          );
  
                   _person = qi::lit('(') &gt;&gt; *(qi::char_ - ',') &gt;&gt; ',' &gt;&gt; qi::int_ &gt;&gt; ')';
                  _fruit = qi::lit('[') &gt;&gt; *(qi::char_ - ',') &gt;&gt; ',' &gt;&gt; *(qi::char_) &gt;&gt; ']';
  
  
              }
              qi::rule&lt;Iterator, void()&gt; my_item;
              qi::rule&lt;Iterator, person()&gt; _person;
              qi::rule&lt;Iterator, fruit()&gt; _fruit;
          };
  
          void run()
          {
              typedef std::string::const_iterator iterator;
              MyGrammar &lt;std::string::const_iterator&gt; my_grammar;
              std::string::const_iterator begin = test_str.begin();
              std::string::const_iterator end = test_str.end();
              bool result_ = qi::parse(begin, end, my_grammar) &amp;&amp; begin == end;
          }
  };
  
  
  int main()
  {
      std::string input("(jane, 23000)(david, 19)(mary, 30)[yello,100][green, 60.6][red, 30.5]");
  
      Test test(input);
      test.run();
  
      return 0;
  }
  </code></pre>
  
  <p>g++ compiles this code and generates this error:</p>
  
  <pre><code>expected unqualified-id before 'namespace' 
  </code></pre>
  
  <p>i know this code can be written without using class, but i want to use class in main project.
  many thanks in advance!</p>