| 2842 | |
| 2843 | template<typename I, typename S, typename ErrorHandler, typename T> |
| 2844 | T if_full_parse( |
| 2845 | I initial_first, |
| 2846 | I & first, |
| 2847 | S last, |
| 2848 | ErrorHandler const & error_handler, |
| 2849 | T retval) |
| 2850 | { |
| 2851 | if (first != last) { |
| 2852 | if (retval && error_handler( |
| 2853 | initial_first, |
| 2854 | last, |
| 2855 | parse_error<I>(first, "end of input")) == |
| 2856 | error_handler_result::rethrow) { |
| 2857 | throw parse_error<I>(first, "end of input"); |
| 2858 | } |
| 2859 | if constexpr (std::is_same_v<T, bool>) |
| 2860 | retval = false; |
| 2861 | else |
| 2862 | retval = std::nullopt; |
| 2863 | } |
| 2864 | return std::move(retval); |
| 2865 | } |
| 2866 | |
| 2867 | // The notion of comaptibility is that, given a parser with the |
| 2868 | // Attribute Tuple, we can parse into Struct instead. |