1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2024-12-03 21:15:42 +00:00
Sprout/sprout/weed/parser/auxiliary/eoi.hpp

50 lines
1.3 KiB
C++
Raw Normal View History

2011-11-13 08:54:38 +00:00
#ifndef SPROUT_WEED_PARSER_AUXILIARY_EOI_HPP
#define SPROUT_WEED_PARSER_AUXILIARY_EOI_HPP
#include <cstddef>
#include <sprout/config.hpp>
#include <sprout/weed/unused.hpp>
#include <sprout/weed/parser_result.hpp>
#include <sprout/weed/parser/parser_base.hpp>
namespace sprout {
namespace weed {
//
// eoi_p
//
struct eoi_p
: public sprout::weed::parser_base
{
public:
template<typename Context, typename Iterator>
struct attribute {
public:
typedef sprout::weed::unused type;
};
template<typename Context, typename Iterator>
struct result {
public:
typedef sprout::weed::parser_result<Iterator, typename attribute<Context, Iterator>::type> type;
};
public:
template<typename Context, typename Iterator>
SPROUT_CONSTEXPR typename result<Context, Iterator>::type operator()(
Iterator first,
Iterator last,
Context const&
) const
{
typedef typename result<Context, Iterator>::type result_type;
typedef typename attribute<Context, Iterator>::type attribute_type;
return result_type(first == last, first, attribute_type());
}
};
//
// eoi
//
SPROUT_STATIC_CONSTEXPR sprout::weed::eoi_p eoi = sprout::weed::eoi_p();
} // namespace weed
} // namespace sprout
#endif // #ifndef SPROUT_WEED_PARSER_AUXILIARY_EOI_HPP