Changeset 44669


Ignore:
Timestamp:
Apr 21, 2008, 2:01:31 AM (10 years ago)
Author:
Hartmut Kaiser
Message:

Spirit.Qi: Added ~ for eoi and eol, added corresponding tests

Location:
trunk
Files:
2 added
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/boost/spirit/home/qi/auxiliary.hpp

    r44358 r44669  
    1414#include <boost/spirit/home/qi/auxiliary/functor.hpp>
    1515#include <boost/spirit/home/qi/auxiliary/functor_director.hpp>
     16#include <boost/spirit/home/qi/auxiliary/primitives.hpp>
    1617#include <boost/spirit/home/qi/auxiliary/meta_grammar.hpp>
    1718
  • trunk/boost/spirit/home/qi/auxiliary/meta_grammar.hpp

    r44358 r44669  
    3131    struct functor_director;
    3232
     33    struct eol_director;
     34    struct eoi_director;
     35
     36    template <typename Positive>
     37    struct negated_end_director;
     38
     39    ///////////////////////////////////////////////////////////////////////////
    3340    template <typename Expr, typename Enable>
    3441    struct is_valid_expr;
     
    4249
    4350    // none, eps and eps(f)
    44     struct auxiliary_meta_grammar
     51    struct auxiliary_meta_grammar1
    4552      : proto::or_<
    4653            meta_grammar::empty_terminal_rule<
     
    5764              , functor_director
    5865            >
     66        >
     67    {
     68    };
     69
     70    // eol, eoi
     71    struct auxiliary_end_meta_grammar
     72      : proto::or_<
     73            meta_grammar::terminal_rule<qi::domain, tag::eol, eol_director>
     74          , meta_grammar::terminal_rule<qi::domain, tag::eoi, eoi_director>
     75        >
     76    {
     77    };
     78
     79    struct negated_auxiliary_end_meta_grammar
     80      : proto::or_<
     81            auxiliary_end_meta_grammar
     82          , meta_grammar::compose_single<
     83                proto::unary_expr<
     84                    proto::tag::complement
     85                  , negated_auxiliary_end_meta_grammar
     86                >
     87              , qi::domain
     88              , negated_end_director<mpl::_>
     89            >
     90        >
     91    {
     92    };
     93
     94    struct auxiliary_meta_grammar
     95      : proto::or_<
     96            auxiliary_meta_grammar1
     97          , negated_auxiliary_end_meta_grammar
    5998        >
    6099    {
  • trunk/boost/spirit/home/qi/char.hpp

    r44527 r44669  
    1111#include <boost/spirit/home/qi/char/char.hpp>
    1212#include <boost/spirit/home/qi/char/char_class.hpp>
    13 #include <boost/spirit/home/qi/char/primitives.hpp>
    1413#include <boost/spirit/home/qi/char/meta_grammar.hpp>
    1514
  • trunk/boost/spirit/home/qi/char/meta_grammar.hpp

    r44569 r44669  
    4141    struct char_class;
    4242
    43     struct eol_director;
    44     struct eoi_director;
    45 
    46     ///////////////////////////////////////////////////////////////////////////
    4743    struct char_meta_grammar;
    4844
     45    ///////////////////////////////////////////////////////////////////////////
    4946    template <typename Expr, typename Enable>
    5047    struct is_valid_expr;
     
    351348              , char_class<mpl::_>
    352349            >
    353           , meta_grammar::terminal_rule<qi::domain, tag::eol, eol_director>
    354           , meta_grammar::terminal_rule<qi::domain, tag::eoi, eoi_director>
    355350        >
    356351    {};
  • trunk/libs/spirit/test/qi/char.cpp

    r44540 r44669  
    2424    using boost::spirit::char_;
    2525    using boost::spirit::wchar;
    26     using boost::spirit::eol;
    27     using boost::spirit::eoi;
    2826   
    2927    {
     
    117115        BOOST_TEST((test("h", char_(val('a'), val('n')))));
    118116    }
    119 
    120     {   // eol
    121         BOOST_TEST(test("\r", eol));
    122         BOOST_TEST(test("\r\n", eol));
    123         BOOST_TEST(test("\n", eol));
    124         BOOST_TEST(!test("\b", eol));
    125 
    126         BOOST_TEST(test("   \r", eol, char_(' ')));
    127         BOOST_TEST(test("   \r\n", eol, char_(' ')));
    128         BOOST_TEST(test("   \n", eol, char_(' ')));
    129         BOOST_TEST(!test("   \b", eol, char_(' ')));
    130 
    131         BOOST_TEST(test(L"\r", eol));
    132         BOOST_TEST(test(L"\r\n", eol));
    133         BOOST_TEST(test(L"\n", eol));
    134         BOOST_TEST(!test(L"\b", eol));
    135 
    136         BOOST_TEST(test(L"   \r", eol, wchar(L' ')));
    137         BOOST_TEST(test(L"   \r\n", eol, wchar(L' ')));
    138         BOOST_TEST(test(L"   \n", eol, wchar(L' ')));
    139         BOOST_TEST(!test(L"   \b", eol, wchar(L' ')));
    140     }
    141    
    142     {   // eoi
    143         BOOST_TEST(test("", eoi));
    144         BOOST_TEST(!test("a", eoi));
    145 
    146         BOOST_TEST(test("   ", eoi, space));
    147         BOOST_TEST(!test("   a", eoi, space));
    148     }
    149117   
    150118    return boost::report_errors();
Note: See TracChangeset for help on using the changeset viewer.