]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/spirit/repository/example/qi/seek.cpp
1 /*//////////////////////////////////////////////////////////////////////////////
2 Copyright (c) 2011 Jamboree
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //////////////////////////////////////////////////////////////////////////////*/
8 // [ Jamboree Oct 27, 2011 ] new example.
14 #include <boost/spirit/include/qi.hpp>
15 #include <boost/spirit/repository/include/qi_seek.hpp>
18 int main(int argc
, char *argv
[])
20 //[reference_qi_seek_namespace
21 namespace qi
= boost::spirit::qi
;
22 namespace repo
= boost::spirit::repository
;
25 typedef std::string::const_iterator iterator
;
27 //[reference_qi_seek_vars
28 std::string
str("/*C-style comment*/");
29 iterator it
= str
.begin();
30 iterator end
= str
.end();
33 //[reference_qi_seek_parse
34 if (qi::parse(it
, end
, "/*" >> repo::qi::seek
["*/"]))
36 std::cout
<< "-------------------------------- \n";
37 std::cout
<< "Parsing succeeded.\n";
38 std::cout
<< "---------------------------------\n";
42 std::cout
<< "-------------------------------- \n";
43 std::cout
<< "Unterminated /* comment.\n";
44 std::cout
<< "-------------------------------- \n";