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/spirit/include/lex_static_lexertl.hpp>
8
9#include <boost/spirit/include/lex_generate_static_lexertl.hpp>
10#include <boost/spirit/include/lex_lexertl.hpp>
11
12#include <boost/core/lightweight_test.hpp>
13#include <fstream>
14
15using namespace std;
16using namespace boost::spirit;
17
18template <typename BaseLexer>
19struct my_lexer : boost::spirit::lex::lexer<BaseLexer>
20{
21 my_lexer()
22 {
23 token = L"Yay winning!";
24 this->self = token;
25 }
26
27 lex::token_def<lex::unused_type, wchar_t> token;
28};
29
30int main()
31{
32 typedef lex::lexertl::token<wchar_t const*> token_type;
33 typedef lex::lexertl::lexer<token_type> lexer_type;
34
35 my_lexer<lexer_type> lexer;
36
37 basic_ofstream<wchar_t> output_dfa("test_dfa.hpp");
38 BOOST_TEST(lex::lexertl::generate_static_dfa(lexer, output_dfa, L"test_dfa"));
39
40 basic_ofstream<wchar_t> output_switch("test_switch.hpp");
41 BOOST_TEST(lex::lexertl::generate_static_switch(lexer, output_switch, L"test_switch"));
42 return boost::report_errors();
43}
44

source code of boost/libs/spirit/test/lex/regression_static_wide_6253.cpp