mupp 1.1.0
Loading...
Searching...
No Matches
PSkipper.hpp
Go to the documentation of this file.
1/***************************************************************************
2
3 PSkipper.hpp
4
5 Author: Andreas Suter
6 e-mail: andreas.suter@psi.ch
7
8 Based on Joel de Guzman example on a mini_c,
9 see https://github.com/boostorg/spirit
10
11***************************************************************************/
12
13/***************************************************************************
14 * Copyright (C) 2023 by Andreas Suter *
15 * andreas.suter@psi.ch *
16 * *
17 * This program is free software; you can redistribute it and/or modify *
18 * it under the terms of the GNU General Public License as published by *
19 * the Free Software Foundation; either version 2 of the License, or *
20 * (at your option) any later version. *
21 * *
22 * This program is distributed in the hope that it will be useful, *
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
25 * GNU General Public License for more details. *
26 * *
27 * You should have received a copy of the GNU General Public License *
28 * along with this program; if not, write to the *
29 * Free Software Foundation, Inc., *
30 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
31 ***************************************************************************/
32
33#ifndef _PSKIPPER_HPP_
34#define _PSKIPPER_HPP_
35
36#include <boost/spirit/home/x3.hpp>
37
38namespace mupp { namespace parser
39{
40 namespace x3 = boost::spirit::x3;
41 namespace ascii = boost::spirit::x3::ascii;
42
44
66
67 using x3::char_;
68 using x3::lit;
69 using x3::eol;
70 using ascii::space;
71 using ascii::print;
72
73 inline auto const single_line_comment = (lit('%') | lit('#') | lit("//")) >> *print >> eol;
74
75 inline auto const skipper =
76 space // tab/space/cr/lf
77 | "/*" >> *(char_ - "*/") >> "*/" // C-style comments
79 ;
80}}
81
82#endif // _PSKIPPER_HPP_
83
84
auto const skipper
Definition PSkipper.hpp:75
auto const single_line_comment
Definition PSkipper.hpp:73