]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Copyright (c) 2001-2011 Hartmut Kaiser |
2 | // Copyright (c) 2011 Thomas Heller | |
3 | // | |
4 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | |
5 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
6 | ||
f67539c2 TL |
7 | #ifndef BOOST_SPIRIT_LEX_LEXER_SUPPORT_FUNCTIONS_EXPRESSION_HPP |
8 | #define BOOST_SPIRIT_LEX_LEXER_SUPPORT_FUNCTIONS_EXPRESSION_HPP | |
7c673cae FG |
9 | |
10 | #if defined(_MSC_VER) | |
11 | #pragma once | |
12 | #endif | |
13 | ||
f67539c2 TL |
14 | #include <boost/phoenix/core/expression.hpp> |
15 | #include <boost/phoenix/core/v2_eval.hpp> | |
16 | #include <boost/proto/proto_fwd.hpp> // for transform placeholders | |
7c673cae FG |
17 | |
18 | namespace boost { namespace spirit { namespace lex | |
19 | { | |
20 | template <typename> struct less_type; | |
21 | struct more_type; | |
22 | template <typename, typename> struct lookahead_type; | |
23 | }}} | |
24 | ||
25 | /////////////////////////////////////////////////////////////////////////////// | |
26 | ||
27 | BOOST_PHOENIX_DEFINE_EXPRESSION( | |
28 | (boost)(spirit)(lex)(less) | |
29 | , (boost::phoenix::meta_grammar) | |
30 | ) | |
31 | ||
32 | BOOST_PHOENIX_DEFINE_EXPRESSION( | |
33 | (boost)(spirit)(lex)(lookahead) | |
34 | , (boost::phoenix::meta_grammar) | |
35 | (boost::phoenix::meta_grammar) | |
36 | ) | |
37 | ||
38 | namespace boost { namespace phoenix | |
39 | { | |
40 | ||
41 | namespace result_of | |
42 | { | |
43 | template <> | |
44 | struct is_nullary<custom_terminal<boost::spirit::lex::more_type> > | |
45 | : mpl::false_ | |
46 | {}; | |
47 | } | |
48 | ||
49 | template <typename Dummy> | |
50 | struct is_custom_terminal<boost::spirit::lex::more_type, Dummy> : mpl::true_ {}; | |
51 | ||
52 | template <typename Dummy> | |
53 | struct custom_terminal<boost::spirit::lex::more_type, Dummy> | |
54 | : proto::call< | |
55 | v2_eval( | |
56 | proto::make<boost::spirit::lex::more_type()> | |
57 | , proto::call<functional::env(proto::_state)> | |
58 | ) | |
59 | > | |
60 | {}; | |
61 | ||
62 | ||
63 | template <typename Dummy> | |
64 | struct is_nullary::when<spirit::lex::rule::less, Dummy> | |
65 | : proto::make<mpl::false_()> | |
66 | {}; | |
67 | ||
68 | template <typename Dummy> | |
69 | struct default_actions::when<spirit::lex::rule::less, Dummy> | |
70 | : proto::call< | |
71 | v2_eval( | |
72 | proto::make< | |
73 | spirit::lex::less_type<proto::_child0>(proto::_child0) | |
74 | > | |
75 | , _env | |
76 | ) | |
77 | > | |
78 | {}; | |
79 | ||
80 | template <typename Dummy> | |
81 | struct is_nullary::when<spirit::lex::rule::lookahead, Dummy> | |
82 | : proto::make<mpl::false_()> | |
83 | {}; | |
84 | ||
85 | template <typename Dummy> | |
86 | struct default_actions::when<spirit::lex::rule::lookahead, Dummy> | |
87 | : proto::call< | |
88 | v2_eval( | |
89 | proto::make< | |
90 | spirit::lex::lookahead_type< | |
91 | proto::_child0 | |
92 | , proto::_child1 | |
93 | >( | |
94 | proto::_child0 | |
95 | , proto::_child1 | |
96 | ) | |
97 | > | |
98 | , _env | |
99 | ) | |
100 | > | |
101 | {}; | |
102 | }} | |
103 | ||
104 | #endif |