OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
include_def.hpp
Go to the documentation of this file.
1 //
2 // Copyright & License: See Copyright.readme in src directory
3 //
4 
9 #ifndef INCLUDE_DEF_HPP_
10 #define INCLUDE_DEF_HPP_
11 
12 #include "include.hpp"
13 
14 #include <boost/spirit/include/phoenix_core.hpp>
15 #include <boost/spirit/include/phoenix_operator.hpp>
16 #include <boost/spirit/include/phoenix_fusion.hpp>
17 #include <boost/spirit/include/phoenix_bind.hpp>
18 
19 namespace SDDS { namespace parser
20 {
21  template <typename Iterator>
23  include_parser::base_type(start)
24  {
25  using qi::on_error;
26  using qi::fail;
27  using phx::function;
28  typedef function<error_handler<Iterator> > error_handler_function;
29 
30  qi::_3_type _3;
31  qi::_4_type _4;
32  qi::lexeme_type lexeme;
33  qi::char_type char_;
34  qi::lit_type lit;
35  qi::alpha_type alpha;
36  qi::alnum_type alnum;
37  qi::_pass_type _pass;
38 
39  quoted_string %= lexeme['"' >> +(char_ - '"') >> '"'];
40  string %= quoted_string
41  | lexeme[(alpha | '_') >> *(alnum | '_')];
42 
43  include_filename = lit("filename") > '=' > string;
44 
45  auto complainInclude = phx::bind(&include::complainUnsupported<include::INCLUDE>::apply);
46 
47  start =
48  lit("&include")[_pass = complainInclude]
49  > lit("&end");
50 
51  BOOST_SPIRIT_DEBUG_NODES(
52  (start)
53  )
54 
55  on_error<fail>(start,
56  error_handler_function(_error_handler)(
57  std::string("Error! Expecting "), _4, _3));
58  }
59 }}
60 #endif /* INCLUDE_DEF_HPP_ */
constexpr double alpha
The fine structure constant, no dimension.
Definition: Physics.h:79
qi::rule< Iterator, std::string(), skipper< Iterator > > string
Definition: include.hpp:78
qi::rule< Iterator, include(), skipper< Iterator > > start
Definition: include.hpp:77
include_parser(error_handler< Iterator > &_error_handler)
Definition: include_def.hpp:22
qi::rule< Iterator, std::string(), skipper< Iterator > > include_filename
Definition: include.hpp:78
qi::rule< Iterator, std::string(), skipper< Iterator > > quoted_string
Definition: include.hpp:78