1 | /*
|
---|
2 | * TOPPERS Software
|
---|
3 | * Toyohashi Open Platform for Embedded Real-Time Systems
|
---|
4 | *
|
---|
5 | * Copyright (C) 2005-2008 by TAKAGI Nobuhisa
|
---|
6 | *
|
---|
7 | * ãLì ÒÍCȺÌ(1)`(4)Ìðð½·êÉÀèC{\tgEF
|
---|
8 | * Ai{\tgEFAðüϵ½àÌðÜÞDȺ¯¶jðgpE¡»Eü
|
---|
9 | * ÏEÄzziȺCpÆÄÔj·é±Æð³Åø·éD
|
---|
10 | * (1) {\tgEFAð\[XR[hÌ`Åp·éêÉÍCãLÌì
|
---|
11 | * \¦C±Ìpð¨æÑºLÌ³ÛØKèªC»ÌÜÜÌ`Å\[
|
---|
12 | * XR[hÉÜÜêĢ鱯D
|
---|
13 | * (2) {\tgEFAðCCu`®ÈÇC¼Ì\tgEFAJÉg
|
---|
14 | * pÅ«é`ÅÄzz·éêÉÍCÄzzɺ¤hL
|
---|
15 | gip
|
---|
16 | * Ò}j
|
---|
17 | AÈÇjÉCãLÌì \¦C±Ìpð¨æÑºL
|
---|
18 | * Ì³ÛØKèðfÚ·é±ÆD
|
---|
19 | * (3) {\tgEFAðC@íÉgÝÞÈÇC¼Ì\tgEFAJÉg
|
---|
20 | * pūȢ`ÅÄzz·éêÉÍCÌ¢¸ê©Ìðð½·±
|
---|
21 | * ÆD
|
---|
22 | * (a) Äzzɺ¤hL
|
---|
23 | gipÒ}j
|
---|
24 | AÈÇjÉCãLÌ
|
---|
25 | * ì \¦C±Ìpð¨æÑºLÌ³ÛØKèðfÚ·é±ÆD
|
---|
26 | * (b) ÄzzÌ`ÔðCÊÉèßéû@ÉæÁÄCTOPPERSvWFNgÉ
|
---|
27 | * ñ·é±ÆD
|
---|
28 | * (4) {\tgEFAÌpÉæè¼ÚIܽÍÔÚIɶ¶é¢©Èé¹
|
---|
29 | * Q©çàCãLì Ò¨æÑTOPPERSvWFNgðÆÓ·é±ÆD
|
---|
30 | * ܽC{\tgEFAÌ[UܽÍGh[U©çÌ¢©Èé
|
---|
31 | * RÉîÿ©çàCãLì Ò¨æÑTOPPERSvWFNgð
|
---|
32 | * ÆÓ·é±ÆD
|
---|
33 | *
|
---|
34 | * {\tgEFAÍC³ÛØÅñ³êÄ¢éàÌÅ éDãLì Ò¨
|
---|
35 | * æÑTOPPERSvWFNgÍC{\tgEFAÉÖµÄCÁèÌgpÚI
|
---|
36 | * ÉηéK«àÜßÄC¢©ÈéÛØàsíÈ¢DܽC{\tgEF
|
---|
37 | * AÌpÉæè¼ÚIܽÍÔÚIɶ¶½¢©Èé¹QÉÖµÄàC»
|
---|
38 | * ÌÓCðíÈ¢D
|
---|
39 | *
|
---|
40 | */
|
---|
41 |
|
---|
42 | /*!
|
---|
43 | * \file toppers/c_parser.hpp
|
---|
44 | * \brief êÊIÈp[T[Ìé¾è`
|
---|
45 | */
|
---|
46 | #ifndef TOPPERS_PARSER_HPP_
|
---|
47 | #define TOPPERS_PARSER_HPP_
|
---|
48 |
|
---|
49 | #include "toppers/codeset.hpp"
|
---|
50 | #include <boost/spirit/core.hpp>
|
---|
51 | #include <boost/spirit/actor.hpp>
|
---|
52 | #include <boost/spirit/utility.hpp>
|
---|
53 | #include <boost/spirit/dynamic.hpp>
|
---|
54 |
|
---|
55 | namespace toppers
|
---|
56 | {
|
---|
57 |
|
---|
58 | namespace detail
|
---|
59 | {
|
---|
60 |
|
---|
61 | struct c_integer_suffix_parse_functor
|
---|
62 | {
|
---|
63 | typedef boost::spirit::nil_t result_t;
|
---|
64 | template < class Scanner >
|
---|
65 | int operator()( Scanner scan, result_t& ) const
|
---|
66 | {
|
---|
67 | using namespace boost::spirit;
|
---|
68 | int length =
|
---|
69 | as_lower_d
|
---|
70 | [
|
---|
71 | ch_p( 'u' ) >> !( str_p( "ll" ) | 'l' | "i8" | "i16" | "i32" | "i64" )
|
---|
72 | | ( str_p( "ll" ) | 'l' | "i8" | "i16" | "i32" | "i64" ) >> !ch_p( 'u' )
|
---|
73 | ].parse( scan ).length();
|
---|
74 | return length;
|
---|
75 | }
|
---|
76 | };
|
---|
77 |
|
---|
78 | template < typename T >
|
---|
79 | struct c_integer_constant_parse_functor
|
---|
80 | {
|
---|
81 | typedef T result_t;
|
---|
82 | template < class Scanner >
|
---|
83 | int operator()( Scanner scan, result_t& result ) const
|
---|
84 | {
|
---|
85 | using namespace boost::spirit;
|
---|
86 | result_t x = T( 0 );
|
---|
87 | int length =
|
---|
88 | (
|
---|
89 | if_p( '0' ) // 16iܽÍ8i
|
---|
90 | [
|
---|
91 | !(
|
---|
92 | ( ch_p( 'x' ) | 'X' ) >> uint_parser< T, 16 >()[ assign_a( x ) ]
|
---|
93 | | uint_parser< T, 8 >()[ assign_a( x ) ]
|
---|
94 | )
|
---|
95 | ]
|
---|
96 | .else_p // 10i
|
---|
97 | [
|
---|
98 | uint_parser< T, 10 >()[ assign_a( x ) ]
|
---|
99 | ]
|
---|
100 | ).parse( scan ).length();
|
---|
101 | result = x;
|
---|
102 | return length;
|
---|
103 | }
|
---|
104 | };
|
---|
105 |
|
---|
106 | template < typename T >
|
---|
107 | struct c_integer_parse_functor
|
---|
108 | {
|
---|
109 | typedef T result_t;
|
---|
110 | template < class Scanner >
|
---|
111 | int operator()( Scanner scan, result_t& result ) const
|
---|
112 | {
|
---|
113 | using namespace boost::spirit;
|
---|
114 | static functor_parser< c_integer_constant_parse_functor< T > > const c_int_const_p;
|
---|
115 | static functor_parser< c_integer_suffix_parse_functor > const c_int_suffix_p;
|
---|
116 | bool negative = false;
|
---|
117 | result_t x;
|
---|
118 | int length =
|
---|
119 | (
|
---|
120 | !sign_p[ assign_a( negative ) ] >> lexeme_d[ c_int_const_p[ assign_a( x ) ] >> !c_int_suffix_p ]
|
---|
121 | ).parse( scan ).length();
|
---|
122 | result = ( negative ? -x : x );
|
---|
123 | return length;
|
---|
124 | }
|
---|
125 | };
|
---|
126 |
|
---|
127 | template < int CodeSet = -1 > struct mbchar_parse_functor;
|
---|
128 |
|
---|
129 | template <>
|
---|
130 | struct mbchar_parse_functor< ascii >
|
---|
131 | {
|
---|
132 | typedef boost::spirit::nil_t result_t;
|
---|
133 | template < class Scanner >
|
---|
134 | int operator()( Scanner scan, result_t& ) const
|
---|
135 | {
|
---|
136 | return boost::spirit::range_p( '\x01', '\x7f' ).parse( scan ).length();
|
---|
137 | }
|
---|
138 | };
|
---|
139 |
|
---|
140 | template <>
|
---|
141 | struct mbchar_parse_functor< shift_jis >
|
---|
142 | {
|
---|
143 | typedef boost::spirit::nil_t result_t;
|
---|
144 | template < class Scanner >
|
---|
145 | int operator()( Scanner scan, result_t& ) const
|
---|
146 | {
|
---|
147 | using namespace boost::spirit;
|
---|
148 | int length =
|
---|
149 | (
|
---|
150 | range_p( '\x01', '\x7f' ) // ¼ppL
|
---|
151 | | range_p( '\xa1', '\xdf' ) // ¼pJ^Ji
|
---|
152 | | ( chset<>( "\x81-\x9f\xe0-\xef" ) >> chset<>( "\x40-\x7e\x80-\xfc" ) ) // Sp
|
---|
153 | ).parse( scan ).length();
|
---|
154 | return length;
|
---|
155 | }
|
---|
156 | };
|
---|
157 |
|
---|
158 | template <>
|
---|
159 | struct mbchar_parse_functor< euc_jp >
|
---|
160 | {
|
---|
161 | typedef boost::spirit::nil_t result_t;
|
---|
162 | template < class Scanner >
|
---|
163 | int operator()( Scanner scan, result_t& ) const
|
---|
164 | {
|
---|
165 | using namespace boost::spirit;
|
---|
166 | int length =
|
---|
167 | (
|
---|
168 | range_p( '\x01', '\x7f' ) // ¼ppL
|
---|
169 | | ( ch_p( '\x8e' ) >> range_p( '\xa1', '\xdf' ) ) // ¼pJ^Ji
|
---|
170 | | ( !ch_p( '\x8f' ) >> range_p( '\xa1', '\xf0' ) >> range_p( '\xa1', '\xf0' ) ) // Sp
|
---|
171 | ).parse( scan ).length();
|
---|
172 | return length;
|
---|
173 | }
|
---|
174 | };
|
---|
175 |
|
---|
176 | template <>
|
---|
177 | struct mbchar_parse_functor< utf8 >
|
---|
178 | {
|
---|
179 | typedef boost::spirit::nil_t result_t;
|
---|
180 | template < class Scanner >
|
---|
181 | int operator()( Scanner scan, result_t& ) const
|
---|
182 | {
|
---|
183 | using namespace boost::spirit;
|
---|
184 | int length =
|
---|
185 | (
|
---|
186 | range_p( '\x01', '\x7f' ) // 1oCg
|
---|
187 | | ( range_p( '\xc0', '\xdf' ) >> range_p( '\x80', '\xbf' ) ) // 2oCg
|
---|
188 | | ( range_p( '\xe0', '\xef' ) >> repeat_p( 2 )[ range_p( '\x80', '\xbf' ) ] ) // 3oCg
|
---|
189 | | ( range_p( '\xf0', '\xf7' ) >> repeat_p( 3 )[ range_p( '\x80', '\xbf' ) ] ) // 4oCg
|
---|
190 | | ( range_p( '\xf8', '\xfb' ) >> repeat_p( 4 )[ range_p( '\x80', '\xbf' ) ] ) // 5oCg
|
---|
191 | | ( range_p( '\xfc', '\xfd' ) >> repeat_p( 5 )[ range_p( '\x80', '\xbf' ) ] ) // 6oCg
|
---|
192 | ).parse( scan ).length();
|
---|
193 | return length;
|
---|
194 | }
|
---|
195 | };
|
---|
196 |
|
---|
197 | template <>
|
---|
198 | struct mbchar_parse_functor< -1 >
|
---|
199 | {
|
---|
200 | typedef boost::spirit::nil_t result_t;
|
---|
201 | explicit mbchar_parse_functor( codeset_t codeset = ascii ) : codeset_( codeset ) {}
|
---|
202 | template < class Scanner >
|
---|
203 | int operator()( Scanner scan, result_t& result ) const
|
---|
204 | {
|
---|
205 | int length;
|
---|
206 | switch ( codeset_ )
|
---|
207 | {
|
---|
208 | case ascii:
|
---|
209 | {
|
---|
210 | static mbchar_parse_functor< ascii > f;
|
---|
211 | length = f( scan, result );
|
---|
212 | }
|
---|
213 | break;
|
---|
214 | case shift_jis:
|
---|
215 | {
|
---|
216 | static mbchar_parse_functor< shift_jis > f;
|
---|
217 | length = f( scan, result );
|
---|
218 | }
|
---|
219 | break;
|
---|
220 | case euc_jp:
|
---|
221 | {
|
---|
222 | static mbchar_parse_functor< euc_jp > f;
|
---|
223 | length = f( scan, result );
|
---|
224 | }
|
---|
225 | break;
|
---|
226 | case utf8:
|
---|
227 | {
|
---|
228 | static mbchar_parse_functor< utf8 > f;
|
---|
229 | length = f( scan, result );
|
---|
230 | }
|
---|
231 | break;
|
---|
232 | default:
|
---|
233 | length = -1;
|
---|
234 | break;
|
---|
235 | }
|
---|
236 | return length;
|
---|
237 | }
|
---|
238 | codeset_t codeset_;
|
---|
239 | };
|
---|
240 |
|
---|
241 | struct ucn_parse_functor
|
---|
242 | {
|
---|
243 | typedef long result_t;
|
---|
244 | template < class Scanner >
|
---|
245 | int operator()( Scanner scan, result_t& result ) const
|
---|
246 | {
|
---|
247 | using namespace boost::spirit;
|
---|
248 | result_t x;
|
---|
249 | int length =
|
---|
250 | (
|
---|
251 | lexeme_d
|
---|
252 | [
|
---|
253 | ch_p( '\\' ) >>
|
---|
254 | (
|
---|
255 | ( 'U' >> int_parser< long, 16, 8, 8 >()[ assign_a( x ) ] ) // \Uhhhhhhhh`®
|
---|
256 | | ( 'u' >> int_parser< long, 16, 4, 4 >()[ assign_a( x ) ] ) // \uhhhh`®
|
---|
257 | )
|
---|
258 | ]
|
---|
259 | ).parse( scan ).length();
|
---|
260 | if ( ( x < 0xa0 && !( x == 0x24 || x == 0x40 || x == 0x60 ) )
|
---|
261 | || ( 0xd800 <= x && x <= 0xdfff )
|
---|
262 | || 0x10ffff < x ) // Û¶¼Ég¦È¢liJIS X3010:2003 6.4.3j
|
---|
263 | {
|
---|
264 | x = -1;
|
---|
265 | }
|
---|
266 | result = x;
|
---|
267 | return length;
|
---|
268 | }
|
---|
269 | };
|
---|
270 |
|
---|
271 | template < int CodeSet = -1 > struct c_strlit_parse_functor;
|
---|
272 |
|
---|
273 | template < int CodeSet >
|
---|
274 | struct c_strlit_parse_functor
|
---|
275 | {
|
---|
276 | typedef boost::spirit::nil_t result_t;
|
---|
277 | template < class Scanner >
|
---|
278 | int operator()( Scanner scan, result_t& result ) const
|
---|
279 | {
|
---|
280 | using namespace boost::spirit;
|
---|
281 | static functor_parser< detail::mbchar_parse_functor< CodeSet > > const mbchar_p;
|
---|
282 | static functor_parser< detail::ucn_parse_functor > const ucn_p;
|
---|
283 | int length =
|
---|
284 | (
|
---|
285 | confix_p( '\"', *( "\\\"" | mbchar_p - '\\' | ucn_p | c_escape_ch_p ), '\"' )
|
---|
286 | ).parse( scan ).length();
|
---|
287 | return length;
|
---|
288 | }
|
---|
289 | };
|
---|
290 |
|
---|
291 | template <>
|
---|
292 | struct c_strlit_parse_functor< -1 >
|
---|
293 | {
|
---|
294 | typedef boost::spirit::nil_t result_t;
|
---|
295 | explicit c_strlit_parse_functor( codeset_t codeset = ascii ) : codeset_( codeset ) {}
|
---|
296 | template < class Scanner >
|
---|
297 | int operator()( Scanner scan, result_t& result ) const
|
---|
298 | {
|
---|
299 | using namespace boost::spirit;
|
---|
300 | mbchar_parse_functor<> const functor( codeset_ );
|
---|
301 | functor_parser< detail::mbchar_parse_functor<> > const mbchar_p( functor );
|
---|
302 | static functor_parser< detail::ucn_parse_functor > const ucn_p;
|
---|
303 | int length =
|
---|
304 | (
|
---|
305 | confix_p( '\"', *( "\\\"" | ( mbchar_p - ch_p( '\\' ) ) | ucn_p | c_escape_ch_p ), '\"' )
|
---|
306 | ).parse( scan ).length();
|
---|
307 | return length;
|
---|
308 | }
|
---|
309 | codeset_t codeset_;
|
---|
310 | };
|
---|
311 |
|
---|
312 | template < int CodeSet = -1 > struct c_chlit_parse_functor;
|
---|
313 |
|
---|
314 | template < int CodeSet >
|
---|
315 | struct c_chlit_parse_functor
|
---|
316 | {
|
---|
317 | typedef boost::spirit::nil_t result_t;
|
---|
318 | template < class Scanner >
|
---|
319 | int operator()( Scanner scan, result_t& result ) const
|
---|
320 | {
|
---|
321 | using namespace boost::spirit;
|
---|
322 | static functor_parser< detail::mbchar_parse_functor< CodeSet > > const mbchar_p;
|
---|
323 | static functor_parser< detail::ucn_parse_functor > const ucn_p;
|
---|
324 | int length =
|
---|
325 | (
|
---|
326 | confix_p( '\'', +( "\\\'" | mbchar_p - '\\' | ucn_p | c_escape_ch_p ), '\'' )
|
---|
327 | ).parse( scan ).length();
|
---|
328 | return length;
|
---|
329 | }
|
---|
330 | };
|
---|
331 |
|
---|
332 | template <>
|
---|
333 | struct c_chlit_parse_functor< -1 >
|
---|
334 | {
|
---|
335 | typedef boost::spirit::nil_t result_t;
|
---|
336 | explicit c_chlit_parse_functor( codeset_t codeset = ascii ) : codeset_( codeset ) {}
|
---|
337 | template < class Scanner >
|
---|
338 | int operator()( Scanner scan, result_t& result ) const
|
---|
339 | {
|
---|
340 | using namespace boost::spirit;
|
---|
341 | mbchar_parse_functor<> const functor( codeset_ );
|
---|
342 | functor_parser< detail::mbchar_parse_functor<> > const mbchar_p( functor );
|
---|
343 | static functor_parser< detail::ucn_parse_functor > const ucn_p;
|
---|
344 | int length =
|
---|
345 | (
|
---|
346 | confix_p( '\'', +( "\\\'" | mbchar_p - '\\' | ucn_p | c_escape_ch_p ), '\'' )
|
---|
347 | ).parse( scan ).length();
|
---|
348 | return length;
|
---|
349 | }
|
---|
350 | codeset_t codeset_;
|
---|
351 | };
|
---|
352 |
|
---|
353 | extern char const* const c_keywords[];
|
---|
354 | extern char const* const c_plus_plus_keywords[];
|
---|
355 |
|
---|
356 | struct c_identifier_parse_functor
|
---|
357 | {
|
---|
358 | typedef boost::spirit::nil_t result_t;
|
---|
359 | template < class Scanner >
|
---|
360 | int operator()( Scanner scan, result_t& result ) const
|
---|
361 | {
|
---|
362 | using namespace boost::spirit;
|
---|
363 | static functor_parser< detail::ucn_parse_functor > const ucn_p;
|
---|
364 | int length;
|
---|
365 | typename Scanner::iterator_t const first( scan.first );
|
---|
366 |
|
---|
367 | if ( ucn_ )
|
---|
368 | {
|
---|
369 | length =
|
---|
370 | (
|
---|
371 | lexeme_d
|
---|
372 | [
|
---|
373 | ( alpha_p | '_' | ucn_p ) >>
|
---|
374 | *( alnum_p | '_' | ucn_p )
|
---|
375 | ]
|
---|
376 | ).parse( scan ).length();
|
---|
377 | }
|
---|
378 | else
|
---|
379 | {
|
---|
380 | length =
|
---|
381 | (
|
---|
382 | lexeme_d
|
---|
383 | [
|
---|
384 | ( alpha_p | '_' ) >>
|
---|
385 | *( alnum_p | '_' )
|
---|
386 | ]
|
---|
387 | ).parse( scan ).length();
|
---|
388 | }
|
---|
389 | std::string token( first, scan.first );
|
---|
390 |
|
---|
391 | for ( int i = 0; c_keywords[i] != 0; i++ )
|
---|
392 | {
|
---|
393 | if ( token == c_keywords[i] )
|
---|
394 | {
|
---|
395 | length = -1;
|
---|
396 | break;
|
---|
397 | }
|
---|
398 | }
|
---|
399 | if ( c_plus_plus_ )
|
---|
400 | {
|
---|
401 | for ( int i = 0; c_plus_plus_keywords[i] != 0; i++ )
|
---|
402 | {
|
---|
403 | if ( token == c_plus_plus_keywords[i] )
|
---|
404 | {
|
---|
405 | length = -1;
|
---|
406 | break;
|
---|
407 | }
|
---|
408 | }
|
---|
409 | }
|
---|
410 | return length;
|
---|
411 | }
|
---|
412 | explicit c_identifier_parse_functor( bool ucn = false, bool c_plus_plus = false )
|
---|
413 | : ucn_( ucn ), c_plus_plus_( c_plus_plus )
|
---|
414 | {
|
---|
415 | }
|
---|
416 |
|
---|
417 | bool ucn_;
|
---|
418 | bool c_plus_plus_;
|
---|
419 | };
|
---|
420 |
|
---|
421 | }
|
---|
422 |
|
---|
423 | /*!
|
---|
424 | * \brief C¾ê`®Ì®èp[T[
|
---|
425 | *
|
---|
426 | * boost::spirit::int_parserÆÌá¢ÍAÚª«É¶Ä8iâ16iƵÄðß
|
---|
427 | * ·é_Å·Bܽ^ðÁè·é½ßÌÚö«àó¯üêÜ·B
|
---|
428 | */
|
---|
429 | template < typename T >
|
---|
430 | inline boost::spirit::functor_parser< detail::c_integer_parse_functor< T > > const c_int_parser()
|
---|
431 | {
|
---|
432 | return boost::spirit::functor_parser< detail::c_integer_parse_functor< T > >();
|
---|
433 | }
|
---|
434 |
|
---|
435 | extern boost::spirit::functor_parser< detail::c_integer_parse_functor< int > > const c_int_p;
|
---|
436 | extern boost::spirit::functor_parser< detail::c_integer_parse_functor< unsigned int > > const c_uint_p;
|
---|
437 |
|
---|
438 | /*!
|
---|
439 | * \brief }`oCg¶p[T[
|
---|
440 | *
|
---|
441 | * ev[gø CodeSet Åwèµ½¶R[hðð͵ܷB
|
---|
442 | * ascii ÈOðwèµ½êÅàAASCIIÌÍÍi0x7fȺjÉàvµÜ·B
|
---|
443 | * 0x00 ͶñÌI[ÆæÊūȢ½ßAvÎÛÉÍÈèܹñB
|
---|
444 | */
|
---|
445 | template < int CodeSet >
|
---|
446 | inline boost::spirit::functor_parser< detail::mbchar_parse_functor< CodeSet > > const mbchar_parser()
|
---|
447 | {
|
---|
448 | return boost::spirit::functor_parser< detail::mbchar_parse_functor< CodeSet > >();
|
---|
449 | }
|
---|
450 | inline boost::spirit::functor_parser< detail::mbchar_parse_functor<> > const mbchar_parser( codeset_t codeset )
|
---|
451 | {
|
---|
452 | return boost::spirit::functor_parser< detail::mbchar_parse_functor<> >( detail::mbchar_parse_functor<>( codeset ) );
|
---|
453 | }
|
---|
454 |
|
---|
455 | extern boost::spirit::functor_parser< detail::mbchar_parse_functor< ascii > > const ascii_p;
|
---|
456 | extern boost::spirit::functor_parser< detail::mbchar_parse_functor< shift_jis > > const shift_jis_p;
|
---|
457 | extern boost::spirit::functor_parser< detail::mbchar_parse_functor< euc_jp > > const euc_jp_p;
|
---|
458 | extern boost::spirit::functor_parser< detail::mbchar_parse_functor< utf8 > > const utf8_p;
|
---|
459 |
|
---|
460 | /*!
|
---|
461 | * \brief Û¶¼p[T[
|
---|
462 | *
|
---|
463 | * \\uܽÍ\\UÅnÜéÛ¶¼iUniversal Character Namejðð͵ܷB
|
---|
464 | * \\uhhhhܽÍ\\UhhhhhhhhihÍ16ijÉvµÜ·BȨA±êçÌ`®É
|
---|
465 | * vµÄ¢éêÅàAêÌlÍÛ¶¼ÆµÄgpūܹñB
|
---|
466 | */
|
---|
467 | inline boost::spirit::functor_parser< detail::ucn_parse_functor > const ucn_parser()
|
---|
468 | {
|
---|
469 | return boost::spirit::functor_parser< detail::ucn_parse_functor >();
|
---|
470 | }
|
---|
471 |
|
---|
472 | extern boost::spirit::functor_parser< detail::ucn_parse_functor > const ucn_p;
|
---|
473 |
|
---|
474 | /*!
|
---|
475 | * \brief C¾ê`®Ì¶ñèp[T[
|
---|
476 | *
|
---|
477 | * ñdøpÅÍÜê½C¾ê`®Ì¶ñðð͵ܷB
|
---|
478 | * ¶ñ̶R[hÍ CodeSet Åwèµ½àÌÉÈèÜ·B
|
---|
479 | */
|
---|
480 | template < int CodeSet >
|
---|
481 | inline boost::spirit::functor_parser< detail::c_strlit_parse_functor< CodeSet > > const c_strlit_parser()
|
---|
482 | {
|
---|
483 | return boost::spirit::functor_parser< detail::c_strlit_parse_functor< CodeSet > >();
|
---|
484 | }
|
---|
485 |
|
---|
486 | typedef boost::spirit::functor_parser< detail::c_strlit_parse_functor<> > c_strlit_parser_t;
|
---|
487 |
|
---|
488 | /*!
|
---|
489 | * \brief C¾ê`®Ì¶ñèp[T[
|
---|
490 | * \param codeset ¶ñÉgp³êÄ¢é¶R[h
|
---|
491 | *
|
---|
492 | * ñdøpÅÍÜê½C¾ê`®Ì¶ñðð͵ܷB
|
---|
493 | */
|
---|
494 | inline boost::spirit::functor_parser< detail::c_strlit_parse_functor<> > const c_strlit_parser( codeset_t codeset )
|
---|
495 | {
|
---|
496 | return boost::spirit::functor_parser< detail::c_strlit_parse_functor<> >( detail::c_strlit_parse_functor<>( codeset ) );
|
---|
497 | }
|
---|
498 |
|
---|
499 | extern boost::spirit::functor_parser< detail::c_strlit_parse_functor< ascii > > const ascii_str_p;
|
---|
500 | extern boost::spirit::functor_parser< detail::c_strlit_parse_functor< shift_jis > > const shift_jis_str_p;
|
---|
501 | extern boost::spirit::functor_parser< detail::c_strlit_parse_functor< euc_jp > > const euc_jp_str_p;
|
---|
502 | extern boost::spirit::functor_parser< detail::c_strlit_parse_functor< utf8 > > const utf8_str_p;
|
---|
503 |
|
---|
504 | /*!
|
---|
505 | * \brief C¾ê`®Ì¶èp[T[
|
---|
506 | *
|
---|
507 | * PøpÅÍÜê½C¾ê`®Ì¶èðð͵ܷB
|
---|
508 | * ¶R[hÍ CodeSet Åwèµ½àÌÉÈèÜ·B
|
---|
509 | */
|
---|
510 | template < int CodeSet >
|
---|
511 | inline boost::spirit::functor_parser< detail::c_chlit_parse_functor< CodeSet > > const c_chlit_parser()
|
---|
512 | {
|
---|
513 | return boost::spirit::functor_parser< detail::c_chlit_parse_functor< CodeSet > >();
|
---|
514 | }
|
---|
515 |
|
---|
516 | typedef boost::spirit::functor_parser< detail::c_chlit_parse_functor<> > c_chlit_parser_t;
|
---|
517 |
|
---|
518 | /*!
|
---|
519 | * \brief C¾ê`®Ì¶èp[T[
|
---|
520 | * \param codeset ¶R[h
|
---|
521 | *
|
---|
522 | * PøpÅÍÜê½C¾ê`®Ì¶èðð͵ܷB
|
---|
523 | */
|
---|
524 | inline boost::spirit::functor_parser< detail::c_chlit_parse_functor<> > const c_chlit_parser( codeset_t codeset )
|
---|
525 | {
|
---|
526 | return boost::spirit::functor_parser< detail::c_chlit_parse_functor<> >( detail::c_chlit_parse_functor<>( codeset ) );
|
---|
527 | }
|
---|
528 |
|
---|
529 | extern boost::spirit::functor_parser< detail::c_chlit_parse_functor< ascii > > const ascii_ch_p;
|
---|
530 | extern boost::spirit::functor_parser< detail::c_chlit_parse_functor< shift_jis > > const shift_jis_ch_p;
|
---|
531 | extern boost::spirit::functor_parser< detail::c_chlit_parse_functor< euc_jp > > const euc_jp_ch_p;
|
---|
532 | extern boost::spirit::functor_parser< detail::c_chlit_parse_functor< utf8 > > const utf8_ch_p;
|
---|
533 |
|
---|
534 | typedef boost::spirit::functor_parser< detail::c_identifier_parse_functor > c_ident_parser_t;
|
---|
535 |
|
---|
536 | /*!
|
---|
537 | * \brief C¾ê`®Ì¯Êqp[T[
|
---|
538 | * \param ucn Û¶ðe·éêÍ true ðwè
|
---|
539 | * \param c_plus_plus C++Ì\ñêðÖ~·éêÍ true ðwè
|
---|
540 | *
|
---|
541 | * C¾ê̯ÊqƵÄgpÅ«é¶ñÌðÍðs¢Ü·B
|
---|
542 | * ¯ÊqͺüܽÍp¶ÅnÜèAºüܽÍpª±Ìª´¥Å·ªA
|
---|
543 | * C99È~ÅÍÛ¶¼àgpÅ«é½ßAø ucn É true ðwè·é±ÆÅA
|
---|
544 | * Û¶¼ÎªÂ\ÉÈèÜ·B
|
---|
545 | *
|
---|
546 | * \note |óÀE¨æÑ\ñ¯ÊqÌ»ÊÍsÁĢܹñB
|
---|
547 | */
|
---|
548 | inline boost::spirit::functor_parser< detail::c_identifier_parse_functor > const c_ident_parser( bool ucn = false, bool c_plus_plus = false )
|
---|
549 | {
|
---|
550 | return boost::spirit::functor_parser< detail::c_identifier_parse_functor >( detail::c_identifier_parse_functor( ucn, c_plus_plus ) );
|
---|
551 | }
|
---|
552 |
|
---|
553 | extern boost::spirit::functor_parser< detail::c_identifier_parse_functor > const c_ident_p;
|
---|
554 | extern boost::spirit::functor_parser< detail::c_identifier_parse_functor > const c99_ident_p;
|
---|
555 | extern boost::spirit::functor_parser< detail::c_identifier_parse_functor > const c_plus_plus_ident_p;
|
---|
556 |
|
---|
557 | }
|
---|
558 |
|
---|
559 | #endif // ! TOPPERS_PARSER_HPP_
|
---|