OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
include.hpp
Go to the documentation of this file.
1//
2// Struct include
3//
4// Copyright (c) 2015, Christof Metzger-Kraus, Helmholtz-Zentrum Berlin
5// All rights reserved
6//
7// This file is part of OPAL.
8//
9// OPAL is free software: you can redistribute it and/or modify
10// it under the terms of the GNU General Public License as published by
11// the Free Software Foundation, either version 3 of the License, or
12// (at your option) any later version.
13//
14// You should have received a copy of the GNU General Public License
15// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
16//
17#ifndef INCLUDE_HPP_
18#define INCLUDE_HPP_
19
20#include "ast.hpp"
21#include "skipper.hpp"
22#include "error_handler.hpp"
23
24#include <boost/config/warning_disable.hpp>
25#include <boost/spirit/include/qi.hpp>
26#include <boost/spirit/include/phoenix_core.hpp>
27#include <boost/spirit/include/phoenix_operator.hpp>
28#include <boost/spirit/include/phoenix_fusion.hpp>
29#include <boost/spirit/include/phoenix_bind.hpp>
30#include <boost/fusion/include/adapt_struct.hpp>
31
32#include <list>
33
34#define BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
35#define BOOST_SPIRIT_QI_DEBUG
36
37namespace SDDS {
38 struct include
39 {
42 };
43
44 template <attributes A>
46 {
47 static bool apply()
48 {
49 std::string attributeString;
50 switch(A)
51 {
52 case FILENAME:
53 attributeString = "filename";
54 break;
55 case INCLUDE:
56 attributeString = "include";
57 break;
58 default:
59 return true;
60 }
61 std::cerr << attributeString << " not supported yet" << std::endl;
62 return false;
63 }
64 };
65 };
66
67 struct includeList: std::list<include> {};
68
69 inline std::ostream& operator<<(std::ostream& out, const include& ) {
70 return out;
71 }
72}
73
74namespace SDDS { namespace parser
75{
76 namespace qi = boost::spirit::qi;
77 namespace ascii = boost::spirit::ascii;
78 namespace phx = boost::phoenix;
79
80 template <typename Iterator>
81 struct include_parser: qi::grammar<Iterator, include(), skipper<Iterator> >
82 {
84
85 qi::rule<Iterator, include(), skipper<Iterator> > start;
86 qi::rule<Iterator, std::string(), skipper<Iterator> > string, quoted_string,
88 };
89}}
90#endif /* INCLUDE_HPP_ */
Inform & endl(Inform &inf)
Definition: Inform.cpp:42
std::ostream & operator<<(std::ostream &out, const array &)
Definition: array.hpp:97
qi::rule< Iterator, include(), skipper< Iterator > > start
Definition: include.hpp:85
include_parser(error_handler< Iterator > &_error_handler)
Definition: include_def.hpp:30
qi::rule< Iterator, std::string(), skipper< Iterator > > include_filename
Definition: include.hpp:87
qi::rule< Iterator, std::string(), skipper< Iterator > > quoted_string
Definition: include.hpp:86
qi::rule< Iterator, std::string(), skipper< Iterator > > string
Definition: include.hpp:86