• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*//////////////////////////////////////////////////////////////////////////////
2     Copyright (c) 2011 Jamboree
3 
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 //////////////////////////////////////////////////////////////////////////////*/
7 
8 //  [ Jamboree Oct 27, 2011 ]       new example.
9 
10 
11 #include <cstdlib>
12 #include <iostream>
13 
14 #include <boost/spirit/include/qi.hpp>
15 #include <boost/spirit/repository/include/qi_seek.hpp>
16 
17 
main()18 int main()
19 {
20     //[reference_qi_seek_namespace
21     namespace qi = boost::spirit::qi;
22     namespace repo = boost::spirit::repository;
23     //]
24 
25     typedef std::string::const_iterator iterator;
26 
27     //[reference_qi_seek_vars
28     std::string str("/*C-style comment*/");
29     iterator it = str.begin();
30     iterator end = str.end();
31     //]
32 
33     //[reference_qi_seek_parse
34     if (qi::parse(it, end, "/*" >> repo::qi::seek["*/"]))
35     {
36         std::cout << "-------------------------------- \n";
37         std::cout << "Parsing succeeded.\n";
38         std::cout << "---------------------------------\n";
39     }
40     else
41     {
42         std::cout << "-------------------------------- \n";
43         std::cout << "Unterminated /* comment.\n";
44         std::cout << "-------------------------------- \n";
45     }//]
46 
47     return EXIT_SUCCESS;
48 }
49