1 #include "LexerIdentifierParser.hpp"
  2 #include <soulng/util/Unicode.hpp>
  3 #include <sng2html/sng2html/LexerFileLexer.hpp>
  4 #include <sng2html/sng2html/LexerFileTokens.hpp>
  5 
  6 // this file has been automatically generated from 'D:/work/soulng-project/tools/sng2html/sng2html/LexerIdentifierParser.parser' using soulng parser generator spg version 3.0.0
  7 
  8 using namespace soulng::unicode;
  9 using namespace soulng::lexer;
 10 using namespace LexerFileTokens;
 11 
 12 soulng::parser::Match LexerIdentifierParser::CppIdentifier(LexerFileLexer& lexer)
 13 {
 14     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
 15 
 16 
 17 
 18 
 19 
 20 
 21 
 22     #endif // SOULNG_PARSER_DEBUG_SUPPORT
 23     soulng::parser::Match match(false);
 24     soulng::parser::Match* parentMatch0 = &match;
 25     {
 26         int64_t pos = lexer.GetPos();
 27         soulng::lexer::Span span = lexer.GetSpan();
 28         soulng::parser::Match match(false);
 29         if (*lexer == ID)
 30         {
 31             ++lexer;
 32             match.hit = true;
 33         }
 34         if (match.hit)
 35         {
 36             {
 37                 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
 38 
 39                 #endif // SOULNG_PARSER_DEBUG_SUPPORT
 40                 return soulng::parser::Match(truenew soulng::parser::Value<std::u32string>(lexer.GetMatch(span)));
 41             }
 42         }
 43         *parentMatch0 = match;
 44     }
 45     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
 46 
 47 
 48 
 49 
 50 
 51     #endif // SOULNG_PARSER_DEBUG_SUPPORT
 52     if (!match.hit)
 53     {
 54         match.value = nullptr;
 55     }
 56     return match;
 57 }
 58 
 59 soulng::parser::Match LexerIdentifierParser::QualifiedCppId(LexerFileLexer& lexer)
 60 {
 61     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
 62 
 63 
 64 
 65 
 66 
 67 
 68 
 69     #endif // SOULNG_PARSER_DEBUG_SUPPORT
 70     Span s = Span();
 71     soulng::parser::Match match(false);
 72     soulng::parser::Match* parentMatch0 = &match;
 73     {
 74         int64_t pos = lexer.GetPos();
 75         soulng::parser::Match match(false);
 76         soulng::parser::Match* parentMatch1 = &match;
 77         {
 78             soulng::parser::Match match(false);
 79             soulng::parser::Match* parentMatch2 = &match;
 80             {
 81                 soulng::parser::Match match(false);
 82                 soulng::parser::Match* parentMatch3 = &match;
 83                 {
 84                     soulng::parser::Match match(false);
 85                     soulng::parser::Match* parentMatch4 = &match;
 86                     {
 87                         soulng::parser::Match match(false);
 88                         soulng::parser::Match* parentMatch5 = &match;
 89                         {
 90                             int64_t pos = lexer.GetPos();
 91                             soulng::lexer::Span span = lexer.GetSpan();
 92                             soulng::parser::Match match(true);
 93                             if (match.hit)
 94                             {
 95                                 s = span;
 96                             }
 97                             *parentMatch5 = match;
 98                         }
 99                         *parentMatch4 = match;
100                     }
101                     if (match.hit)
102                     {
103                         soulng::parser::Match match(false);
104                         soulng::parser::Match* parentMatch6 = &match;
105                         {
106                             soulng::parser::Match match(true);
107                             int64_t save = lexer.GetPos();
108                             soulng::parser::Match* parentMatch7 = &match;
109                             {
110                                 soulng::parser::Match match(false);
111                                 if (*lexer == COLONCOLON)
112                                 {
113                                     ++lexer;
114                                     match.hit = true;
115                                 }
116                                 if (match.hit)
117                                 {
118                                     *parentMatch7 = match;
119                                 }
120                                 else
121                                 {
122                                     lexer.SetPos(save);
123                                 }
124                             }
125                             *parentMatch6 = match;
126                         }
127                         *parentMatch4 = match;
128                     }
129                     *parentMatch3 = match;
130                 }
131                 if (match.hit)
132                 {
133                     soulng::parser::Match match(false);
134                     soulng::parser::Match* parentMatch8 = &match;
135                     {
136                         soulng::parser::Match match(false);
137                         soulng::parser::Match* parentMatch9 = &match;
138                         {
139                             int64_t pos = lexer.GetPos();
140                             soulng::lexer::Span span = lexer.GetSpan();
141                             soulng::parser::Match match(false);
142                             if (*lexer == ID)
143                             {
144                                 ++lexer;
145                                 match.hit = true;
146                             }
147                             if (match.hit)
148                             {
149                                 s.end = span.end;
150                             }
151                             *parentMatch9 = match;
152                         }
153                         *parentMatch8 = match;
154                     }
155                     *parentMatch3 = match;
156                 }
157                 *parentMatch2 = match;
158             }
159             if (match.hit)
160             {
161                 soulng::parser::Match match(false);
162                 soulng::parser::Match* parentMatch10 = &match;
163                 {
164                     soulng::parser::Match match(true);
165                     soulng::parser::Match* parentMatch11 = &match;
166                     {
167                         while (true)
168                         {
169                             int64_t save = lexer.GetPos();
170                             {
171                                 soulng::parser::Match match(false);
172                                 soulng::parser::Match* parentMatch12 = &match;
173                                 {
174                                     soulng::parser::Match match(false);
175                                     soulng::parser::Match* parentMatch13 = &match;
176                                     {
177                                         soulng::parser::Match match(false);
178                                         if (*lexer == COLONCOLON)
179                                         {
180                                             ++lexer;
181                                             match.hit = true;
182                                         }
183                                         *parentMatch13 = match;
184                                     }
185                                     if (match.hit)
186                                     {
187                                         soulng::parser::Match match(false);
188                                         soulng::parser::Match* parentMatch14 = &match;
189                                         {
190                                             soulng::parser::Match match(false);
191                                             soulng::parser::Match* parentMatch15 = &match;
192                                             {
193                                                 int64_t pos = lexer.GetPos();
194                                                 soulng::lexer::Span span = lexer.GetSpan();
195                                                 soulng::parser::Match match(false);
196                                                 if (*lexer == ID)
197                                                 {
198                                                     ++lexer;
199                                                     match.hit = true;
200                                                 }
201                                                 if (match.hit)
202                                                 {
203                                                     s.end = span.end;
204                                                 }
205                                                 *parentMatch15 = match;
206                                             }
207                                             *parentMatch14 = match;
208                                         }
209                                         *parentMatch13 = match;
210                                     }
211                                     *parentMatch12 = match;
212                                 }
213                                 if (match.hit)
214                                 {
215                                     *parentMatch11 = match;
216                                 }
217                                 else
218                                 {
219                                     lexer.SetPos(save);
220                                     break;
221                                 }
222                             }
223                         }
224                     }
225                     *parentMatch10 = match;
226                 }
227                 *parentMatch2 = match;
228             }
229             *parentMatch1 = match;
230         }
231         if (match.hit)
232         {
233             {
234                 #ifdef SOULNG_PARSER_DEBUG_SUPPORT
235 
236                 #endif // SOULNG_PARSER_DEBUG_SUPPORT
237                 return soulng::parser::Match(truenew soulng::parser::Value<std::u32string>(lexer.GetMatch(s)));
238             }
239         }
240         *parentMatch0 = match;
241     }
242     #ifdef SOULNG_PARSER_DEBUG_SUPPORT
243 
244 
245 
246 
247 
248     #endif // SOULNG_PARSER_DEBUG_SUPPORT
249     if (!match.hit)
250     {
251         match.value = nullptr;
252     }
253     return match;
254 }