| 1 | /*============================================================================= |
| 2 | Copyright (c) 2019 Joel de Guzman |
| 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 | =============================================================================*/ |
| 7 | #if !defined(BOOST_SPIRIT_X3_PSEUDO_ATTRIBUTE_OF_MAY_15_2019_1012PM) |
| 8 | #define BOOST_SPIRIT_X3_PSEUDO_ATTRIBUTE_OF_MAY_15_2019_1012PM |
| 9 | |
| 10 | #include <utility> |
| 11 | |
| 12 | namespace boost { namespace spirit { namespace x3 { namespace traits |
| 13 | { |
| 14 | /////////////////////////////////////////////////////////////////////////// |
| 15 | // Pseudo attributes are placeholders for parsers that can only know |
| 16 | // its actual attribute at parse time. This trait customization point |
| 17 | // provides a mechanism to convert the trait to the actual trait at |
| 18 | // parse time. |
| 19 | /////////////////////////////////////////////////////////////////////////// |
| 20 | template <typename Context, typename Attribute, typename Iterator |
| 21 | , typename Enable = void> |
| 22 | struct pseudo_attribute |
| 23 | { |
| 24 | using attribute_type = Attribute; |
| 25 | using type = Attribute; |
| 26 | |
| 27 | static type&& call(Iterator&, Iterator const&, attribute_type&& attribute) |
| 28 | { |
| 29 | return std::forward<type>(attribute); |
| 30 | } |
| 31 | }; |
| 32 | }}}} |
| 33 | |
| 34 | #endif |
| 35 | |