source: cfg_oil/trunk/toppers/c_parser.hpp@ 23

Last change on this file since 23 was 8, checked in by msugi, 14 years ago

ディレクトリ構造の作成,ソース一式とReleaseビルドのコミット.

File size: 19.9 KB
Line 
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–{ƒ\ƒtƒgƒEƒF
8 * ƒAi–{ƒ\ƒtƒgƒEƒFƒA‚ð‰ü•Ï‚µ‚½‚à‚Ì‚ðŠÜ‚ށDˆÈ‰º“¯‚¶j‚ðŽg—pE•¡»E‰ü
9 * •ÏEÄ”z•ziˆÈ‰ºC—˜—p‚ƌĂԁj‚·‚邱‚Ƃ𖳏ž‚Å‹–‘ø‚·‚éD
10 * (1) –{ƒ\ƒtƒgƒEƒFƒA‚ðƒ\[ƒXƒR[ƒh‚ÌŒ`‚Å—˜—p‚·‚éê‡‚ɂ́Cã‹L‚Ì’˜ì
11 * Œ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’肪C‚»‚Ì‚Ü‚Ü‚ÌŒ`‚Ń\[
12 * ƒXƒR[ƒh’†‚ÉŠÜ‚Ü‚ê‚Ä‚¢‚邱‚ƁD
13 * (2) –{ƒ\ƒtƒgƒEƒFƒA‚ðCƒ‰ƒCƒuƒ‰ƒŠŒ`Ž®‚ȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
14 * —p‚Å‚«‚éŒ`‚ōĔz•z‚·‚éê‡‚ɂ́CÄ”z•z‚É”º‚¤ƒhƒLƒ…
15ƒƒ“ƒgi—˜—p
16 * ŽÒƒ}ƒjƒ…
17ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L
18 * ‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
19 * (3) –{ƒ\ƒtƒgƒEƒFƒA‚ðC‹@Ší‚É‘g‚ݍž‚ނȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
20 * —p‚Å‚«‚È‚¢Œ`‚ōĔz•z‚·‚éê‡‚ɂ́CŽŸ‚Ì‚¢‚¸‚ê‚©‚ÌðŒ‚ð–ž‚½‚·‚±
21 * ‚ƁD
22 * (a) Ä”z•z‚É”º‚¤ƒhƒLƒ…
23ƒƒ“ƒgi—˜—pŽÒƒ}ƒjƒ…
24ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜
25 * ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
26 * (b) Ä”z•z‚ÌŒ`‘Ô‚ðC•Ê‚É’è‚ß‚é•û–@‚É‚æ‚Á‚āCTOPPERSƒvƒƒWƒFƒNƒg‚É
27 * •ñ‚·‚邱‚ƁD
28 * (4) –{ƒ\ƒtƒgƒEƒFƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚é‚¢‚©‚Ȃ鑹
29 * ŠQ‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð–Ɛӂ·‚邱‚ƁD
30 * ‚Ü‚½C–{ƒ\ƒtƒgƒEƒFƒA‚̃†[ƒU‚Ü‚½‚̓Gƒ“ƒhƒ†[ƒU‚©‚ç‚Ì‚¢‚©‚Ȃ闝
31 * —R‚ÉŠî‚­¿‹‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð
32 * –Ɛӂ·‚邱‚ƁD
33 *
34 * –{ƒ\ƒtƒgƒEƒFƒA‚́C–³•ÛØ‚Å’ñ‹Ÿ‚³‚ê‚Ä‚¢‚é‚à‚Ì‚Å‚ ‚éDã‹L’˜ìŒ ŽÒ‚¨
35 * ‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚́C–{ƒ\ƒtƒgƒEƒFƒA‚ÉŠÖ‚µ‚āC“Á’è‚ÌŽg—p–Ú“I
36 * ‚ɑ΂·‚é“K‡«‚àŠÜ‚߂āC‚¢‚©‚È‚é•ÛØ‚às‚í‚È‚¢D‚Ü‚½C–{ƒ\ƒtƒgƒEƒF
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
55namespace 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' ) // 16i‚Ü‚½‚Í8i
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 // 10i
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' ) // ”¼Šp‰p”Žš‹L†
151 | range_p( '\xa1', '\xdf' ) // ”¼ŠpƒJƒ^ƒJƒi
152 | ( chset<>( "\x81-\x9f\xe0-\xef" ) >> chset<>( "\x40-\x7e\x80-\xfc" ) ) // ‘SŠp
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' ) // ”¼Šp‰p”Žš‹L†
169 | ( ch_p( '\x8e' ) >> range_p( '\xa1', '\xdf' ) ) // ”¼ŠpƒJƒ^ƒJƒi
170 | ( !ch_p( '\x8f' ) >> range_p( '\xa1', '\xf0' ) >> range_p( '\xa1', '\xf0' ) ) // ‘SŠp
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' ) // 1ƒoƒCƒg
187 | ( range_p( '\xc0', '\xdf' ) >> range_p( '\x80', '\xbf' ) ) // 2ƒoƒCƒg
188 | ( range_p( '\xe0', '\xef' ) >> repeat_p( 2 )[ range_p( '\x80', '\xbf' ) ] ) // 3ƒoƒCƒg
189 | ( range_p( '\xf0', '\xf7' ) >> repeat_p( 3 )[ range_p( '\x80', '\xbf' ) ] ) // 4ƒoƒCƒg
190 | ( range_p( '\xf8', '\xfb' ) >> repeat_p( 4 )[ range_p( '\x80', '\xbf' ) ] ) // 5ƒoƒCƒg
191 | ( range_p( '\xfc', '\xfd' ) >> repeat_p( 5 )[ range_p( '\x80', '\xbf' ) ] ) // 6ƒoƒCƒg
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‚¦‚È‚¢’liJIS X3010:2003 6.4.3j
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Ú“ªŽ«‚ɉž‚¶‚Ä8i”‚â16i”‚Æ‚µ‚ĉðŽß
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 ƒ}ƒ‹ƒ`ƒoƒCƒg•¶Žšƒp[ƒT[
440 *
441 * ƒeƒ“ƒvƒŒ[ƒgˆø” CodeSet ‚ÅŽw’肵‚½•¶ŽšƒR[ƒh‚ð‰ðÍ‚µ‚Ü‚·B
442 * ascii ˆÈŠO‚ðŽw’肵‚½ê‡‚Å‚àAASCII‚͈̔́i0x7fˆÈ‰ºj‚É‚à‡’v‚µ‚Ü‚·B
443 * 0x00 ‚Í•¶Žš—ñ‚̏I’[‚Æ‹æ•Ê‚Å‚«‚È‚¢‚½‚߁A‡’v‘Ώۂɂ͂Ȃè‚Ü‚¹‚ñ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 Namej‚ð‰ðÍ‚µ‚Ü‚·B
464 * \\uhhhh‚Ü‚½‚Í\\Uhhhhhhhhih‚Í16i”Žšj‚ɍ‡’v‚µ‚Ü‚·B‚È‚¨A‚±‚ê‚ç‚ÌŒ`Ž®‚É
465 * ‡’v‚µ‚Ä‚¢‚éê‡‚Å‚àAˆê•”‚Ì’l‚͍‘Û•¶Žš–¼‚Æ‚µ‚ÄŽg—p‚Å‚«‚Ü‚¹‚ñ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 •¶Žš—ñ‚ÉŽg—p‚³‚ê‚Ä‚¢‚镶Žšƒ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Œ¾ŒêŒ`Ž®‚ÌŽ¯•ÊŽqƒp[ƒT[
538 * \param ucn ‘Û•¶Žš‚ð‹–—e‚·‚éê‡‚Í true ‚ðŽw’è
539 * \param c_plus_plus C++‚Ì—\–ñŒê‚ð‹ÖŽ~‚·‚éê‡‚Í true ‚ðŽw’è
540 *
541 * CŒ¾Œê‚ÌŽ¯•ÊŽq‚Æ‚µ‚ÄŽg—p‚Å‚«‚镶Žš—ñ‚̉ðÍ‚ðs‚¢‚Ü‚·B
542 * Ž¯•ÊŽq‚͉ºü‚Ü‚½‚͉p•¶Žš‚ÅŽn‚Ü‚èA‰ºü‚Ü‚½‚͉p”Žš‚ª‘±‚­‚Ì‚ªŒ´‘¥‚Å‚·‚ªA
543 * C99ˆÈ~‚ł͍‘Û•¶Žš–¼‚àŽg—p‚Å‚«‚邽‚߁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_
Note: See TracBrowser for help on using the repository browser.