]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/spirit/test/lex/regression_static_wide_6253.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / spirit / test / lex / regression_static_wide_6253.cpp
1 // Copyright (c) 2001-2011 Hartmut Kaiser
2 // Copyright (c) 2011 Ryan Molden
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 #include <boost/detail/lightweight_test.hpp>
8 #include <boost/config/warning_disable.hpp>
9
10 #include <boost/spirit/include/lex_lexertl.hpp>
11 #include <boost/spirit/include/lex_generate_static_lexertl.hpp>
12 #include <boost/spirit/include/lex_static_lexertl.hpp>
13
14 #include <fstream>
15
16 using namespace std;
17 using namespace boost::spirit;
18
19 template <typename BaseLexer>
20 struct my_lexer : boost::spirit::lex::lexer<BaseLexer>
21 {
22 my_lexer()
23 {
24 token = L"Yay winning!";
25 this->self = token;
26 }
27
28 lex::token_def<lex::unused_type, wchar_t> token;
29 };
30
31 int main()
32 {
33 typedef lex::lexertl::token<wchar_t const*> token_type;
34 typedef lex::lexertl::lexer<token_type> lexer_type;
35
36 my_lexer<lexer_type> lexer;
37
38 basic_ofstream<wchar_t> output_dfa("test_dfa.hpp");
39 BOOST_TEST(lex::lexertl::generate_static_dfa(lexer, output_dfa, L"test_dfa"));
40
41 basic_ofstream<wchar_t> output_switch("test_switch.hpp");
42 BOOST_TEST(lex::lexertl::generate_static_switch(lexer, output_switch, L"test_switch"));
43 return boost::report_errors();
44 }