x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
subrule.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\spirit\core\non_terminal\subrule.hpp
旋转
特效
属性
历史版本
/*============================================================================= Copyright (c) 2002-2003 Joel de Guzman Copyright (c) 2002-2003 Hartmut Kaiser http://spirit.sourceforge.net/ Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ #if !defined(BOOST_SPIRIT_SUBRULE_HPP) #define BOOST_SPIRIT_SUBRULE_HPP #include
#include
#include
#include
#include
#include
namespace boost { namespace spirit { /////////////////////////////////////////////////////////////////////////// // // subrules_scanner class // /////////////////////////////////////////////////////////////////////////// template
struct subrules_scanner : public ScannerT { typedef ScannerT scanner_t; typedef ListT list_t; typedef subrules_scanner
self_t; subrules_scanner(ScannerT const& scan, ListT const& list_) : ScannerT(scan), list(list_) {} template
struct rebind_policies { typedef typename rebind_scanner_policies
::type rebind_scanner; typedef subrules_scanner
type; }; template
subrules_scanner< typename rebind_scanner_policies
::type, ListT> change_policies(PoliciesT const& policies) const { typedef subrules_scanner< BOOST_DEDUCED_TYPENAME rebind_scanner_policies
::type, ListT> subrules_scanner_t; return subrules_scanner_t( ScannerT::change_policies(policies), list); } template
struct rebind_iterator { typedef typename rebind_scanner_iterator
::type rebind_scanner; typedef subrules_scanner
type; }; template
subrules_scanner< typename rebind_scanner_iterator
::type, ListT> change_iterator(IteratorT const& first, IteratorT const &last) const { typedef subrules_scanner< BOOST_DEDUCED_TYPENAME rebind_scanner_iterator
::type, ListT> subrules_scanner_t; return subrules_scanner_t( ScannerT::change_iterator(first, last), list); } ListT const& list; }; /////////////////////////////////////////////////////////////////////////// // // subrule_scanner type computer class // // This computer ensures that the scanner will not be recursively // instantiated if it's not needed. // /////////////////////////////////////////////////////////////////////////// template
struct subrules_scanner_finder { typedef subrules_scanner
type; }; template
struct subrules_scanner_finder
, ListT> { typedef subrules_scanner
type; }; /////////////////////////////////////////////////////////////////////////// // // subrule_list class // /////////////////////////////////////////////////////////////////////////// template
struct subrule_list : public parser
> { typedef subrule_list
self_t; typedef FirstT first_t; typedef RestT rest_t; subrule_list(FirstT const& first_, RestT const& rest_) : first(first_), rest(rest_) {} template
struct result { typedef typename parser_result
::type type; }; template
typename parser_result
::type parse(ScannerT const& scan) const { typedef typename subrules_scanner_finder
::type subrules_scanner_t; subrules_scanner_t g_arg(scan, *this); return first.start.parse(g_arg); } template
subrule_list< FirstT, subrule_list< subrule_parser
, RestT> > operator,(subrule_parser
const& rhs) { return subrule_list< FirstT, subrule_list< subrule_parser
, RestT> >( first, subrule_list< subrule_parser
, RestT>(rhs, rest)); } FirstT first; RestT rest; }; /////////////////////////////////////////////////////////////////////////// // // subrule_parser class // /////////////////////////////////////////////////////////////////////////// template
struct subrule_parser : public parser
> { typedef subrule_parser
self_t; typedef subrule
subrule_t; typedef DefT def_t; BOOST_STATIC_CONSTANT(int, id = ID); template
struct result { typedef typename impl::get_subrule_parser_result< DefT, ScannerT, typename subrule_t::attr_t>::type type; }; subrule_parser(subrule_t const& start_, DefT const& rhs_) : rhs(rhs_), start(start_) {} template
typename parser_result
::type parse(ScannerT const& scan) const { // This will only be called when parsing single subrules. typedef subrule_list
list_t; typedef subrules_scanner
scanner_t; list_t list(*this, nil_t()); scanner_t g_arg(scan, list); return start.parse(g_arg); } template
inline subrule_list< self_t, subrule_list< subrule_parser
, nil_t> > operator,(subrule_parser
const& rhs) const { return subrule_list< self_t, subrule_list< subrule_parser
, nil_t> >( *this, subrule_list< subrule_parser
, nil_t>( rhs, nil_t())); } typename DefT::embed_t rhs; subrule_t const& start; }; /////////////////////////////////////////////////////////////////////////// // // subrule class // /////////////////////////////////////////////////////////////////////////// template
struct subrule : public parser
> , public ContextT::base_t , public context_aux
> { typedef subrule
self_t; typedef subrule
const& embed_t; typedef typename ContextT::context_linker_t context_t; typedef typename context_t::attr_t attr_t; BOOST_STATIC_CONSTANT(int, id = ID); template
struct result { typedef typename impl::get_subrule_result
::type type; }; template
typename parser_result
::type parse_main(ScannerT const& scan) const { typedef typename parser_result
::type result_t; result_t result; impl::parse_subrule
:: do_(result, scan); return result; } template
typename parser_result
::type parse(ScannerT const& scan) const { typedef typename parser_result
::type result_t; typedef parser_scanner_linker
scanner_t; BOOST_SPIRIT_CONTEXT_PARSE( scan, *this, scanner_t, context_t, result_t); } template
subrule_parser
operator=(parser
const& rhs) const { return subrule_parser
(*this, rhs.derived()); } private: // assignment of subrules is not allowed. Use subrules // with identical IDs if you want to have aliases. subrule& operator=(subrule const&); template
subrule& operator=(subrule
const&); }; }} // namespace boost::spirit #endif
subrule.hpp
网页地址
文件地址
上一页
5/6
下一页
下载
( 10 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.