|
||||
File indexing completed on 2025-01-31 10:02:08
0001 /*============================================================================= 0002 Copyright (c) 2001-2003 Daniel Nuffer 0003 http://spirit.sourceforge.net/ 0004 0005 Distributed under the Boost Software License, Version 1.0. (See accompanying 0006 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 0007 =============================================================================*/ 0008 #ifndef BOOST_SPIRIT_FLUSH_MULTI_PASS_HPP 0009 #define BOOST_SPIRIT_FLUSH_MULTI_PASS_HPP 0010 0011 /////////////////////////////////////////////////////////////////////////////// 0012 #include <boost/spirit/home/classic/namespace.hpp> 0013 #include <boost/spirit/home/classic/core.hpp> 0014 #include <boost/spirit/home/classic/iterator/multi_pass.hpp> 0015 0016 /////////////////////////////////////////////////////////////////////////////// 0017 namespace boost { namespace spirit { 0018 0019 BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN 0020 0021 namespace impl { 0022 0023 template <typename T> 0024 void flush_iterator(T &) {} 0025 0026 template <typename T1, typename T2, typename T3, typename T4> 0027 void flush_iterator(BOOST_SPIRIT_CLASSIC_NS::multi_pass< 0028 T1, T2, T3, T4, BOOST_SPIRIT_CLASSIC_NS::multi_pass_policies::std_deque> &i) 0029 { 0030 i.clear_queue(); 0031 } 0032 0033 } // namespace impl 0034 0035 /////////////////////////////////////////////////////////////////////////// 0036 // 0037 // flush_multi_pass_parser 0038 // 0039 // The flush_multi_pass_parser flushes an underlying 0040 // multi_pass_iterator during the normal parsing process. This may 0041 // be used at certain points during the parsing process, when it is 0042 // clear, that no backtracking is needed anymore and the input 0043 // gathered so far may be discarded. 0044 // 0045 /////////////////////////////////////////////////////////////////////////// 0046 class flush_multi_pass_parser 0047 : public parser<flush_multi_pass_parser> 0048 { 0049 public: 0050 typedef flush_multi_pass_parser this_t; 0051 0052 template <typename ScannerT> 0053 typename parser_result<this_t, ScannerT>::type 0054 parse(ScannerT const& scan) const 0055 { 0056 impl::flush_iterator(scan.first); 0057 return scan.empty_match(); 0058 } 0059 }; 0060 0061 /////////////////////////////////////////////////////////////////////////// 0062 // 0063 // predefined flush_multi_pass_p object 0064 // 0065 // This object should may used to flush a multi_pass_iterator along 0066 // the way during the normal parsing process. 0067 // 0068 /////////////////////////////////////////////////////////////////////////// 0069 0070 flush_multi_pass_parser const 0071 flush_multi_pass_p = flush_multi_pass_parser(); 0072 0073 BOOST_SPIRIT_CLASSIC_NAMESPACE_END 0074 0075 }} // namespace BOOST_SPIRIT_CLASSIC_NS 0076 0077 #endif // BOOST_SPIRIT_FLUSH_MULTI_PASS_HPP
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |