Ticket #6291: disctinct_patch.patch

File disctinct_patch.patch, 2.2 KB (added by anonymous, 10 years ago)
  • boost/spirit/repository/home/qi/directive/distinct.hpp

     
    6464      : spirit::qi::unary_parser<distinct_parser<Subject, Tail, Modifier> >
    6565    {
    6666        template <typename Context, typename Iterator>
    67         struct attribute
    68           : traits::attribute_of<Subject, Context, Iterator>
    69         {};
     67        struct attribute  :  traits::attribute_of<Subject, Context, Iterator>       
     68        {
     69        };
    7070
    7171        distinct_parser(Subject const& subject, Tail const& tail)
    7272          : subject(subject), tail(tail) {}
     
    137137    struct has_semantic_action<
    138138            repository::qi::distinct_parser<Subject, Tail, Modifier> >
    139139      : unary_has_semantic_action<Subject> {};
     140
     141    template <typename Subject, typename Tail, typename Modifier,
     142       typename Attribute ,typename Context, typename Iterator>
     143    struct handles_container< repository::qi::distinct_parser<Subject, Tail, Modifier>
     144      , Attribute, Context, Iterator>
     145      : handles_container<Subject, Attribute, Context, Iterator> {};
    140146}}}
    141147
    142148#endif
  • libs/spirit/repository/test/qi/distinct.cpp

     
    9696        BOOST_TEST(!test("descriptionident", r, space));
    9797    }
    9898
     99    {
     100        using namespace boost::spirit::ascii;
     101        namespace repo=boost::spirit::repository;
     102        boost::spirit::qi::rule<const char*, std::string(), space_type> string_keyword;
     103        string_keyword %= '+' >> (repo::qi::distinct("0-9a-zA-Z_")[string("ALPHA")] |
     104                              repo::qi::distinct("0-9a-zA-Z_")[string("BETA")]);
     105   
     106        std::string r1;
     107        BOOST_TEST(test_attr("+ BETA",string_keyword,r1,space));
     108        BOOST_TEST(r1.compare("BETA")==0);
     109        BOOST_TEST(!test_attr("+ BETAA",string_keyword,r1,space));
     110       
     111    }
    99112    return boost::report_errors();
    100113}
    101114