OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
skipper.hpp
Go to the documentation of this file.
1//
2// Struct skipper
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 SKIPPER_HPP_
18#define SKIPPER_HPP_
19
20#include <boost/spirit/include/qi.hpp>
21
22namespace SDDS { namespace parser
23{
24 namespace qi = boost::spirit::qi;
25 namespace ascii = boost::spirit::ascii;
26
28 // The skipper grammar
30 template <typename Iterator>
31 struct skipper : qi::grammar<Iterator>
32 {
33 skipper() : skipper::base_type(start)
34 {
35 qi::eol_type eol;
36 qi::eoi_type eoi;
37 qi::char_type char_;
38 ascii::space_type space;
39
40 start =
41 space
42 | "!" >> *(char_ - eol) >> (eol|eoi) // comments
43 ;
44 }
45
46 qi::rule<Iterator> start;
47 };
48
49 template <typename Iterator>
50 struct listskipper : qi::grammar<Iterator>
51 {
53 {
54 qi::char_type char_;
55 ascii::space_type space;
56
57 start =
58 space
59 | char_(',')
60 ;
61 }
62
63 qi::rule<Iterator> start;
64 };
65
66}}
67
68#endif
69
70
qi::rule< Iterator > start
Definition: skipper.hpp:46
qi::rule< Iterator > start
Definition: skipper.hpp:63