annotate DEPENDENCIES/generic/include/boost/spirit/home/lex/reference.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Copyright (c) 2001-2011 Hartmut Kaiser
Chris@16 2 // Copyright (c) 2001-2011 Joel de Guzman
Chris@16 3 //
Chris@16 4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
Chris@16 5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 6
Chris@16 7 #if !defined(BOOST_SPIRIT_LEX_REFERENCE_APR_20_2009_0827AM)
Chris@16 8 #define BOOST_SPIRIT_LEX_REFERENCE_APR_20_2009_0827AM
Chris@16 9
Chris@16 10 #if defined(_MSC_VER)
Chris@16 11 #pragma once
Chris@16 12 #endif
Chris@16 13
Chris@16 14 #include <boost/spirit/home/lex/meta_compiler.hpp>
Chris@16 15 #include <boost/spirit/home/lex/lexer_type.hpp>
Chris@16 16 #include <boost/spirit/home/qi/reference.hpp>
Chris@16 17 #include <boost/spirit/home/support/info.hpp>
Chris@16 18 #include <boost/spirit/home/support/handles_container.hpp>
Chris@16 19 #include <boost/ref.hpp>
Chris@16 20
Chris@16 21 namespace boost { namespace spirit { namespace lex
Chris@16 22 {
Chris@16 23 ///////////////////////////////////////////////////////////////////////////
Chris@16 24 // reference is a lexer that references another lexer (its Subject)
Chris@16 25 // all lexer components are at the same time
Chris@16 26 ///////////////////////////////////////////////////////////////////////////
Chris@16 27 template <typename Subject, typename IdType = unused_type>
Chris@16 28 struct reference;
Chris@16 29
Chris@16 30 template <typename Subject>
Chris@16 31 struct reference<Subject, unused_type>
Chris@16 32 : qi::reference<Subject>
Chris@16 33 , lexer_type<reference<Subject> >
Chris@16 34 {
Chris@16 35 reference(Subject& subject)
Chris@16 36 : qi::reference<Subject>(subject) {}
Chris@16 37
Chris@16 38 template <typename LexerDef, typename String>
Chris@16 39 void collect(LexerDef& lexdef, String const& state
Chris@16 40 , String const& targetstate) const
Chris@16 41 {
Chris@16 42 this->ref.get().collect(lexdef, state, targetstate);
Chris@16 43 }
Chris@16 44
Chris@16 45 template <typename LexerDef>
Chris@16 46 void add_actions(LexerDef& lexdef) const
Chris@16 47 {
Chris@16 48 this->ref.get().add_actions(lexdef);
Chris@16 49 }
Chris@16 50 };
Chris@16 51
Chris@16 52 template <typename Subject, typename IdType>
Chris@16 53 struct reference : reference<Subject>
Chris@16 54 {
Chris@16 55 reference(Subject& subject)
Chris@16 56 : reference<Subject>(subject) {}
Chris@16 57
Chris@16 58 IdType id() const
Chris@16 59 {
Chris@16 60 return this->ref.get().id();
Chris@16 61 }
Chris@16 62 std::size_t unique_id() const
Chris@16 63 {
Chris@16 64 return this->ref.get().unique_id();
Chris@16 65 }
Chris@16 66 std::size_t state() const
Chris@16 67 {
Chris@16 68 return this->ref.get().state();
Chris@16 69 }
Chris@16 70 };
Chris@16 71 }}}
Chris@16 72
Chris@16 73 namespace boost { namespace spirit { namespace traits
Chris@16 74 {
Chris@16 75 ///////////////////////////////////////////////////////////////////////////
Chris@16 76 template <typename Subject, typename IdType
Chris@16 77 , typename Attribute, typename Context, typename Iterator>
Chris@16 78 struct handles_container<lex::reference<Subject, IdType>
Chris@16 79 , Attribute, Context, Iterator>
Chris@16 80 : handles_container<
Chris@16 81 typename remove_const<Subject>::type, Attribute, Context, Iterator>
Chris@16 82 {};
Chris@16 83 }}}
Chris@16 84
Chris@16 85 #endif