Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/spirit/home/lex/tokenize_and_parse_attr.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //  Copyright (c) 2001-2011 Hartmut Kaiser
0002 //  Copyright (c) 2001-2011 Joel de Guzman
0003 //  Copyright (c) 2009 Carl Barron
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 #if !defined(BOOST_PP_IS_ITERATING)
0009 
0010 #if !defined(BOOST_SPIRIT_LEXER_PARSE_ATTR_MAY_27_2009_0926AM)
0011 #define BOOST_SPIRIT_LEXER_PARSE_ATTR_MAY_27_2009_0926AM
0012 
0013 #include <boost/spirit/home/lex/tokenize_and_parse.hpp>
0014 
0015 #include <boost/fusion/include/vector.hpp>
0016 #include <boost/preprocessor/cat.hpp>
0017 #include <boost/preprocessor/iterate.hpp>
0018 #include <boost/preprocessor/repetition/enum.hpp>
0019 #include <boost/preprocessor/repetition/enum_params.hpp>
0020 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
0021 
0022 #define BOOST_PP_FILENAME_1 <boost/spirit/home/lex/tokenize_and_parse_attr.hpp>
0023 #define BOOST_PP_ITERATION_LIMITS (2, SPIRIT_ARGUMENTS_LIMIT)
0024 #include BOOST_PP_ITERATE()
0025 
0026 #endif
0027 
0028 ///////////////////////////////////////////////////////////////////////////////
0029 //
0030 //  Preprocessor vertical repetition code
0031 //
0032 ///////////////////////////////////////////////////////////////////////////////
0033 #else // defined(BOOST_PP_IS_ITERATING)
0034 
0035 #define N BOOST_PP_ITERATION()
0036 #define BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE(z, n, A) BOOST_PP_CAT(A, n)&
0037 
0038 namespace boost { namespace spirit { namespace lex
0039 {
0040     template <typename Iterator, typename Lexer, typename ParserExpr
0041       , BOOST_PP_ENUM_PARAMS(N, typename A)>
0042     inline bool
0043     tokenize_and_parse(Iterator& first, Iterator last, Lexer const& lex
0044       , ParserExpr const& expr, BOOST_PP_ENUM_BINARY_PARAMS(N, A, & attr))
0045     {
0046         // Report invalid expression error as early as possible.
0047         // If you got an error_invalid_expression error message here,
0048         // then the expression (expr) is not a valid spirit qi expression.
0049         BOOST_SPIRIT_ASSERT_MATCH(qi::domain, ParserExpr);
0050 
0051         typedef fusion::vector<
0052             BOOST_PP_ENUM(N, BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE, A)
0053         > vector_type;
0054 
0055         vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
0056         typename Lexer::iterator_type iter = lex.begin(first, last);
0057         return compile<qi::domain>(expr).parse(
0058             iter, lex.end(), unused, unused, attr);
0059     }
0060 }}}
0061 
0062 #undef BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE
0063 #undef N
0064 
0065 #endif
0066