OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
associate.hpp
Go to the documentation of this file.
1 //
2 // Copyright & License: See Copyright.readme in src directory
3 //
4 
9 #ifndef ASSOCIATE_HPP_
10 #define ASSOCIATE_HPP_
11 
12 #include "ast.hpp"
13 #include "skipper.hpp"
14 #include "error_handler.hpp"
15 
16 #include <boost/config/warning_disable.hpp>
17 #include <boost/spirit/include/qi.hpp>
18 #include <boost/spirit/include/phoenix_core.hpp>
19 #include <boost/spirit/include/phoenix_operator.hpp>
20 #include <boost/spirit/include/phoenix_fusion.hpp>
21 #include <boost/spirit/include/phoenix_bind.hpp>
22 #include <boost/fusion/include/adapt_struct.hpp>
23 
24 #include <list>
25 
26 #define BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
27 #define BOOST_SPIRIT_QI_DEBUG
28 
29 namespace SDDS {
30  struct associate
31  {
34  , PATH
37  , SDDS
39  };
40 
41  template <attributes A>
43  {
44  static bool apply()
45  {
46  std::string attributeString;
47  switch(A)
48  {
49  case NAME:
50  attributeString = "name";
51  break;
52  case FILENAME:
53  attributeString = "filename";
54  break;
55  case PATH:
56  attributeString = "path";
57  break;
58  case DESCRIPTION:
59  attributeString = "description";
60  break;
61  case CONTENTS:
62  attributeString = "contents";
63  break;
64  case SDDS:
65  attributeString = "sdds";
66  break;
67  case ASSOCIATE:
68  attributeString = "associate";
69  break;
70  default:
71  return true;
72  }
73  std::cerr << attributeString << " not supported yet" << std::endl;
74  return false;
75  }
76  };
77  };
78 
79  struct associateList: std::list<associate> {};
80 
81  inline std::ostream& operator<<(std::ostream& out, const associate& ) {
82  return out;
83  }
84 }
85 
86 namespace SDDS { namespace parser
87 {
88  namespace qi = boost::spirit::qi;
89  namespace ascii = boost::spirit::ascii;
90  namespace phx = boost::phoenix;
91 
92  template <typename Iterator>
93  struct associate_parser: qi::grammar<Iterator, associate(), skipper<Iterator> >
94  {
95  associate_parser(error_handler<Iterator> & _error_handler);
96 
97  qi::rule<Iterator, associate(), skipper<Iterator> > start;
98  qi::rule<Iterator, std::string(), skipper<Iterator> > string, quoted_string,
101  qi::rule<Iterator, long(), skipper<Iterator> > associate_sdds;
102  qi::rule<Iterator, ast::nil(), skipper<Iterator> > associate_unsupported_pre,
104  };
105 }}
106 #endif /* ASSOCIATE_HPP_ */
qi::rule< Iterator, std::string(), skipper< Iterator > > string
Definition: associate.hpp:98
qi::rule< Iterator, long(), skipper< Iterator > > associate_sdds
Definition: associate.hpp:101
qi::rule< Iterator, std::string(), skipper< Iterator > > associate_path
Definition: associate.hpp:98
qi::rule< Iterator, std::string(), skipper< Iterator > > associate_name
Definition: associate.hpp:98
qi::rule< Iterator, std::string(), skipper< Iterator > > associate_filename
Definition: associate.hpp:98
qi::rule< Iterator, associate(), skipper< Iterator > > start
Definition: associate.hpp:97
qi::rule< Iterator, std::string(), skipper< Iterator > > quoted_string
Definition: associate.hpp:98
qi::rule< Iterator, std::string(), skipper< Iterator > > associate_contents
Definition: associate.hpp:98
qi::rule< Iterator, ast::nil(), skipper< Iterator > > associate_unsupported_post
Definition: associate.hpp:102
qi::rule< Iterator, std::string(), skipper< Iterator > > associate_description
Definition: associate.hpp:98
associate_parser(error_handler< Iterator > &_error_handler)
std::ostream & operator<<(std::ostream &out, const array &)
Definition: array.hpp:89
qi::rule< Iterator, ast::nil(), skipper< Iterator > > associate_unsupported_pre
Definition: associate.hpp:102
Inform & endl(Inform &inf)
Definition: Inform.cpp:42