1 #include "Specifier.hpp"
  2 #include <soulng/util/Unicode.hpp>
  3 #include <sngcm/cmlexer/CmajorLexer.hpp>
  4 #include <sngcm/cmlexer/CmajorTokens.hpp>
  5 
  6 // this file has been automatically generated from 'D:/work/soulng-project/sngcm/cmparser/Specifier.parser' using soulng parser generator spg version 3.0.0
  7 
  8 using namespace soulng::unicode;
  9 using namespace CmajorTokens;
 10 
 11 soulng::parser::Match SpecifierParser::Specifiers(CmajorLexer& lexer)
 12 {
 13     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
 14 
 15 
 16 
 17 
 18 
 19 
 20 
 21     #endif // SOULNG_PARSER_DEBUG_SUPPORT
 22     sngcm::ast::Specifiers specifiers = sngcm::ast::Specifiers();
 23     std::unique_ptr<soulng::parser::soulng::parser::Value<sngcm::ast::Specifiers>>specifier;
 24     soulng::parser::Match match(false);
 25     soulng::parser::Match* parentMatch0 = &match;
 26     {
 27         int64_t pos = lexer.GetPos();
 28         soulng::parser::Match match(false);
 29         soulng::parser::Match* parentMatch1 = &match;
 30         {
 31             soulng::parser::Match match(true);
 32             soulng::parser::Match* parentMatch2 = &match;
 33             {
 34                 while (true)
 35                 {
 36                     int64_t save = lexer.GetPos();
 37                     {
 38                         soulng::parser::Match match(false);
 39                         soulng::parser::Match* parentMatch3 = &match;
 40                         {
 41                             soulng::parser::Match match(false);
 42                             soulng::parser::Match* parentMatch4 = &match;
 43                             {
 44                                 int64_t pos = lexer.GetPos();
 45                                 soulng::parser::Match match = SpecifierParser::Specifier(lexer);
 46                                 specifier.reset(static_cast<soulng::parser::soulng::parser::Value<sngcm::ast::Specifiers>*>(match.value));
 47                                 if (match.hit)
 48                                 {
 49                                     specifiers = specifiers | specifier->value;
 50                                 }
 51                                 *parentMatch4 = match;
 52                             }
 53                             *parentMatch3 = match;
 54                         }
 55                         if (match.hit)
 56                         {
 57                             *parentMatch2 = match;
 58                         }
 59                         else
 60                         {
 61                             lexer.SetPos(save);
 62                             break;
 63                         }
 64                     }
 65                 }
 66             }
 67             *parentMatch1 = match;
 68         }
 69         if (match.hit)
 70         {
 71             {
 72                 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
 73 
 74                 #endif // SOULNG_PARSER_DEBUG_SUPPORT
 75                 return soulng::parser::Match(truenew soulng::parser::Value<sngcm::ast::Specifiers>(specifiers));
 76             }
 77         }
 78         *parentMatch0 = match;
 79     }
 80     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
 81 
 82 
 83 
 84 
 85 
 86     #endif // SOULNG_PARSER_DEBUG_SUPPORT
 87     if (!match.hit)
 88     {
 89         match.value = nullptr;
 90     }
 91     return match;
 92 }
 93 
 94 soulng::parser::Match SpecifierParser::Specifier(CmajorLexer& lexer)
 95 {
 96     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
 97 
 98 
 99 
100 
101 
102 
103 
104     #endif // SOULNG_PARSER_DEBUG_SUPPORT
105     soulng::parser::Match match(false);
106     int64_t pos = lexer.GetPos();
107     soulng::lexer::Span span = lexer.GetSpan();
108     switch (*lexer)
109     {
110         case PUBLIC:
111         {
112             ++lexer;
113             {
114                 {
115                     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
116 
117                     #endif // SOULNG_PARSER_DEBUG_SUPPORT
118                     return soulng::parser::Match(truenew soulng::parser::Value<sngcm::ast::Specifiers>(sngcm::ast::Specifiers::public_));
119                 }
120             }
121             break;
122         }
123         case PROTECTED:
124         {
125             ++lexer;
126             {
127                 {
128                     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
129 
130                     #endif // SOULNG_PARSER_DEBUG_SUPPORT
131                     return soulng::parser::Match(truenew soulng::parser::Value<sngcm::ast::Specifiers>(sngcm::ast::Specifiers::protected_));
132                 }
133             }
134             break;
135         }
136         case PRIVATE:
137         {
138             ++lexer;
139             {
140                 {
141                     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
142 
143                     #endif // SOULNG_PARSER_DEBUG_SUPPORT
144                     return soulng::parser::Match(truenew soulng::parser::Value<sngcm::ast::Specifiers>(sngcm::ast::Specifiers::private_));
145                 }
146             }
147             break;
148         }
149         case INTERNAL:
150         {
151             ++lexer;
152             {
153                 {
154                     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
155 
156                     #endif // SOULNG_PARSER_DEBUG_SUPPORT
157                     return soulng::parser::Match(truenew soulng::parser::Value<sngcm::ast::Specifiers>(sngcm::ast::Specifiers::internal_));
158                 }
159             }
160             break;
161         }
162         case STATIC:
163         {
164             ++lexer;
165             {
166                 {
167                     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
168 
169                     #endif // SOULNG_PARSER_DEBUG_SUPPORT
170                     return soulng::parser::Match(truenew soulng::parser::Value<sngcm::ast::Specifiers>(sngcm::ast::Specifiers::static_));
171                 }
172             }
173             break;
174         }
175         case VIRTUAL:
176         {
177             ++lexer;
178             {
179                 {
180                     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
181 
182                     #endif // SOULNG_PARSER_DEBUG_SUPPORT
183                     return soulng::parser::Match(truenew soulng::parser::Value<sngcm::ast::Specifiers>(sngcm::ast::Specifiers::virtual_));
184                 }
185             }
186             break;
187         }
188         case OVERRIDE:
189         {
190             ++lexer;
191             {
192                 {
193                     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
194 
195                     #endif // SOULNG_PARSER_DEBUG_SUPPORT
196                     return soulng::parser::Match(truenew soulng::parser::Value<sngcm::ast::Specifiers>(sngcm::ast::Specifiers::override_));
197                 }
198             }
199             break;
200         }
201         case ABSTRACT:
202         {
203             ++lexer;
204             {
205                 {
206                     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
207 
208                     #endif // SOULNG_PARSER_DEBUG_SUPPORT
209                     return soulng::parser::Match(truenew soulng::parser::Value<sngcm::ast::Specifiers>(sngcm::ast::Specifiers::abstract_));
210                 }
211             }
212             break;
213         }
214         case INLINE:
215         {
216             ++lexer;
217             {
218                 {
219                     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
220 
221                     #endif // SOULNG_PARSER_DEBUG_SUPPORT
222                     return soulng::parser::Match(truenew soulng::parser::Value<sngcm::ast::Specifiers>(sngcm::ast::Specifiers::inline_));
223                 }
224             }
225             break;
226         }
227         case EXPLICIT:
228         {
229             ++lexer;
230             {
231                 {
232                     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
233 
234                     #endif // SOULNG_PARSER_DEBUG_SUPPORT
235                     return soulng::parser::Match(truenew soulng::parser::Value<sngcm::ast::Specifiers>(sngcm::ast::Specifiers::explicit_));
236                 }
237             }
238             break;
239         }
240         case EXTERN:
241         {
242             ++lexer;
243             {
244                 {
245                     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
246 
247                     #endif // SOULNG_PARSER_DEBUG_SUPPORT
248                     return soulng::parser::Match(truenew soulng::parser::Value<sngcm::ast::Specifiers>(sngcm::ast::Specifiers::external_));
249                 }
250             }
251             break;
252         }
253         case SUPPRESS:
254         {
255             ++lexer;
256             {
257                 {
258                     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
259 
260                     #endif // SOULNG_PARSER_DEBUG_SUPPORT
261                     return soulng::parser::Match(truenew soulng::parser::Value<sngcm::ast::Specifiers>(sngcm::ast::Specifiers::suppress_));
262                 }
263             }
264             break;
265         }
266         case DEFAULT:
267         {
268             ++lexer;
269             {
270                 {
271                     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
272 
273                     #endif // SOULNG_PARSER_DEBUG_SUPPORT
274                     return soulng::parser::Match(truenew soulng::parser::Value<sngcm::ast::Specifiers>(sngcm::ast::Specifiers::default_));
275                 }
276             }
277             break;
278         }
279         case CONSTEXPR:
280         {
281             ++lexer;
282             {
283                 {
284                     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
285 
286                     #endif // SOULNG_PARSER_DEBUG_SUPPORT
287                     return soulng::parser::Match(truenew soulng::parser::Value<sngcm::ast::Specifiers>(sngcm::ast::Specifiers::constexpr_));
288                 }
289             }
290             break;
291         }
292         case CDECL:
293         {
294             ++lexer;
295             {
296                 {
297                     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
298 
299                     #endif // SOULNG_PARSER_DEBUG_SUPPORT
300                     return soulng::parser::Match(truenew soulng::parser::Value<sngcm::ast::Specifiers>(sngcm::ast::Specifiers::cdecl_));
301                 }
302             }
303             break;
304         }
305         case NOTHROW:
306         {
307             ++lexer;
308             {
309                 {
310                     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
311 
312                     #endif // SOULNG_PARSER_DEBUG_SUPPORT
313                     return soulng::parser::Match(truenew soulng::parser::Value<sngcm::ast::Specifiers>(sngcm::ast::Specifiers::nothrow_));
314                 }
315             }
316             break;
317         }
318         case THROW:
319         {
320             ++lexer;
321             {
322                 {
323                     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
324 
325                     #endif // SOULNG_PARSER_DEBUG_SUPPORT
326                     return soulng::parser::Match(truenew soulng::parser::Value<sngcm::ast::Specifiers>(sngcm::ast::Specifiers::throw_));
327                 }
328             }
329             break;
330         }
331         case NEW:
332         {
333             ++lexer;
334             {
335                 {
336                     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
337 
338                     #endif // SOULNG_PARSER_DEBUG_SUPPORT
339                     return soulng::parser::Match(truenew soulng::parser::Value<sngcm::ast::Specifiers>(sngcm::ast::Specifiers::new_));
340                 }
341             }
342             break;
343         }
344         case UNIT_TEST:
345         {
346             ++lexer;
347             {
348                 {
349                     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
350 
351                     #endif // SOULNG_PARSER_DEBUG_SUPPORT
352                     return soulng::parser::Match(truenew soulng::parser::Value<sngcm::ast::Specifiers>(sngcm::ast::Specifiers::unit_test_));
353                 }
354             }
355             break;
356         }
357         case WINAPI:
358         {
359             ++lexer;
360             {
361                 {
362                     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
363 
364                     #endif // SOULNG_PARSER_DEBUG_SUPPORT
365                     return soulng::parser::Match(truenew soulng::parser::Value<sngcm::ast::Specifiers>(sngcm::ast::Specifiers::winapi));
366                 }
367             }
368             break;
369         }
370     }
371     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
372 
373 
374 
375 
376 
377     #endif // SOULNG_PARSER_DEBUG_SUPPORT
378     if (!match.hit)
379     {
380         match.value = nullptr;
381     }
382     return match;
383 }