1 // Copyright (c) 2008-2009 Ben Hanson
2 // Copyright (c) 2008-2010 Hartmut Kaiser
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6
7 // Auto-generated by boost::lexer, do not edit
8
9 #if !defined(BOOST_SPIRIT_LEXER_NEXT_TOKEN_WC_NOV_10_2009_17_20_04)
10 #define BOOST_SPIRIT_LEXER_NEXT_TOKEN_WC_NOV_10_2009_17_20_04
11
12 #include <boost/spirit/home/support/detail/lexer/char_traits.hpp>
13
14 ////////////////////////////////////////////////////////////////////////////////
15 // the generated table of state names and the tokenizer have to be
16 // defined in the boost::spirit::lex::lexertl::static_ namespace
17 namespace boost { namespace spirit { namespace lex { namespace lexertl { namespace static_ {
18
19 ////////////////////////////////////////////////////////////////////////////////
20 // this table defines the names of the lexer states
21 char const* const lexer_state_names_wc[1] =
22 {
23 "INITIAL"
24 };
25
26 ////////////////////////////////////////////////////////////////////////////////
27 // this variable defines the number of lexer states
28 std::size_t const lexer_state_count_wc = 1;
29
30 ////////////////////////////////////////////////////////////////////////////////
31 // this function returns the next matched token
32 template<typename Iterator>
next_token_wc(std::size_t &,bool &,Iterator & start_token_,Iterator const & end_,std::size_t & unique_id_)33 std::size_t next_token_wc (std::size_t& /*start_state_*/, bool& /*bol_*/,
34 Iterator &start_token_, Iterator const& end_, std::size_t& unique_id_)
35 {
36 enum {end_state_index, id_index, unique_id_index, state_index, bol_index,
37 eol_index, dead_state_index, dfa_offset};
38
39 static const std::size_t npos = static_cast<std::size_t>(~0);
40 static const std::size_t lookup_[256] = {
41 8, 8, 8, 8, 8, 8, 8, 8,
42 8, 9, 7, 8, 8, 8, 8, 8,
43 8, 8, 8, 8, 8, 8, 8, 8,
44 8, 8, 8, 8, 8, 8, 8, 8,
45 9, 8, 8, 8, 8, 8, 8, 8,
46 8, 8, 8, 8, 8, 8, 8, 8,
47 8, 8, 8, 8, 8, 8, 8, 8,
48 8, 8, 8, 8, 8, 8, 8, 8,
49 8, 8, 8, 8, 8, 8, 8, 8,
50 8, 8, 8, 8, 8, 8, 8, 8,
51 8, 8, 8, 8, 8, 8, 8, 8,
52 8, 8, 8, 8, 8, 8, 8, 8,
53 8, 8, 8, 8, 8, 8, 8, 8,
54 8, 8, 8, 8, 8, 8, 8, 8,
55 8, 8, 8, 8, 8, 8, 8, 8,
56 8, 8, 8, 8, 8, 8, 8, 8,
57 8, 8, 8, 8, 8, 8, 8, 8,
58 8, 8, 8, 8, 8, 8, 8, 8,
59 8, 8, 8, 8, 8, 8, 8, 8,
60 8, 8, 8, 8, 8, 8, 8, 8,
61 8, 8, 8, 8, 8, 8, 8, 8,
62 8, 8, 8, 8, 8, 8, 8, 8,
63 8, 8, 8, 8, 8, 8, 8, 8,
64 8, 8, 8, 8, 8, 8, 8, 8,
65 8, 8, 8, 8, 8, 8, 8, 8,
66 8, 8, 8, 8, 8, 8, 8, 8,
67 8, 8, 8, 8, 8, 8, 8, 8,
68 8, 8, 8, 8, 8, 8, 8, 8,
69 8, 8, 8, 8, 8, 8, 8, 8,
70 8, 8, 8, 8, 8, 8, 8, 8,
71 8, 8, 8, 8, 8, 8, 8, 8,
72 8, 8, 8, 8, 8, 8, 8, 8 };
73 static const std::size_t dfa_alphabet_ = 10;
74 static const std::size_t dfa_[50] = {
75 0, 0, 0, 0, 0, 0, 0, 0,
76 0, 0, 0, 0, 0, 0, 0, 0,
77 0, 3, 2, 4, 1, 65536, 0, 0,
78 0, 0, 0, 0, 2, 0, 1, 10,
79 1, 0, 0, 0, 0, 0, 0, 0,
80 1, 65537, 2, 0, 0, 0, 0, 0,
81 0, 0 };
82
83 if (start_token_ == end_)
84 {
85 unique_id_ = npos;
86 return 0;
87 }
88
89 std::size_t const* ptr_ = dfa_ + dfa_alphabet_;
90 Iterator curr_ = start_token_;
91 bool end_state_ = *ptr_ != 0;
92 std::size_t id_ = *(ptr_ + id_index);
93 std::size_t uid_ = *(ptr_ + unique_id_index);
94 Iterator end_token_ = start_token_;
95
96 while (curr_ != end_)
97 {
98 std::size_t const state_ =
99 ptr_[lookup_[static_cast<unsigned char>(*curr_++)]];
100
101 if (state_ == 0) break;
102
103 ptr_ = &dfa_[state_ * dfa_alphabet_];
104
105 if (*ptr_)
106 {
107 end_state_ = true;
108 id_ = *(ptr_ + id_index);
109 uid_ = *(ptr_ + unique_id_index);
110 end_token_ = curr_;
111 }
112 }
113
114 if (end_state_)
115 {
116 // return longest match
117 start_token_ = end_token_;
118 }
119 else
120 {
121 id_ = npos;
122 uid_ = npos;
123 }
124
125 unique_id_ = uid_;
126 return id_;
127 }
128
129 ////////////////////////////////////////////////////////////////////////////////
130 // this defines a generic accessors for the information above
131 struct lexer_wc
132 {
133 // version number and feature-set of compatible static lexer engine
134 enum
135 {
136 static_version = 65536,
137 supports_bol = false,
138 supports_eol = false
139 };
140
141 // return the number of lexer states
state_countboost::spirit::lex::lexertl::static_::lexer_wc142 static std::size_t state_count()
143 {
144 return lexer_state_count_wc;
145 }
146
147 // return the name of the lexer state as given by 'idx'
state_nameboost::spirit::lex::lexertl::static_::lexer_wc148 static char const* state_name(std::size_t idx)
149 {
150 return lexer_state_names_wc[idx];
151 }
152
153 // return the next matched token
154 template<typename Iterator>
nextboost::spirit::lex::lexertl::static_::lexer_wc155 static std::size_t next(std::size_t &start_state_, bool& bol_
156 , Iterator &start_token_, Iterator const& end_, std::size_t& unique_id_)
157 {
158 return next_token_wc(start_state_, bol_, start_token_, end_, unique_id_);
159 }
160 };
161
162 }}}}} // namespace boost::spirit::lex::lexertl::static_
163
164 #endif
165