1 | #include <fstream>
|
---|
2 | #include <boost/config/warning_disable.hpp>
|
---|
3 | #include <boost/spirit/include/lex_lexertl.hpp>
|
---|
4 | #include <boost/spirit/include/lex_generate_static_lexertl.hpp>
|
---|
5 | #include <boost/spirit/include/lex_static_lexertl.hpp>
|
---|
6 |
|
---|
7 | using namespace std;
|
---|
8 | using namespace boost::spirit;
|
---|
9 |
|
---|
10 | template <typename BaseLexer>
|
---|
11 | struct MyLexer : boost::spirit::lex::lexer<BaseLexer>
|
---|
12 | {
|
---|
13 | MyLexer()
|
---|
14 | {
|
---|
15 | token = L"Yay winning!";
|
---|
16 | this->self = token;
|
---|
17 | }
|
---|
18 |
|
---|
19 |
|
---|
20 | lex::token_def<lex::unused_type, wchar_t> token;
|
---|
21 | };
|
---|
22 |
|
---|
23 | int main(int argc, char* argv[])
|
---|
24 | {
|
---|
25 | typedef lex::lexertl::token<const wchar_t*> token_type;
|
---|
26 | typedef lex::lexertl::lexer<token_type> lexer_type;
|
---|
27 |
|
---|
28 | MyLexer<lexer_type> lexer;
|
---|
29 |
|
---|
30 | ofstream outputStream("test.hpp");
|
---|
31 |
|
---|
32 | return lex::lexertl::generate_static_dfa(lexer, outputStream, "test") ? 0 : -1;
|
---|
33 | }
|
---|