Chris@16: // Copyright (c) 2001-2011 Hartmut Kaiser 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_LEX_REFERENCE_APR_20_2009_0827AM) Chris@16: #define BOOST_SPIRIT_LEX_REFERENCE_APR_20_2009_0827AM 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 lex Chris@16: { Chris@16: /////////////////////////////////////////////////////////////////////////// Chris@16: // reference is a lexer that references another lexer (its Subject) Chris@16: // all lexer components are at the same time Chris@16: /////////////////////////////////////////////////////////////////////////// Chris@16: template Chris@16: struct reference; Chris@16: Chris@16: template Chris@16: struct reference Chris@16: : qi::reference Chris@16: , lexer_type > Chris@16: { Chris@16: reference(Subject& subject) Chris@16: : qi::reference(subject) {} Chris@16: Chris@16: template Chris@16: void collect(LexerDef& lexdef, String const& state Chris@16: , String const& targetstate) const Chris@16: { Chris@16: this->ref.get().collect(lexdef, state, targetstate); Chris@16: } Chris@16: Chris@16: template Chris@16: void add_actions(LexerDef& lexdef) const Chris@16: { Chris@16: this->ref.get().add_actions(lexdef); Chris@16: } Chris@16: }; Chris@16: Chris@16: template Chris@16: struct reference : reference Chris@16: { Chris@16: reference(Subject& subject) Chris@16: : reference(subject) {} Chris@16: Chris@16: IdType id() const Chris@16: { Chris@16: return this->ref.get().id(); Chris@16: } Chris@16: std::size_t unique_id() const Chris@16: { Chris@16: return this->ref.get().unique_id(); Chris@16: } Chris@16: std::size_t state() const Chris@16: { Chris@16: return this->ref.get().state(); Chris@16: } 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 Chris@16: , Attribute, Context, Iterator> Chris@16: : handles_container< Chris@16: typename remove_const::type, Attribute, Context, Iterator> Chris@16: {}; Chris@16: }}} Chris@16: Chris@16: #endif