Chris@16: /*============================================================================= Chris@16: Copyright (c) 2001-2011 Joel de Guzman Chris@16: Chris@16: Distributed under the Boost Software License, Version 1.0. (See accompanying Chris@16: file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: ==============================================================================*/ Chris@16: #if !defined(BOOST_SPIRIT_REFERENCE_OCTOBER_31_2008_1218AM) Chris@16: #define BOOST_SPIRIT_REFERENCE_OCTOBER_31_2008_1218AM Chris@16: Chris@16: #if defined(_MSC_VER) Chris@16: #pragma once Chris@16: #endif Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace boost { namespace spirit { namespace qi Chris@16: { Chris@16: /////////////////////////////////////////////////////////////////////////// Chris@16: // reference is a parser that references another parser (its Subject) Chris@16: /////////////////////////////////////////////////////////////////////////// Chris@16: template Chris@16: struct reference : parser > Chris@16: { Chris@16: typedef Subject subject_type; Chris@16: Chris@16: reference(Subject& subject) Chris@16: : ref(subject) {} Chris@16: Chris@16: template Chris@16: struct attribute : Subject::template attribute {}; Chris@16: Chris@16: template Chris@16: bool parse(Iterator& first, Iterator const& last Chris@16: , Context& context, Skipper const& skipper Chris@16: , Attribute& attr_) const Chris@16: { Chris@16: return ref.get().parse(first, last, context, skipper, attr_); Chris@16: } Chris@16: Chris@16: template Chris@16: info what(Context& context) const Chris@16: { Chris@16: // the reference is transparent (does not add any info) Chris@16: return ref.get().what(context); Chris@16: } Chris@16: Chris@16: boost::reference_wrapper ref; Chris@16: }; Chris@16: }}} Chris@16: Chris@16: namespace boost { namespace spirit { namespace traits Chris@16: { Chris@16: /////////////////////////////////////////////////////////////////////////// Chris@16: template Chris@16: struct handles_container, Attribute, Context Chris@16: , Iterator> Chris@16: : handles_container::type Chris@16: , Attribute, Context, Iterator> Chris@16: {}; Chris@16: }}} Chris@16: Chris@16: #endif