]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*============================================================================= |
2 | Copyright (c) 2001-2011 Hartmut Kaiser | |
3 | Copyright (c) 2001-2011 Joel de Guzman | |
4 | ||
5 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
6 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
7 | ==============================================================================*/ | |
8 | #if !defined(BOOST_SPIRIT_EOI_APRIL_18_2008_0751PM) | |
9 | #define BOOST_SPIRIT_EOI_APRIL_18_2008_0751PM | |
10 | ||
11 | #if defined(_MSC_VER) | |
12 | #pragma once | |
13 | #endif | |
14 | ||
15 | #include <boost/mpl/bool.hpp> | |
16 | #include <boost/spirit/home/qi/domain.hpp> | |
17 | #include <boost/spirit/home/qi/parser.hpp> | |
18 | #include <boost/spirit/home/qi/meta_compiler.hpp> | |
19 | #include <boost/spirit/home/qi/skip_over.hpp> | |
20 | #include <boost/spirit/home/support/common_terminals.hpp> | |
21 | ||
22 | namespace boost { namespace spirit | |
23 | { | |
24 | /////////////////////////////////////////////////////////////////////////// | |
25 | // Enablers | |
26 | /////////////////////////////////////////////////////////////////////////// | |
27 | template <> | |
28 | struct use_terminal<qi::domain, tag::eoi> // enables eoi | |
29 | : mpl::true_ {}; | |
30 | }} | |
31 | ||
32 | namespace boost { namespace spirit { namespace qi | |
33 | { | |
34 | #ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS | |
35 | using spirit::eoi; | |
36 | #endif | |
37 | using spirit::eoi_type; | |
38 | ||
39 | struct eoi_parser : primitive_parser<eoi_parser> | |
40 | { | |
41 | template <typename Context, typename Iterator> | |
42 | struct attribute | |
43 | { | |
44 | typedef unused_type type; | |
45 | }; | |
46 | ||
47 | template <typename Iterator, typename Context | |
48 | , typename Skipper, typename Attribute> | |
49 | bool parse(Iterator& first, Iterator const& last | |
50 | , Context& /*context*/, Skipper const& skipper | |
51 | , Attribute& /*attr*/) const | |
52 | { | |
53 | qi::skip_over(first, last, skipper); | |
54 | return first == last; | |
55 | } | |
56 | ||
57 | template <typename Context> | |
58 | info what(Context& /*context*/) const | |
59 | { | |
60 | return info("eoi"); | |
61 | } | |
62 | }; | |
63 | ||
64 | /////////////////////////////////////////////////////////////////////////// | |
65 | // Parser generators: make_xxx function (objects) | |
66 | /////////////////////////////////////////////////////////////////////////// | |
67 | template <typename Modifiers> | |
68 | struct make_primitive<tag::eoi, Modifiers> | |
69 | { | |
70 | typedef eoi_parser result_type; | |
71 | result_type operator()(unused_type, unused_type) const | |
72 | { | |
73 | return result_type(); | |
74 | } | |
75 | }; | |
76 | }}} | |
77 | ||
78 | #endif | |
79 | ||
80 |