]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/spirit/classic/example/techniques/no_rules/no_rule2.cpp
1 /*=============================================================================
2 Copyright (c) 2002-2003 Joel de Guzman
3 http://spirit.sourceforge.net/
5 Use, modification and distribution is subject to the Boost Software
6 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 http://www.boost.org/LICENSE_1_0.txt)
8 =============================================================================*/
10 // *** See the section "Look Ma' No Rules" in
11 // *** chapter "Techniques" of the Spirit documentation
12 // *** for information regarding this snippet
15 #include <boost/spirit/include/classic_core.hpp>
16 #include <boost/assert.hpp>
18 using namespace BOOST_SPIRIT_CLASSIC_NS
;
20 struct skip_grammar
: grammar
<skip_grammar
>
22 template <typename ScannerT
>
25 definition(skip_grammar
const& /*self*/)
28 | "//" >> *(anychar_p
- '\n') >> '\n'
29 | "/*" >> *(anychar_p
- "*/") >> "*/"
35 alternative
<alternative
<space_parser
, sequence
<sequence
<
36 strlit
<const char*>, kleene_star
<difference
<anychar_parser
,
37 chlit
<char> > > >, chlit
<char> > >, sequence
<sequence
<
38 strlit
<const char*>, kleene_star
<difference
<anychar_parser
,
39 strlit
<const char*> > > >, strlit
<const char*> > >
44 start() const { return skip
; }
53 "/*this is a comment*/\n//this is a c++ comment\n\n",
55 BOOST_ASSERT(success
);
56 std::cout
<< "SUCCESS!!!\n";