BaseTools: Use absolute import in Eot
[mirror_edk2.git] / BaseTools / Source / Python / Eot / CParser.py
CommitLineData
f51461c8
LG
1# $ANTLR 3.0.1 C.g 2010-02-23 09:58:53\r
2\r
72443dd2 3from __future__ import print_function\r
64429fbd 4from __future__ import absolute_import\r
f51461c8
LG
5from antlr3 import *\r
6from antlr3.compat import set, frozenset\r
f7496d71 7\r
52302d4d
LG
8## @file\r
9# The file defines the parser for C source files.\r
10#\r
11# THIS FILE IS AUTO-GENENERATED. PLEASE DON NOT MODIFY THIS FILE.\r
12# This file is generated by running:\r
13# java org.antlr.Tool C.g\r
14#\r
f7496d71 15# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
52302d4d
LG
16#\r
17# This program and the accompanying materials are licensed and made available\r
18# under the terms and conditions of the BSD License which accompanies this\r
19# distribution. The full text of the license may be found at:\r
20# http://opensource.org/licenses/bsd-license.php\r
21#\r
22# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
23# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
24#\r
25##\r
26\r
64429fbd
GL
27from . import CodeFragment\r
28from . import FileProfile\r
f51461c8
LG
29\r
30\r
31\r
32# for convenience in actions\r
33HIDDEN = BaseRecognizer.HIDDEN\r
34\r
35# token types\r
36BS=20\r
37LINE_COMMENT=23\r
38FloatTypeSuffix=16\r
39IntegerTypeSuffix=14\r
40LETTER=11\r
41OCTAL_LITERAL=6\r
42CHARACTER_LITERAL=8\r
43Exponent=15\r
44EOF=-1\r
45HexDigit=13\r
46STRING_LITERAL=9\r
47WS=19\r
48FLOATING_POINT_LITERAL=10\r
49IDENTIFIER=4\r
50UnicodeEscape=18\r
51LINE_COMMAND=24\r
52UnicodeVocabulary=21\r
53HEX_LITERAL=5\r
54COMMENT=22\r
55DECIMAL_LITERAL=7\r
56EscapeSequence=12\r
57OctalEscape=17\r
58\r
59# token names\r
60tokenNames = [\r
f7496d71
LG
61 "<invalid>", "<EOR>", "<DOWN>", "<UP>",\r
62 "IDENTIFIER", "HEX_LITERAL", "OCTAL_LITERAL", "DECIMAL_LITERAL", "CHARACTER_LITERAL",\r
63 "STRING_LITERAL", "FLOATING_POINT_LITERAL", "LETTER", "EscapeSequence",\r
64 "HexDigit", "IntegerTypeSuffix", "Exponent", "FloatTypeSuffix", "OctalEscape",\r
65 "UnicodeEscape", "WS", "BS", "UnicodeVocabulary", "COMMENT", "LINE_COMMENT",\r
66 "LINE_COMMAND", "';'", "'typedef'", "','", "'='", "'extern'", "'static'",\r
67 "'auto'", "'register'", "'STATIC'", "'void'", "'char'", "'short'", "'int'",\r
68 "'long'", "'float'", "'double'", "'signed'", "'unsigned'", "'{'", "'}'",\r
69 "'struct'", "'union'", "':'", "'enum'", "'const'", "'volatile'", "'IN'",\r
70 "'OUT'", "'OPTIONAL'", "'CONST'", "'UNALIGNED'", "'VOLATILE'", "'GLOBAL_REMOVE_IF_UNREFERENCED'",\r
71 "'EFIAPI'", "'EFI_BOOTSERVICE'", "'EFI_RUNTIMESERVICE'", "'PACKED'",\r
72 "'('", "')'", "'['", "']'", "'*'", "'...'", "'+'", "'-'", "'/'", "'%'",\r
73 "'++'", "'--'", "'sizeof'", "'.'", "'->'", "'&'", "'~'", "'!'", "'*='",\r
74 "'/='", "'%='", "'+='", "'-='", "'<<='", "'>>='", "'&='", "'^='", "'|='",\r
75 "'?'", "'||'", "'&&'", "'|'", "'^'", "'=='", "'!='", "'<'", "'>'", "'<='",\r
76 "'>='", "'<<'", "'>>'", "'__asm__'", "'_asm'", "'__asm'", "'case'",\r
77 "'default'", "'if'", "'else'", "'switch'", "'while'", "'do'", "'for'",\r
f51461c8
LG
78 "'goto'", "'continue'", "'break'", "'return'"\r
79]\r
80\r
81\r
82class function_definition_scope(object):\r
83 def __init__(self):\r
84 self.ModifierText = None\r
85 self.DeclText = None\r
86 self.LBLine = None\r
87 self.LBOffset = None\r
88 self.DeclLine = None\r
89 self.DeclOffset = None\r
90class postfix_expression_scope(object):\r
91 def __init__(self):\r
92 self.FuncCallText = None\r
93\r
94\r
95class CParser(Parser):\r
96 grammarFileName = "C.g"\r
97 tokenNames = tokenNames\r
98\r
99 def __init__(self, input):\r
100 Parser.__init__(self, input)\r
101 self.ruleMemo = {}\r
102\r
877251b4
GL
103 self.function_definition_stack = []\r
104 self.postfix_expression_stack = []\r
f51461c8 105\r
52302d4d 106 def printTokenInfo(self, line, offset, tokenText):\r
72443dd2
GL
107 print(str(line)+ ',' + str(offset) + ':' + str(tokenText))\r
108\r
52302d4d 109 def StorePredicateExpression(self, StartLine, StartOffset, EndLine, EndOffset, Text):\r
f7496d71
LG
110 PredExp = CodeFragment.PredicateExpression(Text, (StartLine, StartOffset), (EndLine, EndOffset))\r
111 FileProfile.PredicateExpressionList.append(PredExp)\r
112\r
52302d4d 113 def StoreEnumerationDefinition(self, StartLine, StartOffset, EndLine, EndOffset, Text):\r
f7496d71
LG
114 EnumDef = CodeFragment.EnumerationDefinition(Text, (StartLine, StartOffset), (EndLine, EndOffset))\r
115 FileProfile.EnumerationDefinitionList.append(EnumDef)\r
116\r
52302d4d 117 def StoreStructUnionDefinition(self, StartLine, StartOffset, EndLine, EndOffset, Text):\r
f7496d71
LG
118 SUDef = CodeFragment.StructUnionDefinition(Text, (StartLine, StartOffset), (EndLine, EndOffset))\r
119 FileProfile.StructUnionDefinitionList.append(SUDef)\r
120\r
52302d4d 121 def StoreTypedefDefinition(self, StartLine, StartOffset, EndLine, EndOffset, FromText, ToText):\r
f7496d71
LG
122 Tdef = CodeFragment.TypedefDefinition(FromText, ToText, (StartLine, StartOffset), (EndLine, EndOffset))\r
123 FileProfile.TypedefDefinitionList.append(Tdef)\r
124\r
52302d4d 125 def StoreFunctionDefinition(self, StartLine, StartOffset, EndLine, EndOffset, ModifierText, DeclText, LeftBraceLine, LeftBraceOffset, DeclLine, DeclOffset):\r
f7496d71
LG
126 FuncDef = CodeFragment.FunctionDefinition(ModifierText, DeclText, (StartLine, StartOffset), (EndLine, EndOffset), (LeftBraceLine, LeftBraceOffset), (DeclLine, DeclOffset))\r
127 FileProfile.FunctionDefinitionList.append(FuncDef)\r
128\r
52302d4d 129 def StoreVariableDeclaration(self, StartLine, StartOffset, EndLine, EndOffset, ModifierText, DeclText):\r
f7496d71
LG
130 VarDecl = CodeFragment.VariableDeclaration(ModifierText, DeclText, (StartLine, StartOffset), (EndLine, EndOffset))\r
131 FileProfile.VariableDeclarationList.append(VarDecl)\r
132\r
52302d4d 133 def StoreFunctionCalling(self, StartLine, StartOffset, EndLine, EndOffset, FuncName, ParamList):\r
f7496d71
LG
134 FuncCall = CodeFragment.FunctionCalling(FuncName, ParamList, (StartLine, StartOffset), (EndLine, EndOffset))\r
135 FileProfile.FunctionCallingList.append(FuncCall)\r
136\r
f51461c8
LG
137\r
138\r
139\r
140 # $ANTLR start translation_unit\r
141 # C.g:102:1: translation_unit : ( external_declaration )* ;\r
142 def translation_unit(self, ):\r
143\r
144 translation_unit_StartIndex = self.input.index()\r
145 try:\r
146 try:\r
147 if self.backtracking > 0 and self.alreadyParsedRule(self.input, 1):\r
f7496d71 148 return\r
f51461c8
LG
149\r
150 # C.g:103:2: ( ( external_declaration )* )\r
151 # C.g:103:4: ( external_declaration )*\r
152 # C.g:103:4: ( external_declaration )*\r
153 while True: #loop1\r
154 alt1 = 2\r
155 LA1_0 = self.input.LA(1)\r
156\r
157 if (LA1_0 == IDENTIFIER or LA1_0 == 26 or (29 <= LA1_0 <= 42) or (45 <= LA1_0 <= 46) or (48 <= LA1_0 <= 62) or LA1_0 == 66) :\r
158 alt1 = 1\r
159\r
160\r
161 if alt1 == 1:\r
162 # C.g:0:0: external_declaration\r
163 self.following.append(self.FOLLOW_external_declaration_in_translation_unit74)\r
164 self.external_declaration()\r
165 self.following.pop()\r
166 if self.failed:\r
f7496d71 167 return\r
f51461c8
LG
168\r
169\r
170 else:\r
171 break #loop1\r
172\r
173\r
174\r
175\r
176\r
177\r
5b0671c1 178 except RecognitionException as re:\r
f51461c8
LG
179 self.reportError(re)\r
180 self.recover(self.input, re)\r
181 finally:\r
182 if self.backtracking > 0:\r
183 self.memoize(self.input, 1, translation_unit_StartIndex)\r
184\r
185 pass\r
186\r
f7496d71 187 return\r
f51461c8
LG
188\r
189 # $ANTLR end translation_unit\r
190\r
191\r
192 # $ANTLR start external_declaration\r
193 # C.g:114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );\r
194 def external_declaration(self, ):\r
195\r
196 external_declaration_StartIndex = self.input.index()\r
197 try:\r
198 try:\r
199 if self.backtracking > 0 and self.alreadyParsedRule(self.input, 2):\r
f7496d71 200 return\r
f51461c8
LG
201\r
202 # C.g:119:2: ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? )\r
203 alt3 = 3\r
204 LA3_0 = self.input.LA(1)\r
205\r
206 if ((29 <= LA3_0 <= 33)) :\r
207 LA3_1 = self.input.LA(2)\r
208\r
209 if (self.synpred4()) :\r
210 alt3 = 1\r
211 elif (self.synpred5()) :\r
212 alt3 = 2\r
213 else:\r
214 if self.backtracking > 0:\r
215 self.failed = True\r
f7496d71 216 return\r
f51461c8
LG
217\r
218 nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 1, self.input)\r
219\r
220 raise nvae\r
221\r
222 elif (LA3_0 == 34) :\r
223 LA3_2 = self.input.LA(2)\r
224\r
225 if (self.synpred4()) :\r
226 alt3 = 1\r
227 elif (self.synpred5()) :\r
228 alt3 = 2\r
229 else:\r
230 if self.backtracking > 0:\r
231 self.failed = True\r
f7496d71 232 return\r
f51461c8
LG
233\r
234 nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 2, self.input)\r
235\r
236 raise nvae\r
237\r
238 elif (LA3_0 == 35) :\r
239 LA3_3 = self.input.LA(2)\r
240\r
241 if (self.synpred4()) :\r
242 alt3 = 1\r
243 elif (self.synpred5()) :\r
244 alt3 = 2\r
245 else:\r
246 if self.backtracking > 0:\r
247 self.failed = True\r
f7496d71 248 return\r
f51461c8
LG
249\r
250 nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 3, self.input)\r
251\r
252 raise nvae\r
253\r
254 elif (LA3_0 == 36) :\r
255 LA3_4 = self.input.LA(2)\r
256\r
257 if (self.synpred4()) :\r
258 alt3 = 1\r
259 elif (self.synpred5()) :\r
260 alt3 = 2\r
261 else:\r
262 if self.backtracking > 0:\r
263 self.failed = True\r
f7496d71 264 return\r
f51461c8
LG
265\r
266 nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 4, self.input)\r
267\r
268 raise nvae\r
269\r
270 elif (LA3_0 == 37) :\r
271 LA3_5 = self.input.LA(2)\r
272\r
273 if (self.synpred4()) :\r
274 alt3 = 1\r
275 elif (self.synpred5()) :\r
276 alt3 = 2\r
277 else:\r
278 if self.backtracking > 0:\r
279 self.failed = True\r
f7496d71 280 return\r
f51461c8
LG
281\r
282 nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 5, self.input)\r
283\r
284 raise nvae\r
285\r
286 elif (LA3_0 == 38) :\r
287 LA3_6 = self.input.LA(2)\r
288\r
289 if (self.synpred4()) :\r
290 alt3 = 1\r
291 elif (self.synpred5()) :\r
292 alt3 = 2\r
293 else:\r
294 if self.backtracking > 0:\r
295 self.failed = True\r
f7496d71 296 return\r
f51461c8
LG
297\r
298 nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 6, self.input)\r
299\r
300 raise nvae\r
301\r
302 elif (LA3_0 == 39) :\r
303 LA3_7 = self.input.LA(2)\r
304\r
305 if (self.synpred4()) :\r
306 alt3 = 1\r
307 elif (self.synpred5()) :\r
308 alt3 = 2\r
309 else:\r
310 if self.backtracking > 0:\r
311 self.failed = True\r
f7496d71 312 return\r
f51461c8
LG
313\r
314 nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 7, self.input)\r
315\r
316 raise nvae\r
317\r
318 elif (LA3_0 == 40) :\r
319 LA3_8 = self.input.LA(2)\r
320\r
321 if (self.synpred4()) :\r
322 alt3 = 1\r
323 elif (self.synpred5()) :\r
324 alt3 = 2\r
325 else:\r
326 if self.backtracking > 0:\r
327 self.failed = True\r
f7496d71 328 return\r
f51461c8
LG
329\r
330 nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 8, self.input)\r
331\r
332 raise nvae\r
333\r
334 elif (LA3_0 == 41) :\r
335 LA3_9 = self.input.LA(2)\r
336\r
337 if (self.synpred4()) :\r
338 alt3 = 1\r
339 elif (self.synpred5()) :\r
340 alt3 = 2\r
341 else:\r
342 if self.backtracking > 0:\r
343 self.failed = True\r
f7496d71 344 return\r
f51461c8
LG
345\r
346 nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 9, self.input)\r
347\r
348 raise nvae\r
349\r
350 elif (LA3_0 == 42) :\r
351 LA3_10 = self.input.LA(2)\r
352\r
353 if (self.synpred4()) :\r
354 alt3 = 1\r
355 elif (self.synpred5()) :\r
356 alt3 = 2\r
357 else:\r
358 if self.backtracking > 0:\r
359 self.failed = True\r
f7496d71 360 return\r
f51461c8
LG
361\r
362 nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 10, self.input)\r
363\r
364 raise nvae\r
365\r
366 elif ((45 <= LA3_0 <= 46)) :\r
367 LA3_11 = self.input.LA(2)\r
368\r
369 if (self.synpred4()) :\r
370 alt3 = 1\r
371 elif (self.synpred5()) :\r
372 alt3 = 2\r
373 else:\r
374 if self.backtracking > 0:\r
375 self.failed = True\r
f7496d71 376 return\r
f51461c8
LG
377\r
378 nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 11, self.input)\r
379\r
380 raise nvae\r
381\r
382 elif (LA3_0 == 48) :\r
383 LA3_12 = self.input.LA(2)\r
384\r
385 if (self.synpred4()) :\r
386 alt3 = 1\r
387 elif (self.synpred5()) :\r
388 alt3 = 2\r
389 else:\r
390 if self.backtracking > 0:\r
391 self.failed = True\r
f7496d71 392 return\r
f51461c8
LG
393\r
394 nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 12, self.input)\r
395\r
396 raise nvae\r
397\r
398 elif (LA3_0 == IDENTIFIER) :\r
399 LA3_13 = self.input.LA(2)\r
400\r
401 if (self.synpred4()) :\r
402 alt3 = 1\r
403 elif (self.synpred5()) :\r
404 alt3 = 2\r
405 elif (True) :\r
406 alt3 = 3\r
407 else:\r
408 if self.backtracking > 0:\r
409 self.failed = True\r
f7496d71 410 return\r
f51461c8
LG
411\r
412 nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 13, self.input)\r
413\r
414 raise nvae\r
415\r
416 elif (LA3_0 == 58) :\r
417 LA3_14 = self.input.LA(2)\r
418\r
419 if (self.synpred4()) :\r
420 alt3 = 1\r
421 elif (self.synpred5()) :\r
422 alt3 = 2\r
423 else:\r
424 if self.backtracking > 0:\r
425 self.failed = True\r
f7496d71 426 return\r
f51461c8
LG
427\r
428 nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 14, self.input)\r
429\r
430 raise nvae\r
431\r
432 elif (LA3_0 == 66) and (self.synpred4()):\r
433 alt3 = 1\r
434 elif (LA3_0 == 59) :\r
435 LA3_16 = self.input.LA(2)\r
436\r
437 if (self.synpred4()) :\r
438 alt3 = 1\r
439 elif (self.synpred5()) :\r
440 alt3 = 2\r
441 else:\r
442 if self.backtracking > 0:\r
443 self.failed = True\r
f7496d71 444 return\r
f51461c8
LG
445\r
446 nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 16, self.input)\r
447\r
448 raise nvae\r
449\r
450 elif (LA3_0 == 60) :\r
451 LA3_17 = self.input.LA(2)\r
452\r
453 if (self.synpred4()) :\r
454 alt3 = 1\r
455 elif (self.synpred5()) :\r
456 alt3 = 2\r
457 else:\r
458 if self.backtracking > 0:\r
459 self.failed = True\r
f7496d71 460 return\r
f51461c8
LG
461\r
462 nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 17, self.input)\r
463\r
464 raise nvae\r
465\r
466 elif ((49 <= LA3_0 <= 57) or LA3_0 == 61) :\r
467 LA3_18 = self.input.LA(2)\r
468\r
469 if (self.synpred4()) :\r
470 alt3 = 1\r
471 elif (self.synpred5()) :\r
472 alt3 = 2\r
473 else:\r
474 if self.backtracking > 0:\r
475 self.failed = True\r
f7496d71 476 return\r
f51461c8
LG
477\r
478 nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 18, self.input)\r
479\r
480 raise nvae\r
481\r
482 elif (LA3_0 == 62) and (self.synpred4()):\r
483 alt3 = 1\r
484 elif (LA3_0 == 26) :\r
485 alt3 = 2\r
486 else:\r
487 if self.backtracking > 0:\r
488 self.failed = True\r
f7496d71 489 return\r
f51461c8
LG
490\r
491 nvae = NoViableAltException("114:1: external_declaration options {k=1; } : ( ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition | declaration | macro_statement ( ';' )? );", 3, 0, self.input)\r
492\r
493 raise nvae\r
494\r
495 if alt3 == 1:\r
496 # C.g:119:4: ( ( declaration_specifiers )? declarator ( declaration )* '{' )=> function_definition\r
497 self.following.append(self.FOLLOW_function_definition_in_external_declaration113)\r
498 self.function_definition()\r
499 self.following.pop()\r
500 if self.failed:\r
f7496d71 501 return\r
f51461c8
LG
502\r
503\r
504 elif alt3 == 2:\r
505 # C.g:120:4: declaration\r
506 self.following.append(self.FOLLOW_declaration_in_external_declaration118)\r
507 self.declaration()\r
508 self.following.pop()\r
509 if self.failed:\r
f7496d71 510 return\r
f51461c8
LG
511\r
512\r
513 elif alt3 == 3:\r
514 # C.g:121:4: macro_statement ( ';' )?\r
515 self.following.append(self.FOLLOW_macro_statement_in_external_declaration123)\r
516 self.macro_statement()\r
517 self.following.pop()\r
518 if self.failed:\r
f7496d71 519 return\r
f51461c8
LG
520 # C.g:121:20: ( ';' )?\r
521 alt2 = 2\r
522 LA2_0 = self.input.LA(1)\r
523\r
524 if (LA2_0 == 25) :\r
525 alt2 = 1\r
526 if alt2 == 1:\r
527 # C.g:121:21: ';'\r
528 self.match(self.input, 25, self.FOLLOW_25_in_external_declaration126)\r
529 if self.failed:\r
f7496d71 530 return\r
f51461c8
LG
531\r
532\r
533\r
534\r
535\r
536\r
5b0671c1 537 except RecognitionException as re:\r
f51461c8
LG
538 self.reportError(re)\r
539 self.recover(self.input, re)\r
540 finally:\r
541 if self.backtracking > 0:\r
542 self.memoize(self.input, 2, external_declaration_StartIndex)\r
543\r
544 pass\r
545\r
f7496d71 546 return\r
f51461c8
LG
547\r
548 # $ANTLR end external_declaration\r
549\r
550 class function_definition_return(object):\r
551 def __init__(self):\r
552 self.start = None\r
553 self.stop = None\r
554\r
555\r
556\r
557 # $ANTLR start function_definition\r
558 # C.g:126:1: function_definition : (d= declaration_specifiers )? declarator ( ( declaration )+ a= compound_statement | b= compound_statement ) ;\r
559 def function_definition(self, ):\r
560 self.function_definition_stack.append(function_definition_scope())\r
561 retval = self.function_definition_return()\r
562 retval.start = self.input.LT(1)\r
563 function_definition_StartIndex = self.input.index()\r
564 d = None\r
565\r
566 a = None\r
567\r
568 b = None\r
569\r
570 declarator1 = None\r
571\r
572\r
f7496d71 573\r
52302d4d
LG
574 self.function_definition_stack[-1].ModifierText = ''\r
575 self.function_definition_stack[-1].DeclText = ''\r
576 self.function_definition_stack[-1].LBLine = 0\r
577 self.function_definition_stack[-1].LBOffset = 0\r
578 self.function_definition_stack[-1].DeclLine = 0\r
579 self.function_definition_stack[-1].DeclOffset = 0\r
f51461c8
LG
580\r
581 try:\r
582 try:\r
583 if self.backtracking > 0 and self.alreadyParsedRule(self.input, 3):\r
584 return retval\r
585\r
586 # C.g:146:2: ( (d= declaration_specifiers )? declarator ( ( declaration )+ a= compound_statement | b= compound_statement ) )\r
587 # C.g:146:4: (d= declaration_specifiers )? declarator ( ( declaration )+ a= compound_statement | b= compound_statement )\r
588 # C.g:146:5: (d= declaration_specifiers )?\r
589 alt4 = 2\r
590 LA4 = self.input.LA(1)\r
591 if LA4 == 29 or LA4 == 30 or LA4 == 31 or LA4 == 32 or LA4 == 33 or LA4 == 34 or LA4 == 35 or LA4 == 36 or LA4 == 37 or LA4 == 38 or LA4 == 39 or LA4 == 40 or LA4 == 41 or LA4 == 42 or LA4 == 45 or LA4 == 46 or LA4 == 48 or LA4 == 49 or LA4 == 50 or LA4 == 51 or LA4 == 52 or LA4 == 53 or LA4 == 54 or LA4 == 55 or LA4 == 56 or LA4 == 57 or LA4 == 61:\r
592 alt4 = 1\r
593 elif LA4 == IDENTIFIER:\r
594 LA4 = self.input.LA(2)\r
595 if LA4 == 66:\r
596 alt4 = 1\r
597 elif LA4 == 58:\r
598 LA4_21 = self.input.LA(3)\r
599\r
600 if (self.synpred7()) :\r
601 alt4 = 1\r
602 elif LA4 == 59:\r
603 LA4_22 = self.input.LA(3)\r
604\r
605 if (self.synpred7()) :\r
606 alt4 = 1\r
607 elif LA4 == 60:\r
608 LA4_23 = self.input.LA(3)\r
609\r
610 if (self.synpred7()) :\r
611 alt4 = 1\r
612 elif LA4 == IDENTIFIER:\r
613 LA4_24 = self.input.LA(3)\r
614\r
615 if (self.synpred7()) :\r
616 alt4 = 1\r
617 elif LA4 == 62:\r
618 LA4_25 = self.input.LA(3)\r
619\r
620 if (self.synpred7()) :\r
621 alt4 = 1\r
622 elif LA4 == 29 or LA4 == 30 or LA4 == 31 or LA4 == 32 or LA4 == 33:\r
623 LA4_26 = self.input.LA(3)\r
624\r
625 if (self.synpred7()) :\r
626 alt4 = 1\r
627 elif LA4 == 34:\r
628 LA4_27 = self.input.LA(3)\r
629\r
630 if (self.synpred7()) :\r
631 alt4 = 1\r
632 elif LA4 == 35:\r
633 LA4_28 = self.input.LA(3)\r
634\r
635 if (self.synpred7()) :\r
636 alt4 = 1\r
637 elif LA4 == 36:\r
638 LA4_29 = self.input.LA(3)\r
639\r
640 if (self.synpred7()) :\r
641 alt4 = 1\r
642 elif LA4 == 37:\r
643 LA4_30 = self.input.LA(3)\r
644\r
645 if (self.synpred7()) :\r
646 alt4 = 1\r
647 elif LA4 == 38:\r
648 LA4_31 = self.input.LA(3)\r
649\r
650 if (self.synpred7()) :\r
651 alt4 = 1\r
652 elif LA4 == 39:\r
653 LA4_32 = self.input.LA(3)\r
654\r
655 if (self.synpred7()) :\r
656 alt4 = 1\r
657 elif LA4 == 40:\r
658 LA4_33 = self.input.LA(3)\r
659\r
660 if (self.synpred7()) :\r
661 alt4 = 1\r
662 elif LA4 == 41:\r
663 LA4_34 = self.input.LA(3)\r
664\r
665 if (self.synpred7()) :\r
666 alt4 = 1\r
667 elif LA4 == 42:\r
668 LA4_35 = self.input.LA(3)\r
669\r
670 if (self.synpred7()) :\r
671 alt4 = 1\r
672 elif LA4 == 45 or LA4 == 46:\r
673 LA4_36 = self.input.LA(3)\r
674\r
675 if (self.synpred7()) :\r
676 alt4 = 1\r
677 elif LA4 == 48:\r
678 LA4_37 = self.input.LA(3)\r
679\r
680 if (self.synpred7()) :\r
681 alt4 = 1\r
682 elif LA4 == 49 or LA4 == 50 or LA4 == 51 or LA4 == 52 or LA4 == 53 or LA4 == 54 or LA4 == 55 or LA4 == 56 or LA4 == 57 or LA4 == 61:\r
683 LA4_38 = self.input.LA(3)\r
684\r
685 if (self.synpred7()) :\r
686 alt4 = 1\r
687 elif LA4 == 58:\r
688 LA4_14 = self.input.LA(2)\r
689\r
690 if (self.synpred7()) :\r
691 alt4 = 1\r
692 elif LA4 == 59:\r
693 LA4_16 = self.input.LA(2)\r
694\r
695 if (self.synpred7()) :\r
696 alt4 = 1\r
697 elif LA4 == 60:\r
698 LA4_17 = self.input.LA(2)\r
699\r
700 if (self.synpred7()) :\r
701 alt4 = 1\r
702 if alt4 == 1:\r
703 # C.g:0:0: d= declaration_specifiers\r
704 self.following.append(self.FOLLOW_declaration_specifiers_in_function_definition157)\r
705 d = self.declaration_specifiers()\r
706 self.following.pop()\r
707 if self.failed:\r
708 return retval\r
709\r
710\r
711\r
712 self.following.append(self.FOLLOW_declarator_in_function_definition160)\r
713 declarator1 = self.declarator()\r
714 self.following.pop()\r
715 if self.failed:\r
716 return retval\r
717 # C.g:147:3: ( ( declaration )+ a= compound_statement | b= compound_statement )\r
718 alt6 = 2\r
719 LA6_0 = self.input.LA(1)\r
720\r
721 if (LA6_0 == IDENTIFIER or LA6_0 == 26 or (29 <= LA6_0 <= 42) or (45 <= LA6_0 <= 46) or (48 <= LA6_0 <= 61)) :\r
722 alt6 = 1\r
723 elif (LA6_0 == 43) :\r
724 alt6 = 2\r
725 else:\r
726 if self.backtracking > 0:\r
727 self.failed = True\r
728 return retval\r
729\r
730 nvae = NoViableAltException("147:3: ( ( declaration )+ a= compound_statement | b= compound_statement )", 6, 0, self.input)\r
731\r
732 raise nvae\r
733\r
734 if alt6 == 1:\r
735 # C.g:147:5: ( declaration )+ a= compound_statement\r
736 # C.g:147:5: ( declaration )+\r
737 cnt5 = 0\r
738 while True: #loop5\r
739 alt5 = 2\r
740 LA5_0 = self.input.LA(1)\r
741\r
742 if (LA5_0 == IDENTIFIER or LA5_0 == 26 or (29 <= LA5_0 <= 42) or (45 <= LA5_0 <= 46) or (48 <= LA5_0 <= 61)) :\r
743 alt5 = 1\r
744\r
745\r
746 if alt5 == 1:\r
747 # C.g:0:0: declaration\r
748 self.following.append(self.FOLLOW_declaration_in_function_definition166)\r
749 self.declaration()\r
750 self.following.pop()\r
751 if self.failed:\r
752 return retval\r
753\r
754\r
755 else:\r
756 if cnt5 >= 1:\r
757 break #loop5\r
758\r
759 if self.backtracking > 0:\r
760 self.failed = True\r
761 return retval\r
762\r
763 eee = EarlyExitException(5, self.input)\r
764 raise eee\r
765\r
766 cnt5 += 1\r
767\r
768\r
769 self.following.append(self.FOLLOW_compound_statement_in_function_definition171)\r
770 a = self.compound_statement()\r
771 self.following.pop()\r
772 if self.failed:\r
773 return retval\r
774\r
775\r
776 elif alt6 == 2:\r
777 # C.g:148:5: b= compound_statement\r
778 self.following.append(self.FOLLOW_compound_statement_in_function_definition180)\r
779 b = self.compound_statement()\r
780 self.following.pop()\r
781 if self.failed:\r
782 return retval\r
783\r
784\r
785\r
786 if self.backtracking == 0:\r
f7496d71 787\r
4231a819 788 if d is not None:\r
ccaa7754 789 self.function_definition_stack[-1].ModifierText = self.input.toString(d.start, d.stop)\r
52302d4d
LG
790 else:\r
791 self.function_definition_stack[-1].ModifierText = ''\r
ccaa7754 792 self.function_definition_stack[-1].DeclText = self.input.toString(declarator1.start, declarator1.stop)\r
52302d4d
LG
793 self.function_definition_stack[-1].DeclLine = declarator1.start.line\r
794 self.function_definition_stack[-1].DeclOffset = declarator1.start.charPositionInLine\r
4231a819 795 if a is not None:\r
52302d4d
LG
796 self.function_definition_stack[-1].LBLine = a.start.line\r
797 self.function_definition_stack[-1].LBOffset = a.start.charPositionInLine\r
798 else:\r
799 self.function_definition_stack[-1].LBLine = b.start.line\r
800 self.function_definition_stack[-1].LBOffset = b.start.charPositionInLine\r
f7496d71 801\r
f51461c8
LG
802\r
803\r
804\r
805\r
806 retval.stop = self.input.LT(-1)\r
807\r
808 if self.backtracking == 0:\r
f7496d71 809\r
52302d4d 810 self.StoreFunctionDefinition(retval.start.line, retval.start.charPositionInLine, retval.stop.line, retval.stop.charPositionInLine, self.function_definition_stack[-1].ModifierText, self.function_definition_stack[-1].DeclText, self.function_definition_stack[-1].LBLine, self.function_definition_stack[-1].LBOffset, self.function_definition_stack[-1].DeclLine, self.function_definition_stack[-1].DeclOffset)\r
f51461c8
LG
811\r
812\r
813\r
5b0671c1 814 except RecognitionException as re:\r
f51461c8
LG
815 self.reportError(re)\r
816 self.recover(self.input, re)\r
817 finally:\r
818 if self.backtracking > 0:\r
819 self.memoize(self.input, 3, function_definition_StartIndex)\r
820\r
821 self.function_definition_stack.pop()\r
822 pass\r
823\r
824 return retval\r
825\r
826 # $ANTLR end function_definition\r
827\r
828\r
829 # $ANTLR start declaration\r
830 # C.g:166:1: declaration : (a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';' | s= declaration_specifiers (t= init_declarator_list )? e= ';' );\r
831 def declaration(self, ):\r
832\r
833 declaration_StartIndex = self.input.index()\r
834 a = None\r
835 d = None\r
836 e = None\r
837 b = None\r
838\r
839 c = None\r
840\r
841 s = None\r
842\r
843 t = None\r
844\r
845\r
846 try:\r
847 try:\r
848 if self.backtracking > 0 and self.alreadyParsedRule(self.input, 4):\r
f7496d71 849 return\r
f51461c8
LG
850\r
851 # C.g:167:2: (a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';' | s= declaration_specifiers (t= init_declarator_list )? e= ';' )\r
852 alt9 = 2\r
853 LA9_0 = self.input.LA(1)\r
854\r
855 if (LA9_0 == 26) :\r
856 alt9 = 1\r
857 elif (LA9_0 == IDENTIFIER or (29 <= LA9_0 <= 42) or (45 <= LA9_0 <= 46) or (48 <= LA9_0 <= 61)) :\r
858 alt9 = 2\r
859 else:\r
860 if self.backtracking > 0:\r
861 self.failed = True\r
f7496d71 862 return\r
f51461c8
LG
863\r
864 nvae = NoViableAltException("166:1: declaration : (a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';' | s= declaration_specifiers (t= init_declarator_list )? e= ';' );", 9, 0, self.input)\r
865\r
866 raise nvae\r
867\r
868 if alt9 == 1:\r
869 # C.g:167:4: a= 'typedef' (b= declaration_specifiers )? c= init_declarator_list d= ';'\r
870 a = self.input.LT(1)\r
871 self.match(self.input, 26, self.FOLLOW_26_in_declaration203)\r
872 if self.failed:\r
f7496d71 873 return\r
f51461c8
LG
874 # C.g:167:17: (b= declaration_specifiers )?\r
875 alt7 = 2\r
876 LA7 = self.input.LA(1)\r
877 if LA7 == 29 or LA7 == 30 or LA7 == 31 or LA7 == 32 or LA7 == 33 or LA7 == 34 or LA7 == 35 or LA7 == 36 or LA7 == 37 or LA7 == 38 or LA7 == 39 or LA7 == 40 or LA7 == 41 or LA7 == 42 or LA7 == 45 or LA7 == 46 or LA7 == 48 or LA7 == 49 or LA7 == 50 or LA7 == 51 or LA7 == 52 or LA7 == 53 or LA7 == 54 or LA7 == 55 or LA7 == 56 or LA7 == 57 or LA7 == 61:\r
878 alt7 = 1\r
879 elif LA7 == IDENTIFIER:\r
880 LA7_13 = self.input.LA(2)\r
881\r
882 if (LA7_13 == 62) :\r
883 LA7_21 = self.input.LA(3)\r
884\r
885 if (self.synpred10()) :\r
886 alt7 = 1\r
887 elif (LA7_13 == IDENTIFIER or (29 <= LA7_13 <= 42) or (45 <= LA7_13 <= 46) or (48 <= LA7_13 <= 61) or LA7_13 == 66) :\r
888 alt7 = 1\r
889 elif LA7 == 58:\r
890 LA7_14 = self.input.LA(2)\r
891\r
892 if (self.synpred10()) :\r
893 alt7 = 1\r
894 elif LA7 == 59:\r
895 LA7_16 = self.input.LA(2)\r
896\r
897 if (self.synpred10()) :\r
898 alt7 = 1\r
899 elif LA7 == 60:\r
900 LA7_17 = self.input.LA(2)\r
901\r
902 if (self.synpred10()) :\r
903 alt7 = 1\r
904 if alt7 == 1:\r
905 # C.g:0:0: b= declaration_specifiers\r
906 self.following.append(self.FOLLOW_declaration_specifiers_in_declaration207)\r
907 b = self.declaration_specifiers()\r
908 self.following.pop()\r
909 if self.failed:\r
f7496d71 910 return\r
f51461c8
LG
911\r
912\r
913\r
914 self.following.append(self.FOLLOW_init_declarator_list_in_declaration216)\r
915 c = self.init_declarator_list()\r
916 self.following.pop()\r
917 if self.failed:\r
f7496d71 918 return\r
f51461c8
LG
919 d = self.input.LT(1)\r
920 self.match(self.input, 25, self.FOLLOW_25_in_declaration220)\r
921 if self.failed:\r
f7496d71 922 return\r
f51461c8 923 if self.backtracking == 0:\r
f7496d71 924\r
4231a819 925 if b is not None:\r
ccaa7754 926 self.StoreTypedefDefinition(a.line, a.charPositionInLine, d.line, d.charPositionInLine, self.input.toString(b.start, b.stop), self.input.toString(c.start, c.stop))\r
52302d4d 927 else:\r
ccaa7754 928 self.StoreTypedefDefinition(a.line, a.charPositionInLine, d.line, d.charPositionInLine, '', self.input.toString(c.start, c.stop))\r
f7496d71 929\r
f51461c8
LG
930\r
931\r
932\r
933 elif alt9 == 2:\r
934 # C.g:175:4: s= declaration_specifiers (t= init_declarator_list )? e= ';'\r
935 self.following.append(self.FOLLOW_declaration_specifiers_in_declaration234)\r
936 s = self.declaration_specifiers()\r
937 self.following.pop()\r
938 if self.failed:\r
f7496d71 939 return\r
f51461c8
LG
940 # C.g:175:30: (t= init_declarator_list )?\r
941 alt8 = 2\r
942 LA8_0 = self.input.LA(1)\r
943\r
944 if (LA8_0 == IDENTIFIER or (58 <= LA8_0 <= 60) or LA8_0 == 62 or LA8_0 == 66) :\r
945 alt8 = 1\r
946 if alt8 == 1:\r
947 # C.g:0:0: t= init_declarator_list\r
948 self.following.append(self.FOLLOW_init_declarator_list_in_declaration238)\r
949 t = self.init_declarator_list()\r
950 self.following.pop()\r
951 if self.failed:\r
f7496d71 952 return\r
f51461c8
LG
953\r
954\r
955\r
956 e = self.input.LT(1)\r
957 self.match(self.input, 25, self.FOLLOW_25_in_declaration243)\r
958 if self.failed:\r
f7496d71 959 return\r
f51461c8 960 if self.backtracking == 0:\r
f7496d71 961\r
4231a819 962 if t is not None:\r
ccaa7754 963 self.StoreVariableDeclaration(s.start.line, s.start.charPositionInLine, t.start.line, t.start.charPositionInLine, self.input.toString(s.start, s.stop), self.input.toString(t.start, t.stop))\r
f7496d71 964\r
f51461c8
LG
965\r
966\r
967\r
968\r
5b0671c1 969 except RecognitionException as re:\r
f51461c8
LG
970 self.reportError(re)\r
971 self.recover(self.input, re)\r
972 finally:\r
973 if self.backtracking > 0:\r
974 self.memoize(self.input, 4, declaration_StartIndex)\r
975\r
976 pass\r
977\r
f7496d71 978 return\r
f51461c8
LG
979\r
980 # $ANTLR end declaration\r
981\r
982 class declaration_specifiers_return(object):\r
983 def __init__(self):\r
984 self.start = None\r
985 self.stop = None\r
986\r
987\r
988\r
989 # $ANTLR start declaration_specifiers\r
990 # C.g:182:1: declaration_specifiers : ( storage_class_specifier | type_specifier | type_qualifier )+ ;\r
991 def declaration_specifiers(self, ):\r
992\r
993 retval = self.declaration_specifiers_return()\r
994 retval.start = self.input.LT(1)\r
995 declaration_specifiers_StartIndex = self.input.index()\r
996 try:\r
997 try:\r
998 if self.backtracking > 0 and self.alreadyParsedRule(self.input, 5):\r
999 return retval\r
1000\r
1001 # C.g:183:2: ( ( storage_class_specifier | type_specifier | type_qualifier )+ )\r
1002 # C.g:183:6: ( storage_class_specifier | type_specifier | type_qualifier )+\r
1003 # C.g:183:6: ( storage_class_specifier | type_specifier | type_qualifier )+\r
1004 cnt10 = 0\r
1005 while True: #loop10\r
1006 alt10 = 4\r
1007 LA10 = self.input.LA(1)\r
1008 if LA10 == 58:\r
1009 LA10_2 = self.input.LA(2)\r
1010\r
1011 if (self.synpred15()) :\r
1012 alt10 = 3\r
1013\r
1014\r
1015 elif LA10 == 59:\r
1016 LA10_3 = self.input.LA(2)\r
1017\r
1018 if (self.synpred15()) :\r
1019 alt10 = 3\r
1020\r
1021\r
1022 elif LA10 == 60:\r
1023 LA10_4 = self.input.LA(2)\r
1024\r
1025 if (self.synpred15()) :\r
1026 alt10 = 3\r
1027\r
1028\r
1029 elif LA10 == IDENTIFIER:\r
1030 LA10_5 = self.input.LA(2)\r
1031\r
1032 if (self.synpred14()) :\r
1033 alt10 = 2\r
1034\r
1035\r
1036 elif LA10 == 53:\r
1037 LA10_9 = self.input.LA(2)\r
1038\r
1039 if (self.synpred15()) :\r
1040 alt10 = 3\r
1041\r
1042\r
1043 elif LA10 == 29 or LA10 == 30 or LA10 == 31 or LA10 == 32 or LA10 == 33:\r
1044 alt10 = 1\r
1045 elif LA10 == 34 or LA10 == 35 or LA10 == 36 or LA10 == 37 or LA10 == 38 or LA10 == 39 or LA10 == 40 or LA10 == 41 or LA10 == 42 or LA10 == 45 or LA10 == 46 or LA10 == 48:\r
1046 alt10 = 2\r
1047 elif LA10 == 49 or LA10 == 50 or LA10 == 51 or LA10 == 52 or LA10 == 54 or LA10 == 55 or LA10 == 56 or LA10 == 57 or LA10 == 61:\r
1048 alt10 = 3\r
1049\r
1050 if alt10 == 1:\r
1051 # C.g:183:10: storage_class_specifier\r
1052 self.following.append(self.FOLLOW_storage_class_specifier_in_declaration_specifiers264)\r
1053 self.storage_class_specifier()\r
1054 self.following.pop()\r
1055 if self.failed:\r
1056 return retval\r
1057\r
1058\r
1059 elif alt10 == 2:\r
1060 # C.g:184:7: type_specifier\r
1061 self.following.append(self.FOLLOW_type_specifier_in_declaration_specifiers272)\r
1062 self.type_specifier()\r
1063 self.following.pop()\r
1064 if self.failed:\r
1065 return retval\r
1066\r
1067\r
1068 elif alt10 == 3:\r
1069 # C.g:185:13: type_qualifier\r
1070 self.following.append(self.FOLLOW_type_qualifier_in_declaration_specifiers286)\r
1071 self.type_qualifier()\r
1072 self.following.pop()\r
1073 if self.failed:\r
1074 return retval\r
1075\r
1076\r
1077 else:\r
1078 if cnt10 >= 1:\r
1079 break #loop10\r
1080\r
1081 if self.backtracking > 0:\r
1082 self.failed = True\r
1083 return retval\r
1084\r
1085 eee = EarlyExitException(10, self.input)\r
1086 raise eee\r
1087\r
1088 cnt10 += 1\r
1089\r
1090\r
1091\r
1092\r
1093\r
1094 retval.stop = self.input.LT(-1)\r
1095\r
1096\r
5b0671c1 1097 except RecognitionException as re:\r
f51461c8
LG
1098 self.reportError(re)\r
1099 self.recover(self.input, re)\r
1100 finally:\r
1101 if self.backtracking > 0:\r
1102 self.memoize(self.input, 5, declaration_specifiers_StartIndex)\r
1103\r
1104 pass\r
1105\r
1106 return retval\r
1107\r
1108 # $ANTLR end declaration_specifiers\r
1109\r
1110 class init_declarator_list_return(object):\r
1111 def __init__(self):\r
1112 self.start = None\r
1113 self.stop = None\r
1114\r
1115\r
1116\r
1117 # $ANTLR start init_declarator_list\r
1118 # C.g:189:1: init_declarator_list : init_declarator ( ',' init_declarator )* ;\r
1119 def init_declarator_list(self, ):\r
1120\r
1121 retval = self.init_declarator_list_return()\r
1122 retval.start = self.input.LT(1)\r
1123 init_declarator_list_StartIndex = self.input.index()\r
1124 try:\r
1125 try:\r
1126 if self.backtracking > 0 and self.alreadyParsedRule(self.input, 6):\r
1127 return retval\r
1128\r
1129 # C.g:190:2: ( init_declarator ( ',' init_declarator )* )\r
1130 # C.g:190:4: init_declarator ( ',' init_declarator )*\r
1131 self.following.append(self.FOLLOW_init_declarator_in_init_declarator_list308)\r
1132 self.init_declarator()\r
1133 self.following.pop()\r
1134 if self.failed:\r
1135 return retval\r
1136 # C.g:190:20: ( ',' init_declarator )*\r
1137 while True: #loop11\r
1138 alt11 = 2\r
1139 LA11_0 = self.input.LA(1)\r
1140\r
1141 if (LA11_0 == 27) :\r
1142 alt11 = 1\r
1143\r
1144\r
1145 if alt11 == 1:\r
1146 # C.g:190:21: ',' init_declarator\r
1147 self.match(self.input, 27, self.FOLLOW_27_in_init_declarator_list311)\r
1148 if self.failed:\r
1149 return retval\r
1150 self.following.append(self.FOLLOW_init_declarator_in_init_declarator_list313)\r
1151 self.init_declarator()\r
1152 self.following.pop()\r
1153 if self.failed:\r
1154 return retval\r
1155\r
1156\r
1157 else:\r
1158 break #loop11\r
1159\r
1160\r
1161\r
1162\r
1163\r
1164 retval.stop = self.input.LT(-1)\r
1165\r
1166\r
5b0671c1 1167 except RecognitionException as re:\r
f51461c8
LG
1168 self.reportError(re)\r
1169 self.recover(self.input, re)\r
1170 finally:\r
1171 if self.backtracking > 0:\r
1172 self.memoize(self.input, 6, init_declarator_list_StartIndex)\r
1173\r
1174 pass\r
1175\r
1176 return retval\r
1177\r
1178 # $ANTLR end init_declarator_list\r
1179\r
1180\r
1181 # $ANTLR start init_declarator\r
1182 # C.g:193:1: init_declarator : declarator ( '=' initializer )? ;\r
1183 def init_declarator(self, ):\r
1184\r
1185 init_declarator_StartIndex = self.input.index()\r
1186 try:\r
1187 try:\r
1188 if self.backtracking > 0 and self.alreadyParsedRule(self.input, 7):\r
f7496d71 1189 return\r
f51461c8
LG
1190\r
1191 # C.g:194:2: ( declarator ( '=' initializer )? )\r
1192 # C.g:194:4: declarator ( '=' initializer )?\r
1193 self.following.append(self.FOLLOW_declarator_in_init_declarator326)\r
1194 self.declarator()\r
1195 self.following.pop()\r
1196 if self.failed:\r
f7496d71 1197 return\r
f51461c8
LG
1198 # C.g:194:15: ( '=' initializer )?\r
1199 alt12 = 2\r
1200 LA12_0 = self.input.LA(1)\r
1201\r
1202 if (LA12_0 == 28) :\r
1203 alt12 = 1\r
1204 if alt12 == 1:\r
1205 # C.g:194:16: '=' initializer\r
1206 self.match(self.input, 28, self.FOLLOW_28_in_init_declarator329)\r
1207 if self.failed:\r
f7496d71 1208 return\r
f51461c8
LG
1209 self.following.append(self.FOLLOW_initializer_in_init_declarator331)\r
1210 self.initializer()\r
1211 self.following.pop()\r
1212 if self.failed:\r
f7496d71 1213 return\r
f51461c8
LG
1214\r
1215\r
1216\r
1217\r
1218\r
1219\r
1220\r
5b0671c1 1221 except RecognitionException as re:\r
f51461c8
LG
1222 self.reportError(re)\r
1223 self.recover(self.input, re)\r
1224 finally:\r
1225 if self.backtracking > 0:\r
1226 self.memoize(self.input, 7, init_declarator_StartIndex)\r
1227\r
1228 pass\r
1229\r
f7496d71 1230 return\r
f51461c8
LG
1231\r
1232 # $ANTLR end init_declarator\r
1233\r
1234\r
1235 # $ANTLR start storage_class_specifier\r
1236 # C.g:197:1: storage_class_specifier : ( 'extern' | 'static' | 'auto' | 'register' | 'STATIC' );\r
1237 def storage_class_specifier(self, ):\r
1238\r
1239 storage_class_specifier_StartIndex = self.input.index()\r
1240 try:\r
1241 try:\r
1242 if self.backtracking > 0 and self.alreadyParsedRule(self.input, 8):\r
f7496d71 1243 return\r
f51461c8
LG
1244\r
1245 # C.g:198:2: ( 'extern' | 'static' | 'auto' | 'register' | 'STATIC' )\r
1246 # C.g:\r
1247 if (29 <= self.input.LA(1) <= 33):\r
1248 self.input.consume();\r
1249 self.errorRecovery = False\r
1250 self.failed = False\r
1251\r
1252 else:\r
1253 if self.backtracking > 0:\r
1254 self.failed = True\r
f7496d71 1255 return\r
f51461c8
LG
1256\r
1257 mse = MismatchedSetException(None, self.input)\r
1258 self.recoverFromMismatchedSet(\r
1259 self.input, mse, self.FOLLOW_set_in_storage_class_specifier0\r
1260 )\r
1261 raise mse\r
1262\r
1263\r
1264\r
1265\r
1266\r
1267\r
5b0671c1 1268 except RecognitionException as re:\r
f51461c8
LG
1269 self.reportError(re)\r
1270 self.recover(self.input, re)\r
1271 finally:\r
1272 if self.backtracking > 0:\r
1273 self.memoize(self.input, 8, storage_class_specifier_StartIndex)\r
1274\r
1275 pass\r
1276\r
f7496d71 1277 return\r
f51461c8
LG
1278\r
1279 # $ANTLR end storage_class_specifier\r
1280\r
1281\r
1282 # $ANTLR start type_specifier\r
1283 # C.g:205:1: type_specifier : ( 'void' | 'char' | 'short' | 'int' | 'long' | 'float' | 'double' | 'signed' | 'unsigned' | s= struct_or_union_specifier | e= enum_specifier | ( IDENTIFIER ( type_qualifier )* declarator )=> type_id );\r
1284 def type_specifier(self, ):\r
1285\r
1286 type_specifier_StartIndex = self.input.index()\r
1287 s = None\r
1288\r
1289 e = None\r
1290\r
1291\r
1292 try:\r
1293 try:\r
1294 if self.backtracking > 0 and self.alreadyParsedRule(self.input, 9):\r
f7496d71 1295 return\r
f51461c8
LG
1296\r
1297 # C.g:206:2: ( 'void' | 'char' | 'short' | 'int' | 'long' | 'float' | 'double' | 'signed' | 'unsigned' | s= struct_or_union_specifier | e= enum_specifier | ( IDENTIFIER ( type_qualifier )* declarator )=> type_id )\r
1298 alt13 = 12\r
1299 LA13_0 = self.input.LA(1)\r
1300\r
1301 if (LA13_0 == 34) :\r
1302 alt13 = 1\r
1303 elif (LA13_0 == 35) :\r
1304 alt13 = 2\r
1305 elif (LA13_0 == 36) :\r
1306 alt13 = 3\r
1307 elif (LA13_0 == 37) :\r
1308 alt13 = 4\r
1309 elif (LA13_0 == 38) :\r
1310 alt13 = 5\r
1311 elif (LA13_0 == 39) :\r
1312 alt13 = 6\r
1313 elif (LA13_0 == 40) :\r
1314 alt13 = 7\r
1315 elif (LA13_0 == 41) :\r
1316 alt13 = 8\r
1317 elif (LA13_0 == 42) :\r
1318 alt13 = 9\r
1319 elif ((45 <= LA13_0 <= 46)) :\r
1320 alt13 = 10\r
1321 elif (LA13_0 == 48) :\r
1322 alt13 = 11\r
1323 elif (LA13_0 == IDENTIFIER) and (self.synpred34()):\r
1324 alt13 = 12\r
1325 else:\r
1326 if self.backtracking > 0:\r
1327 self.failed = True\r
f7496d71 1328 return\r
f51461c8
LG
1329\r
1330 nvae = NoViableAltException("205:1: type_specifier : ( 'void' | 'char' | 'short' | 'int' | 'long' | 'float' | 'double' | 'signed' | 'unsigned' | s= struct_or_union_specifier | e= enum_specifier | ( IDENTIFIER ( type_qualifier )* declarator )=> type_id );", 13, 0, self.input)\r
1331\r
1332 raise nvae\r
1333\r
1334 if alt13 == 1:\r
1335 # C.g:206:4: 'void'\r
1336 self.match(self.input, 34, self.FOLLOW_34_in_type_specifier376)\r
1337 if self.failed:\r
f7496d71 1338 return\r
f51461c8
LG
1339\r
1340\r
1341 elif alt13 == 2:\r
1342 # C.g:207:4: 'char'\r
1343 self.match(self.input, 35, self.FOLLOW_35_in_type_specifier381)\r
1344 if self.failed:\r
f7496d71 1345 return\r
f51461c8
LG
1346\r
1347\r
1348 elif alt13 == 3:\r
1349 # C.g:208:4: 'short'\r
1350 self.match(self.input, 36, self.FOLLOW_36_in_type_specifier386)\r
1351 if self.failed:\r
f7496d71 1352 return\r
f51461c8
LG
1353\r
1354\r
1355 elif alt13 == 4:\r
1356 # C.g:209:4: 'int'\r
1357 self.match(self.input, 37, self.FOLLOW_37_in_type_specifier391)\r
1358 if self.failed:\r
f7496d71 1359 return\r
f51461c8
LG
1360\r
1361\r
1362 elif alt13 == 5:\r
1363 # C.g:210:4: 'long'\r
1364 self.match(self.input, 38, self.FOLLOW_38_in_type_specifier396)\r
1365 if self.failed:\r
f7496d71 1366 return\r
f51461c8
LG
1367\r
1368\r
1369 elif alt13 == 6:\r
1370 # C.g:211:4: 'float'\r
1371 self.match(self.input, 39, self.FOLLOW_39_in_type_specifier401)\r
1372 if self.failed:\r
f7496d71 1373 return\r
f51461c8
LG
1374\r
1375\r
1376 elif alt13 == 7:\r
1377 # C.g:212:4: 'double'\r
1378 self.match(self.input, 40, self.FOLLOW_40_in_type_specifier406)\r
1379 if self.failed:\r
f7496d71 1380 return\r
f51461c8
LG
1381\r
1382\r
1383 elif alt13 == 8:\r
1384 # C.g:213:4: 'signed'\r
1385 self.match(self.input, 41, self.FOLLOW_41_in_type_specifier411)\r
1386 if self.failed:\r
f7496d71 1387 return\r
f51461c8
LG
1388\r
1389\r
1390 elif alt13 == 9:\r
1391 # C.g:214:4: 'unsigned'\r
1392 self.match(self.input, 42, self.FOLLOW_42_in_type_specifier416)\r
1393 if self.failed:\r
f7496d71 1394 return\r
f51461c8
LG
1395\r
1396\r
1397 elif alt13 == 10:\r
1398 # C.g:215:4: s= struct_or_union_specifier\r
1399 self.following.append(self.FOLLOW_struct_or_union_specifier_in_type_specifier423)\r
1400 s = self.struct_or_union_specifier()\r
1401 self.following.pop()\r
1402 if self.failed:\r
f7496d71 1403 return\r
f51461c8 1404 if self.backtracking == 0:\r
f7496d71 1405\r
4231a819 1406 if s.stop is not None:\r
ccaa7754 1407 self.StoreStructUnionDefinition(s.start.line, s.start.charPositionInLine, s.stop.line, s.stop.charPositionInLine, self.input.toString(s.start, s.stop))\r
f7496d71 1408\r
f51461c8
LG
1409\r
1410\r
1411\r
1412 elif alt13 == 11:\r
1413 # C.g:220:4: e= enum_specifier\r
1414 self.following.append(self.FOLLOW_enum_specifier_in_type_specifier433)\r
1415 e = self.enum_specifier()\r
1416 self.following.pop()\r
1417 if self.failed:\r
f7496d71 1418 return\r
f51461c8 1419 if self.backtracking == 0:\r
f7496d71 1420\r
4231a819 1421 if e.stop is not None:\r
ccaa7754 1422 self.StoreEnumerationDefinition(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start, e.stop))\r
f7496d71 1423\r
f51461c8
LG
1424\r
1425\r
1426\r
1427 elif alt13 == 12:\r
1428 # C.g:225:4: ( IDENTIFIER ( type_qualifier )* declarator )=> type_id\r
1429 self.following.append(self.FOLLOW_type_id_in_type_specifier451)\r
1430 self.type_id()\r
1431 self.following.pop()\r
1432 if self.failed:\r
f7496d71 1433 return\r
f51461c8
LG
1434\r
1435\r
1436\r
5b0671c1 1437 except RecognitionException as re:\r
f51461c8
LG
1438 self.reportError(re)\r
1439 self.recover(self.input, re)\r
1440 finally:\r
1441 if self.backtracking > 0:\r
1442 self.memoize(self.input, 9, type_specifier_StartIndex)\r
1443\r
1444 pass\r
1445\r
f7496d71 1446 return\r
f51461c8
LG
1447\r
1448 # $ANTLR end type_specifier\r
1449\r
1450\r
1451 # $ANTLR start type_id\r
1452 # C.g:228:1: type_id : IDENTIFIER ;\r
1453 def type_id(self, ):\r
1454\r
1455 type_id_StartIndex = self.input.index()\r
1456 try:\r
1457 try:\r
1458 if self.backtracking > 0 and self.alreadyParsedRule(self.input, 10):\r
f7496d71 1459 return\r
f51461c8
LG
1460\r
1461 # C.g:229:5: ( IDENTIFIER )\r
1462 # C.g:229:9: IDENTIFIER\r
1463 self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_type_id467)\r
1464 if self.failed:\r
f7496d71 1465 return\r
f51461c8
LG
1466\r
1467\r
1468\r
1469\r
5b0671c1 1470 except RecognitionException as re:\r
f51461c8
LG
1471 self.reportError(re)\r
1472 self.recover(self.input, re)\r
1473 finally:\r
1474 if self.backtracking > 0:\r
1475 self.memoize(self.input, 10, type_id_StartIndex)\r
1476\r
1477 pass\r
1478\r
f7496d71 1479 return\r
f51461c8
LG
1480\r
1481 # $ANTLR end type_id\r
1482\r
1483 class struct_or_union_specifier_return(object):\r
1484 def __init__(self):\r
1485 self.start = None\r
1486 self.stop = None\r
1487\r
1488\r
1489\r
1490 # $ANTLR start struct_or_union_specifier\r
1491 # C.g:233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER );\r
1492 def struct_or_union_specifier(self, ):\r
1493\r
1494 retval = self.struct_or_union_specifier_return()\r
1495 retval.start = self.input.LT(1)\r
1496 struct_or_union_specifier_StartIndex = self.input.index()\r
1497 try:\r
1498 try:\r
1499 if self.backtracking > 0 and self.alreadyParsedRule(self.input, 11):\r
1500 return retval\r
1501\r
1502 # C.g:235:2: ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER )\r
1503 alt15 = 2\r
1504 LA15_0 = self.input.LA(1)\r
1505\r
1506 if ((45 <= LA15_0 <= 46)) :\r
1507 LA15_1 = self.input.LA(2)\r
1508\r
1509 if (LA15_1 == IDENTIFIER) :\r
1510 LA15_2 = self.input.LA(3)\r
1511\r
1512 if (LA15_2 == 43) :\r
1513 alt15 = 1\r
1514 elif (LA15_2 == EOF or LA15_2 == IDENTIFIER or LA15_2 == 25 or LA15_2 == 27 or (29 <= LA15_2 <= 42) or (45 <= LA15_2 <= 64) or LA15_2 == 66) :\r
1515 alt15 = 2\r
1516 else:\r
1517 if self.backtracking > 0:\r
1518 self.failed = True\r
1519 return retval\r
1520\r
1521 nvae = NoViableAltException("233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER );", 15, 2, self.input)\r
1522\r
1523 raise nvae\r
1524\r
1525 elif (LA15_1 == 43) :\r
1526 alt15 = 1\r
1527 else:\r
1528 if self.backtracking > 0:\r
1529 self.failed = True\r
1530 return retval\r
1531\r
1532 nvae = NoViableAltException("233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER );", 15, 1, self.input)\r
1533\r
1534 raise nvae\r
1535\r
1536 else:\r
1537 if self.backtracking > 0:\r
1538 self.failed = True\r
1539 return retval\r
1540\r
1541 nvae = NoViableAltException("233:1: struct_or_union_specifier options {k=3; } : ( struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}' | struct_or_union IDENTIFIER );", 15, 0, self.input)\r
1542\r
1543 raise nvae\r
1544\r
1545 if alt15 == 1:\r
1546 # C.g:235:4: struct_or_union ( IDENTIFIER )? '{' struct_declaration_list '}'\r
1547 self.following.append(self.FOLLOW_struct_or_union_in_struct_or_union_specifier494)\r
1548 self.struct_or_union()\r
1549 self.following.pop()\r
1550 if self.failed:\r
1551 return retval\r
1552 # C.g:235:20: ( IDENTIFIER )?\r
1553 alt14 = 2\r
1554 LA14_0 = self.input.LA(1)\r
1555\r
1556 if (LA14_0 == IDENTIFIER) :\r
1557 alt14 = 1\r
1558 if alt14 == 1:\r
1559 # C.g:0:0: IDENTIFIER\r
1560 self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_struct_or_union_specifier496)\r
1561 if self.failed:\r
1562 return retval\r
1563\r
1564\r
1565\r
1566 self.match(self.input, 43, self.FOLLOW_43_in_struct_or_union_specifier499)\r
1567 if self.failed:\r
1568 return retval\r
1569 self.following.append(self.FOLLOW_struct_declaration_list_in_struct_or_union_specifier501)\r
1570 self.struct_declaration_list()\r
1571 self.following.pop()\r
1572 if self.failed:\r
1573 return retval\r
1574 self.match(self.input, 44, self.FOLLOW_44_in_struct_or_union_specifier503)\r
1575 if self.failed:\r
1576 return retval\r
1577\r
1578\r
1579 elif alt15 == 2:\r
1580 # C.g:236:4: struct_or_union IDENTIFIER\r
1581 self.following.append(self.FOLLOW_struct_or_union_in_struct_or_union_specifier508)\r
1582 self.struct_or_union()\r
1583 self.following.pop()\r
1584 if self.failed:\r
1585 return retval\r
1586 self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_struct_or_union_specifier510)\r
1587 if self.failed:\r
1588 return retval\r
1589\r
1590\r
1591 retval.stop = self.input.LT(-1)\r
1592\r
1593\r
5b0671c1 1594 except RecognitionException as re:\r
f51461c8
LG
1595 self.reportError(re)\r
1596 self.recover(self.input, re)\r
1597 finally:\r
1598 if self.backtracking > 0:\r
1599 self.memoize(self.input, 11, struct_or_union_specifier_StartIndex)\r
1600\r
1601 pass\r
1602\r
1603 return retval\r
1604\r
1605 # $ANTLR end struct_or_union_specifier\r
1606\r
1607\r
1608 # $ANTLR start struct_or_union\r
1609 # C.g:239:1: struct_or_union : ( 'struct' | 'union' );\r
1610 def struct_or_union(self, ):\r
1611\r
1612 struct_or_union_StartIndex = self.input.index()\r
1613 try:\r
1614 try:\r
1615 if self.backtracking > 0 and self.alreadyParsedRule(self.input, 12):\r
f7496d71 1616 return\r
f51461c8
LG
1617\r
1618 # C.g:240:2: ( 'struct' | 'union' )\r
1619 # C.g:\r
1620 if (45 <= self.input.LA(1) <= 46):\r
1621 self.input.consume();\r
1622 self.errorRecovery = False\r
1623 self.failed = False\r
1624\r
1625 else:\r
1626 if self.backtracking > 0:\r
1627 self.failed = True\r
f7496d71 1628 return\r
f51461c8
LG
1629\r
1630 mse = MismatchedSetException(None, self.input)\r
1631 self.recoverFromMismatchedSet(\r
1632 self.input, mse, self.FOLLOW_set_in_struct_or_union0\r
1633 )\r
1634 raise mse\r
1635\r
1636\r
1637\r
1638\r
1639\r
1640\r
5b0671c1 1641 except RecognitionException as re:\r
f51461c8
LG
1642 self.reportError(re)\r
1643 self.recover(self.input, re)\r
1644 finally:\r
1645 if self.backtracking > 0:\r
1646 self.memoize(self.input, 12, struct_or_union_StartIndex)\r
1647\r
1648 pass\r
1649\r
f7496d71 1650 return\r
f51461c8
LG
1651\r
1652 # $ANTLR end struct_or_union\r
1653\r
1654\r
1655 # $ANTLR start struct_declaration_list\r
1656 # C.g:244:1: struct_declaration_list : ( struct_declaration )+ ;\r
1657 def struct_declaration_list(self, ):\r
1658\r
1659 struct_declaration_list_StartIndex = self.input.index()\r
1660 try:\r
1661 try:\r
1662 if self.backtracking > 0 and self.alreadyParsedRule(self.input, 13):\r
f7496d71 1663 return\r
f51461c8
LG
1664\r
1665 # C.g:245:2: ( ( struct_declaration )+ )\r
1666 # C.g:245:4: ( struct_declaration )+\r
1667 # C.g:245:4: ( struct_declaration )+\r
1668 cnt16 = 0\r
1669 while True: #loop16\r
1670 alt16 = 2\r
1671 LA16_0 = self.input.LA(1)\r
1672\r
1673 if (LA16_0 == IDENTIFIER or (34 <= LA16_0 <= 42) or (45 <= LA16_0 <= 46) or (48 <= LA16_0 <= 61)) :\r
1674 alt16 = 1\r
1675\r
1676\r
1677 if alt16 == 1:\r
1678 # C.g:0:0: struct_declaration\r
1679 self.following.append(self.FOLLOW_struct_declaration_in_struct_declaration_list537)\r
1680 self.struct_declaration()\r
1681 self.following.pop()\r
1682 if self.failed:\r
f7496d71 1683 return\r
f51461c8
LG
1684\r
1685\r
1686 else:\r
1687 if cnt16 >= 1:\r
1688 break #loop16\r
1689\r
1690 if self.backtracking > 0:\r
1691 self.failed = True\r
f7496d71 1692 return\r
f51461c8
LG
1693\r
1694 eee = EarlyExitException(16, self.input)\r
1695 raise eee\r
1696\r
1697 cnt16 += 1\r
1698\r
1699\r
1700\r
1701\r
1702\r
1703\r
5b0671c1 1704 except RecognitionException as re:\r
f51461c8
LG
1705 self.reportError(re)\r
1706 self.recover(self.input, re)\r
1707 finally:\r
1708 if self.backtracking > 0:\r
1709 self.memoize(self.input, 13, struct_declaration_list_StartIndex)\r
1710\r
1711 pass\r
1712\r
f7496d71 1713 return\r
f51461c8
LG
1714\r
1715 # $ANTLR end struct_declaration_list\r
1716\r
1717\r
1718 # $ANTLR start struct_declaration\r
1719 # C.g:248:1: struct_declaration : specifier_qualifier_list struct_declarator_list ';' ;\r
1720 def struct_declaration(self, ):\r
1721\r
1722 struct_declaration_StartIndex = self.input.index()\r
1723 try:\r
1724 try:\r
1725 if self.backtracking > 0 and self.alreadyParsedRule(self.input, 14):\r
f7496d71 1726 return\r
f51461c8
LG
1727\r
1728 # C.g:249:2: ( specifier_qualifier_list struct_declarator_list ';' )\r
1729 # C.g:249:4: specifier_qualifier_list struct_declarator_list ';'\r
1730 self.following.append(self.FOLLOW_specifier_qualifier_list_in_struct_declaration549)\r
1731 self.specifier_qualifier_list()\r
1732 self.following.pop()\r
1733 if self.failed:\r
f7496d71 1734 return\r
f51461c8
LG
1735 self.following.append(self.FOLLOW_struct_declarator_list_in_struct_declaration551)\r
1736 self.struct_declarator_list()\r
1737 self.following.pop()\r
1738 if self.failed:\r
f7496d71 1739 return\r
f51461c8
LG
1740 self.match(self.input, 25, self.FOLLOW_25_in_struct_declaration553)\r
1741 if self.failed:\r
f7496d71 1742 return\r
f51461c8
LG
1743\r
1744\r
1745\r
1746\r
5b0671c1 1747 except RecognitionException as re:\r
f51461c8
LG
1748 self.reportError(re)\r
1749 self.recover(self.input, re)\r
1750 finally:\r
1751 if self.backtracking > 0:\r
1752 self.memoize(self.input, 14, struct_declaration_StartIndex)\r
1753\r
1754 pass\r
1755\r
f7496d71 1756 return\r
f51461c8
LG
1757\r
1758 # $ANTLR end struct_declaration\r
1759\r
1760\r
1761 # $ANTLR start specifier_qualifier_list\r
1762 # C.g:252:1: specifier_qualifier_list : ( type_qualifier | type_specifier )+ ;\r
1763 def specifier_qualifier_list(self, ):\r
1764\r
1765 specifier_qualifier_list_StartIndex = self.input.index()\r
1766 try:\r
1767 try:\r
1768 if self.backtracking > 0 and self.alreadyParsedRule(self.input, 15):\r
f7496d71 1769 return\r
f51461c8
LG
1770\r
1771 # C.g:253:2: ( ( type_qualifier | type_specifier )+ )\r
1772 # C.g:253:4: ( type_qualifier | type_specifier )+\r
1773 # C.g:253:4: ( type_qualifier | type_specifier )+\r
1774 cnt17 = 0\r
1775 while True: #loop17\r
1776 alt17 = 3\r
1777 LA17 = self.input.LA(1)\r
1778 if LA17 == 58:\r
1779 LA17_2 = self.input.LA(2)\r
1780\r
1781 if (self.synpred39()) :\r
1782 alt17 = 1\r
1783\r
1784\r
1785 elif LA17 == 59:\r
1786 LA17_3 = self.input.LA(2)\r
1787\r
1788 if (self.synpred39()) :\r
1789 alt17 = 1\r
1790\r
1791\r
1792 elif LA17 == 60:\r
1793 LA17_4 = self.input.LA(2)\r
1794\r
1795 if (self.synpred39()) :\r
1796 alt17 = 1\r
1797\r
1798\r
1799 elif LA17 == IDENTIFIER:\r
1800 LA17 = self.input.LA(2)\r
1801 if LA17 == EOF or LA17 == IDENTIFIER or LA17 == 34 or LA17 == 35 or LA17 == 36 or LA17 == 37 or LA17 == 38 or LA17 == 39 or LA17 == 40 or LA17 == 41 or LA17 == 42 or LA17 == 45 or LA17 == 46 or LA17 == 48 or LA17 == 49 or LA17 == 50 or LA17 == 51 or LA17 == 52 or LA17 == 53 or LA17 == 54 or LA17 == 55 or LA17 == 56 or LA17 == 57 or LA17 == 58 or LA17 == 59 or LA17 == 60 or LA17 == 61 or LA17 == 63 or LA17 == 66:\r
1802 alt17 = 2\r
1803 elif LA17 == 62:\r
1804 LA17_94 = self.input.LA(3)\r
1805\r
1806 if (self.synpred40()) :\r
1807 alt17 = 2\r
1808\r
1809\r
1810 elif LA17 == 47:\r
1811 LA17_95 = self.input.LA(3)\r
1812\r
1813 if (self.synpred40()) :\r
1814 alt17 = 2\r
1815\r
1816\r
1817 elif LA17 == 64:\r
1818 LA17_96 = self.input.LA(3)\r
1819\r
1820 if (self.synpred40()) :\r
1821 alt17 = 2\r
1822\r
1823\r
1824\r
1825 elif LA17 == 49 or LA17 == 50 or LA17 == 51 or LA17 == 52 or LA17 == 53 or LA17 == 54 or LA17 == 55 or LA17 == 56 or LA17 == 57 or LA17 == 61:\r
1826 alt17 = 1\r
1827 elif LA17 == 34 or LA17 == 35 or LA17 == 36 or LA17 == 37 or LA17 == 38 or LA17 == 39 or LA17 == 40 or LA17 == 41 or LA17 == 42 or LA17 == 45 or LA17 == 46 or LA17 == 48:\r
1828 alt17 = 2\r
1829\r
1830 if alt17 == 1:\r
1831 # C.g:253:6: type_qualifier\r
1832 self.following.append(self.FOLLOW_type_qualifier_in_specifier_qualifier_list566)\r
1833 self.type_qualifier()\r
1834 self.following.pop()\r
1835 if self.failed:\r
f7496d71 1836 return\r
f51461c8
LG
1837\r
1838\r
1839 elif alt17 == 2:\r
1840 # C.g:253:23: type_specifier\r
1841 self.following.append(self.FOLLOW_type_specifier_in_specifier_qualifier_list570)\r
1842 self.type_specifier()\r
1843 self.following.pop()\r
1844 if self.failed:\r
f7496d71 1845 return\r
f51461c8
LG
1846\r
1847\r
1848 else:\r
1849 if cnt17 >= 1:\r
1850 break #loop17\r
1851\r
1852 if self.backtracking > 0:\r
1853 self.failed = True\r
f7496d71 1854 return\r
f51461c8
LG
1855\r
1856 eee = EarlyExitException(17, self.input)\r
1857 raise eee\r
1858\r
1859 cnt17 += 1\r
1860\r
1861\r
1862\r
1863\r
1864\r
1865\r
5b0671c1 1866 except RecognitionException as re:\r
f51461c8
LG
1867 self.reportError(re)\r
1868 self.recover(self.input, re)\r
1869 finally:\r
1870 if self.backtracking > 0:\r
1871 self.memoize(self.input, 15, specifier_qualifier_list_StartIndex)\r
1872\r
1873 pass\r
1874\r
f7496d71 1875 return\r
f51461c8
LG
1876\r
1877 # $ANTLR end specifier_qualifier_list\r
1878\r
1879\r
1880 # $ANTLR start struct_declarator_list\r
1881 # C.g:256:1: struct_declarator_list : struct_declarator ( ',' struct_declarator )* ;\r
1882 def struct_declarator_list(self, ):\r
1883\r
1884 struct_declarator_list_StartIndex = self.input.index()\r
1885 try:\r
1886 try:\r
1887 if self.backtracking > 0 and self.alreadyParsedRule(self.input, 16):\r
f7496d71 1888 return\r
f51461c8
LG
1889\r
1890 # C.g:257:2: ( struct_declarator ( ',' struct_declarator )* )\r
1891 # C.g:257:4: struct_declarator ( ',' struct_declarator )*\r
1892 self.following.append(self.FOLLOW_struct_declarator_in_struct_declarator_list584)\r
1893 self.struct_declarator()\r
1894 self.following.pop()\r
1895 if self.failed:\r
f7496d71 1896 return\r
f51461c8
LG
1897 # C.g:257:22: ( ',' struct_declarator )*\r
1898 while True: #loop18\r
1899 alt18 = 2\r
1900 LA18_0 = self.input.LA(1)\r
1901\r
1902 if (LA18_0 == 27) :\r
1903 alt18 = 1\r
1904\r
1905\r
1906 if alt18 == 1:\r
1907 # C.g:257:23: ',' struct_declarator\r
1908 self.match(self.input, 27, self.FOLLOW_27_in_struct_declarator_list587)\r
1909 if self.failed:\r
f7496d71 1910 return\r
f51461c8
LG
1911 self.following.append(self.FOLLOW_struct_declarator_in_struct_declarator_list589)\r
1912 self.struct_declarator()\r
1913 self.following.pop()\r
1914 if self.failed:\r
f7496d71 1915 return\r
f51461c8
LG
1916\r
1917\r
1918 else:\r
1919 break #loop18\r
1920\r
1921\r
1922\r
1923\r
1924\r
1925\r
5b0671c1 1926 except RecognitionException as re:\r
f51461c8
LG
1927 self.reportError(re)\r
1928 self.recover(self.input, re)\r
1929 finally:\r
1930 if self.backtracking > 0:\r
1931 self.memoize(self.input, 16, struct_declarator_list_StartIndex)\r
1932\r
1933 pass\r
1934\r
f7496d71 1935 return\r
f51461c8
LG
1936\r
1937 # $ANTLR end struct_declarator_list\r
1938\r
1939\r
1940 # $ANTLR start struct_declarator\r
1941 # C.g:260:1: struct_declarator : ( declarator ( ':' constant_expression )? | ':' constant_expression );\r
1942 def struct_declarator(self, ):\r
1943\r
1944 struct_declarator_StartIndex = self.input.index()\r
1945 try:\r
1946 try:\r
1947 if self.backtracking > 0 and self.alreadyParsedRule(self.input, 17):\r
f7496d71 1948 return\r
f51461c8
LG
1949\r
1950 # C.g:261:2: ( declarator ( ':' constant_expression )? | ':' constant_expression )\r
1951 alt20 = 2\r
1952 LA20_0 = self.input.LA(1)\r
1953\r
1954 if (LA20_0 == IDENTIFIER or (58 <= LA20_0 <= 60) or LA20_0 == 62 or LA20_0 == 66) :\r
1955 alt20 = 1\r
1956 elif (LA20_0 == 47) :\r
1957 alt20 = 2\r
1958 else:\r
1959 if self.backtracking > 0:\r
1960 self.failed = True\r
f7496d71 1961 return\r
f51461c8
LG
1962\r
1963 nvae = NoViableAltException("260:1: struct_declarator : ( declarator ( ':' constant_expression )? | ':' constant_expression );", 20, 0, self.input)\r
1964\r
1965 raise nvae\r
1966\r
1967 if alt20 == 1:\r
1968 # C.g:261:4: declarator ( ':' constant_expression )?\r
1969 self.following.append(self.FOLLOW_declarator_in_struct_declarator602)\r
1970 self.declarator()\r
1971 self.following.pop()\r
1972 if self.failed:\r
f7496d71 1973 return\r
f51461c8
LG
1974 # C.g:261:15: ( ':' constant_expression )?\r
1975 alt19 = 2\r
1976 LA19_0 = self.input.LA(1)\r
1977\r
1978 if (LA19_0 == 47) :\r
1979 alt19 = 1\r
1980 if alt19 == 1:\r
1981 # C.g:261:16: ':' constant_expression\r
1982 self.match(self.input, 47, self.FOLLOW_47_in_struct_declarator605)\r
1983 if self.failed:\r
f7496d71 1984 return\r
f51461c8
LG
1985 self.following.append(self.FOLLOW_constant_expression_in_struct_declarator607)\r
1986 self.constant_expression()\r
1987 self.following.pop()\r
1988 if self.failed:\r
f7496d71 1989 return\r
f51461c8
LG
1990\r
1991\r
1992\r
1993\r
1994\r
1995 elif alt20 == 2:\r
1996 # C.g:262:4: ':' constant_expression\r
1997 self.match(self.input, 47, self.FOLLOW_47_in_struct_declarator614)\r
1998 if self.failed:\r
f7496d71 1999 return\r
f51461c8
LG
2000 self.following.append(self.FOLLOW_constant_expression_in_struct_declarator616)\r
2001 self.constant_expression()\r
2002 self.following.pop()\r
2003 if self.failed:\r
f7496d71 2004 return\r
f51461c8
LG
2005\r
2006\r
2007\r
5b0671c1 2008 except RecognitionException as re:\r
f51461c8
LG
2009 self.reportError(re)\r
2010 self.recover(self.input, re)\r
2011 finally:\r
2012 if self.backtracking > 0:\r
2013 self.memoize(self.input, 17, struct_declarator_StartIndex)\r
2014\r
2015 pass\r
2016\r
f7496d71 2017 return\r
f51461c8
LG
2018\r
2019 # $ANTLR end struct_declarator\r
2020\r
2021 class enum_specifier_return(object):\r
2022 def __init__(self):\r
2023 self.start = None\r
2024 self.stop = None\r
2025\r
2026\r
2027\r
2028 # $ANTLR start enum_specifier\r
2029 # C.g:265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER );\r
2030 def enum_specifier(self, ):\r
2031\r
2032 retval = self.enum_specifier_return()\r
2033 retval.start = self.input.LT(1)\r
2034 enum_specifier_StartIndex = self.input.index()\r
2035 try:\r
2036 try:\r
2037 if self.backtracking > 0 and self.alreadyParsedRule(self.input, 18):\r
2038 return retval\r
2039\r
2040 # C.g:267:2: ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER )\r
2041 alt23 = 3\r
2042 LA23_0 = self.input.LA(1)\r
2043\r
2044 if (LA23_0 == 48) :\r
2045 LA23_1 = self.input.LA(2)\r
2046\r
2047 if (LA23_1 == IDENTIFIER) :\r
2048 LA23_2 = self.input.LA(3)\r
2049\r
2050 if (LA23_2 == 43) :\r
2051 alt23 = 2\r
2052 elif (LA23_2 == EOF or LA23_2 == IDENTIFIER or LA23_2 == 25 or LA23_2 == 27 or (29 <= LA23_2 <= 42) or (45 <= LA23_2 <= 64) or LA23_2 == 66) :\r
2053 alt23 = 3\r
2054 else:\r
2055 if self.backtracking > 0:\r
2056 self.failed = True\r
2057 return retval\r
2058\r
2059 nvae = NoViableAltException("265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER );", 23, 2, self.input)\r
2060\r
2061 raise nvae\r
2062\r
2063 elif (LA23_1 == 43) :\r
2064 alt23 = 1\r
2065 else:\r
2066 if self.backtracking > 0:\r
2067 self.failed = True\r
2068 return retval\r
2069\r
2070 nvae = NoViableAltException("265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER );", 23, 1, self.input)\r
2071\r
2072 raise nvae\r
2073\r
2074 else:\r
2075 if self.backtracking > 0:\r
2076 self.failed = True\r
2077 return retval\r
2078\r
2079 nvae = NoViableAltException("265:1: enum_specifier options {k=3; } : ( 'enum' '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}' | 'enum' IDENTIFIER );", 23, 0, self.input)\r
2080\r
2081 raise nvae\r
2082\r
2083 if alt23 == 1:\r
2084 # C.g:267:4: 'enum' '{' enumerator_list ( ',' )? '}'\r
2085 self.match(self.input, 48, self.FOLLOW_48_in_enum_specifier634)\r
2086 if self.failed:\r
2087 return retval\r
2088 self.match(self.input, 43, self.FOLLOW_43_in_enum_specifier636)\r
2089 if self.failed:\r
2090 return retval\r
2091 self.following.append(self.FOLLOW_enumerator_list_in_enum_specifier638)\r
2092 self.enumerator_list()\r
2093 self.following.pop()\r
2094 if self.failed:\r
2095 return retval\r
2096 # C.g:267:31: ( ',' )?\r
2097 alt21 = 2\r
2098 LA21_0 = self.input.LA(1)\r
2099\r
2100 if (LA21_0 == 27) :\r
2101 alt21 = 1\r
2102 if alt21 == 1:\r
2103 # C.g:0:0: ','\r
2104 self.match(self.input, 27, self.FOLLOW_27_in_enum_specifier640)\r
2105 if self.failed:\r
2106 return retval\r
2107\r
2108\r
2109\r
2110 self.match(self.input, 44, self.FOLLOW_44_in_enum_specifier643)\r
2111 if self.failed:\r
2112 return retval\r
2113\r
2114\r
2115 elif alt23 == 2:\r
2116 # C.g:268:4: 'enum' IDENTIFIER '{' enumerator_list ( ',' )? '}'\r
2117 self.match(self.input, 48, self.FOLLOW_48_in_enum_specifier648)\r
2118 if self.failed:\r
2119 return retval\r
2120 self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_enum_specifier650)\r
2121 if self.failed:\r
2122 return retval\r
2123 self.match(self.input, 43, self.FOLLOW_43_in_enum_specifier652)\r
2124 if self.failed:\r
2125 return retval\r
2126 self.following.append(self.FOLLOW_enumerator_list_in_enum_specifier654)\r
2127 self.enumerator_list()\r
2128 self.following.pop()\r
2129 if self.failed:\r
2130 return retval\r
2131 # C.g:268:42: ( ',' )?\r
2132 alt22 = 2\r
2133 LA22_0 = self.input.LA(1)\r
2134\r
2135 if (LA22_0 == 27) :\r
2136 alt22 = 1\r
2137 if alt22 == 1:\r
2138 # C.g:0:0: ','\r
2139 self.match(self.input, 27, self.FOLLOW_27_in_enum_specifier656)\r
2140 if self.failed:\r
2141 return retval\r
2142\r
2143\r
2144\r
2145 self.match(self.input, 44, self.FOLLOW_44_in_enum_specifier659)\r
2146 if self.failed:\r
2147 return retval\r
2148\r
2149\r
2150 elif alt23 == 3:\r
2151 # C.g:269:4: 'enum' IDENTIFIER\r
2152 self.match(self.input, 48, self.FOLLOW_48_in_enum_specifier664)\r
2153 if self.failed:\r
2154 return retval\r
2155 self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_enum_specifier666)\r
2156 if self.failed:\r
2157 return retval\r
2158\r
2159\r
2160 retval.stop = self.input.LT(-1)\r
2161\r
2162\r
5b0671c1 2163 except RecognitionException as re:\r
f51461c8
LG
2164 self.reportError(re)\r
2165 self.recover(self.input, re)\r
2166 finally:\r
2167 if self.backtracking > 0:\r
2168 self.memoize(self.input, 18, enum_specifier_StartIndex)\r
2169\r
2170 pass\r
2171\r
2172 return retval\r
2173\r
2174 # $ANTLR end enum_specifier\r
2175\r
2176\r
2177 # $ANTLR start enumerator_list\r
2178 # C.g:272:1: enumerator_list : enumerator ( ',' enumerator )* ;\r
2179 def enumerator_list(self, ):\r
2180\r
2181 enumerator_list_StartIndex = self.input.index()\r
2182 try:\r
2183 try:\r
2184 if self.backtracking > 0 and self.alreadyParsedRule(self.input, 19):\r
f7496d71 2185 return\r
f51461c8
LG
2186\r
2187 # C.g:273:2: ( enumerator ( ',' enumerator )* )\r
2188 # C.g:273:4: enumerator ( ',' enumerator )*\r
2189 self.following.append(self.FOLLOW_enumerator_in_enumerator_list677)\r
2190 self.enumerator()\r
2191 self.following.pop()\r
2192 if self.failed:\r
f7496d71 2193 return\r
f51461c8
LG
2194 # C.g:273:15: ( ',' enumerator )*\r
2195 while True: #loop24\r
2196 alt24 = 2\r
2197 LA24_0 = self.input.LA(1)\r
2198\r
2199 if (LA24_0 == 27) :\r
2200 LA24_1 = self.input.LA(2)\r
2201\r
2202 if (LA24_1 == IDENTIFIER) :\r
2203 alt24 = 1\r
2204\r
2205\r
2206\r
2207\r
2208 if alt24 == 1:\r
2209 # C.g:273:16: ',' enumerator\r
2210 self.match(self.input, 27, self.FOLLOW_27_in_enumerator_list680)\r
2211 if self.failed:\r
f7496d71 2212 return\r
f51461c8
LG
2213 self.following.append(self.FOLLOW_enumerator_in_enumerator_list682)\r
2214 self.enumerator()\r
2215 self.following.pop()\r
2216 if self.failed:\r
f7496d71 2217 return\r
f51461c8
LG
2218\r
2219\r
2220 else:\r
2221 break #loop24\r
2222\r
2223\r
2224\r
2225\r
2226\r
2227\r
5b0671c1 2228 except RecognitionException as re:\r
f51461c8
LG
2229 self.reportError(re)\r
2230 self.recover(self.input, re)\r
2231 finally:\r
2232 if self.backtracking > 0:\r
2233 self.memoize(self.input, 19, enumerator_list_StartIndex)\r
2234\r
2235 pass\r
2236\r
f7496d71 2237 return\r
f51461c8
LG
2238\r
2239 # $ANTLR end enumerator_list\r
2240\r
2241\r
2242 # $ANTLR start enumerator\r
2243 # C.g:276:1: enumerator : IDENTIFIER ( '=' constant_expression )? ;\r
2244 def enumerator(self, ):\r
2245\r
2246 enumerator_StartIndex = self.input.index()\r
2247 try:\r
2248 try:\r
2249 if self.backtracking > 0 and self.alreadyParsedRule(self.input, 20):\r
f7496d71 2250 return\r
f51461c8
LG
2251\r
2252 # C.g:277:2: ( IDENTIFIER ( '=' constant_expression )? )\r
2253 # C.g:277:4: IDENTIFIER ( '=' constant_expression )?\r
2254 self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_enumerator695)\r
2255 if self.failed:\r
f7496d71 2256 return\r
f51461c8
LG
2257 # C.g:277:15: ( '=' constant_expression )?\r
2258 alt25 = 2\r
2259 LA25_0 = self.input.LA(1)\r
2260\r
2261 if (LA25_0 == 28) :\r
2262 alt25 = 1\r
2263 if alt25 == 1:\r
2264 # C.g:277:16: '=' constant_expression\r
2265 self.match(self.input, 28, self.FOLLOW_28_in_enumerator698)\r
2266 if self.failed:\r
f7496d71 2267 return\r
f51461c8
LG
2268 self.following.append(self.FOLLOW_constant_expression_in_enumerator700)\r
2269 self.constant_expression()\r
2270 self.following.pop()\r
2271 if self.failed:\r
f7496d71 2272 return\r
f51461c8
LG
2273\r
2274\r
2275\r
2276\r
2277\r
2278\r
2279\r
5b0671c1 2280 except RecognitionException as re:\r
f51461c8
LG
2281 self.reportError(re)\r
2282 self.recover(self.input, re)\r
2283 finally:\r
2284 if self.backtracking > 0:\r
2285 self.memoize(self.input, 20, enumerator_StartIndex)\r
2286\r
2287 pass\r
2288\r
f7496d71 2289 return\r
f51461c8
LG
2290\r
2291 # $ANTLR end enumerator\r
2292\r
2293\r
2294 # $ANTLR start type_qualifier\r
2295 # C.g:280:1: type_qualifier : ( 'const' | 'volatile' | 'IN' | 'OUT' | 'OPTIONAL' | 'CONST' | 'UNALIGNED' | 'VOLATILE' | 'GLOBAL_REMOVE_IF_UNREFERENCED' | 'EFIAPI' | 'EFI_BOOTSERVICE' | 'EFI_RUNTIMESERVICE' | 'PACKED' );\r
2296 def type_qualifier(self, ):\r
2297\r
2298 type_qualifier_StartIndex = self.input.index()\r
2299 try:\r
2300 try:\r
2301 if self.backtracking > 0 and self.alreadyParsedRule(self.input, 21):\r
f7496d71 2302 return\r
f51461c8
LG
2303\r
2304 # C.g:281:2: ( 'const' | 'volatile' | 'IN' | 'OUT' | 'OPTIONAL' | 'CONST' | 'UNALIGNED' | 'VOLATILE' | 'GLOBAL_REMOVE_IF_UNREFERENCED' | 'EFIAPI' | 'EFI_BOOTSERVICE' | 'EFI_RUNTIMESERVICE' | 'PACKED' )\r
2305 # C.g:\r
2306 if (49 <= self.input.LA(1) <= 61):\r
2307 self.input.consume();\r
2308 self.errorRecovery = False\r
2309 self.failed = False\r
2310\r
2311 else:\r
2312 if self.backtracking > 0:\r
2313 self.failed = True\r
f7496d71 2314 return\r
f51461c8
LG
2315\r
2316 mse = MismatchedSetException(None, self.input)\r
2317 self.recoverFromMismatchedSet(\r
2318 self.input, mse, self.FOLLOW_set_in_type_qualifier0\r
2319 )\r
2320 raise mse\r
2321\r
2322\r
2323\r
2324\r
2325\r
2326\r
5b0671c1 2327 except RecognitionException as re:\r
f51461c8
LG
2328 self.reportError(re)\r
2329 self.recover(self.input, re)\r
2330 finally:\r
2331 if self.backtracking > 0:\r
2332 self.memoize(self.input, 21, type_qualifier_StartIndex)\r
2333\r
2334 pass\r
2335\r
f7496d71 2336 return\r
f51461c8
LG
2337\r
2338 # $ANTLR end type_qualifier\r
2339\r
2340 class declarator_return(object):\r
2341 def __init__(self):\r
2342 self.start = None\r
2343 self.stop = None\r
2344\r
2345\r
2346\r
2347 # $ANTLR start declarator\r
2348 # C.g:296:1: declarator : ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer );\r
2349 def declarator(self, ):\r
2350\r
2351 retval = self.declarator_return()\r
2352 retval.start = self.input.LT(1)\r
2353 declarator_StartIndex = self.input.index()\r
2354 try:\r
2355 try:\r
2356 if self.backtracking > 0 and self.alreadyParsedRule(self.input, 22):\r
2357 return retval\r
2358\r
2359 # C.g:297:2: ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer )\r
2360 alt30 = 2\r
2361 LA30_0 = self.input.LA(1)\r
2362\r
2363 if (LA30_0 == 66) :\r
2364 LA30_1 = self.input.LA(2)\r
2365\r
2366 if (self.synpred66()) :\r
2367 alt30 = 1\r
2368 elif (True) :\r
2369 alt30 = 2\r
2370 else:\r
2371 if self.backtracking > 0:\r
2372 self.failed = True\r
2373 return retval\r
2374\r
2375 nvae = NoViableAltException("296:1: declarator : ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer );", 30, 1, self.input)\r
2376\r
2377 raise nvae\r
2378\r
2379 elif (LA30_0 == IDENTIFIER or (58 <= LA30_0 <= 60) or LA30_0 == 62) :\r
2380 alt30 = 1\r
2381 else:\r
2382 if self.backtracking > 0:\r
2383 self.failed = True\r
2384 return retval\r
2385\r
2386 nvae = NoViableAltException("296:1: declarator : ( ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator | pointer );", 30, 0, self.input)\r
2387\r
2388 raise nvae\r
2389\r
2390 if alt30 == 1:\r
2391 # C.g:297:4: ( pointer )? ( 'EFIAPI' )? ( 'EFI_BOOTSERVICE' )? ( 'EFI_RUNTIMESERVICE' )? direct_declarator\r
2392 # C.g:297:4: ( pointer )?\r
2393 alt26 = 2\r
2394 LA26_0 = self.input.LA(1)\r
2395\r
2396 if (LA26_0 == 66) :\r
2397 alt26 = 1\r
2398 if alt26 == 1:\r
2399 # C.g:0:0: pointer\r
2400 self.following.append(self.FOLLOW_pointer_in_declarator784)\r
2401 self.pointer()\r
2402 self.following.pop()\r
2403 if self.failed:\r
2404 return retval\r
2405\r
2406\r
2407\r
2408 # C.g:297:13: ( 'EFIAPI' )?\r
2409 alt27 = 2\r
2410 LA27_0 = self.input.LA(1)\r
2411\r
2412 if (LA27_0 == 58) :\r
2413 alt27 = 1\r
2414 if alt27 == 1:\r
2415 # C.g:297:14: 'EFIAPI'\r
2416 self.match(self.input, 58, self.FOLLOW_58_in_declarator788)\r
2417 if self.failed:\r
2418 return retval\r
2419\r
2420\r
2421\r
2422 # C.g:297:25: ( 'EFI_BOOTSERVICE' )?\r
2423 alt28 = 2\r
2424 LA28_0 = self.input.LA(1)\r
2425\r
2426 if (LA28_0 == 59) :\r
2427 alt28 = 1\r
2428 if alt28 == 1:\r
2429 # C.g:297:26: 'EFI_BOOTSERVICE'\r
2430 self.match(self.input, 59, self.FOLLOW_59_in_declarator793)\r
2431 if self.failed:\r
2432 return retval\r
2433\r
2434\r
2435\r
2436 # C.g:297:46: ( 'EFI_RUNTIMESERVICE' )?\r
2437 alt29 = 2\r
2438 LA29_0 = self.input.LA(1)\r
2439\r
2440 if (LA29_0 == 60) :\r
2441 alt29 = 1\r
2442 if alt29 == 1:\r
2443 # C.g:297:47: 'EFI_RUNTIMESERVICE'\r
2444 self.match(self.input, 60, self.FOLLOW_60_in_declarator798)\r
2445 if self.failed:\r
2446 return retval\r
2447\r
2448\r
2449\r
2450 self.following.append(self.FOLLOW_direct_declarator_in_declarator802)\r
2451 self.direct_declarator()\r
2452 self.following.pop()\r
2453 if self.failed:\r
2454 return retval\r
2455\r
2456\r
2457 elif alt30 == 2:\r
2458 # C.g:299:4: pointer\r
2459 self.following.append(self.FOLLOW_pointer_in_declarator808)\r
2460 self.pointer()\r
2461 self.following.pop()\r
2462 if self.failed:\r
2463 return retval\r
2464\r
2465\r
2466 retval.stop = self.input.LT(-1)\r
2467\r
2468\r
5b0671c1 2469 except RecognitionException as re:\r
f51461c8
LG
2470 self.reportError(re)\r
2471 self.recover(self.input, re)\r
2472 finally:\r
2473 if self.backtracking > 0:\r
2474 self.memoize(self.input, 22, declarator_StartIndex)\r
2475\r
2476 pass\r
2477\r
2478 return retval\r
2479\r
2480 # $ANTLR end declarator\r
2481\r
2482\r
2483 # $ANTLR start direct_declarator\r
2484 # C.g:302:1: direct_declarator : ( IDENTIFIER ( declarator_suffix )* | '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+ );\r
2485 def direct_declarator(self, ):\r
2486\r
2487 direct_declarator_StartIndex = self.input.index()\r
2488 try:\r
2489 try:\r
2490 if self.backtracking > 0 and self.alreadyParsedRule(self.input, 23):\r
f7496d71 2491 return\r
f51461c8
LG
2492\r
2493 # C.g:303:2: ( IDENTIFIER ( declarator_suffix )* | '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+ )\r
2494 alt34 = 2\r
2495 LA34_0 = self.input.LA(1)\r
2496\r
2497 if (LA34_0 == IDENTIFIER) :\r
2498 alt34 = 1\r
2499 elif (LA34_0 == 62) :\r
2500 alt34 = 2\r
2501 else:\r
2502 if self.backtracking > 0:\r
2503 self.failed = True\r
f7496d71 2504 return\r
f51461c8
LG
2505\r
2506 nvae = NoViableAltException("302:1: direct_declarator : ( IDENTIFIER ( declarator_suffix )* | '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+ );", 34, 0, self.input)\r
2507\r
2508 raise nvae\r
2509\r
2510 if alt34 == 1:\r
2511 # C.g:303:4: IDENTIFIER ( declarator_suffix )*\r
2512 self.match(self.input, IDENTIFIER, self.FOLLOW_IDENTIFIER_in_direct_declarator819)\r
2513 if self.failed:\r
f7496d71 2514 return\r
f51461c8
LG
2515 # C.g:303:15: ( declarator_suffix )*\r
2516 while True: #loop31\r
2517 alt31 = 2\r
2518 LA31_0 = self.input.LA(1)\r
2519\r
2520 if (LA31_0 == 62) :\r
2521 LA31 = self.input.LA(2)\r
2522 if LA31 == 63:\r
2523 LA31_30 = self.input.LA(3)\r
2524\r
2525 if (self.synpred67()) :\r
2526 alt31 = 1\r
2527\r
2528\r
2529 elif LA31 == 58:\r
2530 LA31_31 = self.input.LA(3)\r
2531\r
2532 if (self.synpred67()) :\r
2533 alt31 = 1\r
2534\r
2535\r
2536 elif LA31 == 66:\r
2537 LA31_32 = self.input.LA(3)\r
2538\r
2539 if (self.synpred67()) :\r
2540 alt31 = 1\r
2541\r
2542\r
2543 elif LA31 == 59:\r
2544 LA31_33 = self.input.LA(3)\r
2545\r
2546 if (self.synpred67()) :\r
2547 alt31 = 1\r
2548\r
2549\r
2550 elif LA31 == 60:\r
2551 LA31_34 = self.input.LA(3)\r
2552\r
2553 if (self.synpred67()) :\r
2554 alt31 = 1\r
2555\r
2556\r
2557 elif LA31 == IDENTIFIER:\r
2558 LA31_35 = self.input.LA(3)\r
2559\r
2560 if (self.synpred67()) :\r
2561 alt31 = 1\r
2562\r
2563\r
2564 elif LA31 == 29 or LA31 == 30 or LA31 == 31 or LA31 == 32 or LA31 == 33:\r
2565 LA31_37 = self.input.LA(3)\r
2566\r
2567 if (self.synpred67()) :\r
2568 alt31 = 1\r
2569\r
2570\r
2571 elif LA31 == 34:\r
2572 LA31_38 = self.input.LA(3)\r
2573\r
2574 if (self.synpred67()) :\r
2575 alt31 = 1\r
2576\r
2577\r
2578 elif LA31 == 35:\r
2579 LA31_39 = self.input.LA(3)\r
2580\r
2581 if (self.synpred67()) :\r
2582 alt31 = 1\r
2583\r
2584\r
2585 elif LA31 == 36:\r
2586 LA31_40 = self.input.LA(3)\r
2587\r
2588 if (self.synpred67()) :\r
2589 alt31 = 1\r
2590\r
2591\r
2592 elif LA31 == 37:\r
2593 LA31_41 = self.input.LA(3)\r
2594\r
2595 if (self.synpred67()) :\r
2596 alt31 = 1\r
2597\r
2598\r
2599 elif LA31 == 38:\r
2600 LA31_42 = self.input.LA(3)\r
2601\r
2602 if (self.synpred67()) :\r
2603 alt31 = 1\r
2604\r
2605\r
2606 elif LA31 == 39:\r
2607 LA31_43 = self.input.LA(3)\r
2608\r
2609 if (self.synpred67()) :\r
2610 alt31 = 1\r
2611\r
2612\r
2613 elif LA31 == 40:\r
2614 LA31_44 = self.input.LA(3)\r
2615\r
2616 if (self.synpred67()) :\r
2617 alt31 = 1\r
2618\r
2619\r
2620 elif LA31 == 41:\r
2621 LA31_45 = self.input.LA(3)\r
2622\r
2623 if (self.synpred67()) :\r
2624 alt31 = 1\r
2625\r
2626\r
2627 elif LA31 == 42:\r
2628 LA31_46 = self.input.LA(3)\r
2629\r
2630 if (self.synpred67()) :\r
2631 alt31 = 1\r
2632\r
2633\r
2634 elif LA31 == 45 or LA31 == 46:\r
2635 LA31_47 = self.input.LA(3)\r
2636\r
2637 if (self.synpred67()) :\r
2638 alt31 = 1\r
2639\r
2640\r
2641 elif LA31 == 48:\r
2642 LA31_48 = self.input.LA(3)\r
2643\r
2644 if (self.synpred67()) :\r
2645 alt31 = 1\r
2646\r
2647\r
2648 elif LA31 == 49 or LA31 == 50 or LA31 == 51 or LA31 == 52 or LA31 == 53 or LA31 == 54 or LA31 == 55 or LA31 == 56 or LA31 == 57 or LA31 == 61:\r
2649 LA31_49 = self.input.LA(3)\r
2650\r
2651 if (self.synpred67()) :\r
2652 alt31 = 1\r
2653\r
2654\r
2655\r
2656 elif (LA31_0 == 64) :\r
2657 LA31 = self.input.LA(2)\r
2658 if LA31 == 65:\r
2659 LA31_51 = self.input.LA(3)\r
2660\r
2661 if (self.synpred67()) :\r
2662 alt31 = 1\r
2663\r
2664\r
2665 elif LA31 == 62:\r
2666 LA31_52 = self.input.LA(3)\r
2667\r
2668 if (self.synpred67()) :\r
2669 alt31 = 1\r
2670\r
2671\r
2672 elif LA31 == IDENTIFIER:\r
2673 LA31_53 = self.input.LA(3)\r
2674\r
2675 if (self.synpred67()) :\r
2676 alt31 = 1\r
2677\r
2678\r
2679 elif LA31 == HEX_LITERAL:\r
2680 LA31_54 = self.input.LA(3)\r
2681\r
2682 if (self.synpred67()) :\r
2683 alt31 = 1\r
2684\r
2685\r
2686 elif LA31 == OCTAL_LITERAL:\r
2687 LA31_55 = self.input.LA(3)\r
2688\r
2689 if (self.synpred67()) :\r
2690 alt31 = 1\r
2691\r
2692\r
2693 elif LA31 == DECIMAL_LITERAL:\r
2694 LA31_56 = self.input.LA(3)\r
2695\r
2696 if (self.synpred67()) :\r
2697 alt31 = 1\r
2698\r
2699\r
2700 elif LA31 == CHARACTER_LITERAL:\r
2701 LA31_57 = self.input.LA(3)\r
2702\r
2703 if (self.synpred67()) :\r
2704 alt31 = 1\r
2705\r
2706\r
2707 elif LA31 == STRING_LITERAL:\r
2708 LA31_58 = self.input.LA(3)\r
2709\r
2710 if (self.synpred67()) :\r
2711 alt31 = 1\r
2712\r
2713\r
2714 elif LA31 == FLOATING_POINT_LITERAL:\r
2715 LA31_59 = self.input.LA(3)\r
2716\r
2717 if (self.synpred67()) :\r
2718 alt31 = 1\r
2719\r
2720\r
2721 elif LA31 == 72:\r
2722 LA31_60 = self.input.LA(3)\r
2723\r
2724 if (self.synpred67()) :\r
2725 alt31 = 1\r
2726\r
2727\r
2728 elif LA31 == 73:\r
2729 LA31_61 = self.input.LA(3)\r
2730\r
2731 if (self.synpred67()) :\r
2732 alt31 = 1\r
2733\r
2734\r
2735 elif LA31 == 66 or LA31 == 68 or LA31 == 69 or LA31 == 77 or LA31 == 78 or LA31 == 79:\r
2736 LA31_62 = self.input.LA(3)\r
2737\r
2738 if (self.synpred67()) :\r
2739 alt31 = 1\r
2740\r
2741\r
2742 elif LA31 == 74:\r
2743 LA31_63 = self.input.LA(3)\r
2744\r
2745 if (self.synpred67()) :\r
2746 alt31 = 1\r
2747\r
2748\r
2749\r
2750\r
2751\r
2752 if alt31 == 1:\r
2753 # C.g:0:0: declarator_suffix\r
2754 self.following.append(self.FOLLOW_declarator_suffix_in_direct_declarator821)\r
2755 self.declarator_suffix()\r
2756 self.following.pop()\r
2757 if self.failed:\r
f7496d71 2758 return\r
f51461c8
LG
2759\r
2760\r
2761 else:\r
2762 break #loop31\r
2763\r
2764\r
2765\r
2766\r
2767 elif alt34 == 2:\r
2768 # C.g:304:4: '(' ( 'EFIAPI' )? declarator ')' ( declarator_suffix )+\r
2769 self.match(self.input, 62, self.FOLLOW_62_in_direct_declarator827)\r
2770 if self.failed:\r
f7496d71 2771 return\r
f51461c8
LG
2772 # C.g:304:8: ( 'EFIAPI' )?\r
2773 alt32 = 2\r
2774 LA32_0 = self.input.LA(1)\r
2775\r
2776 if (LA32_0 == 58) :\r
2777 LA32_1 = self.input.LA(2)\r
2778\r
2779 if (self.synpred69()) :\r
2780 alt32 = 1\r
2781 if alt32 == 1:\r
2782 # C.g:304:9: 'EFIAPI'\r
2783 self.match(self.input, 58, self.FOLLOW_58_in_direct_declarator830)\r
2784 if self.failed:\r
f7496d71 2785 return\r
f51461c8
LG
2786\r
2787\r
2788\r
2789 self.following.append(self.FOLLOW_declarator_in_direct_declarator834)\r
2790 self.declarator()\r
2791 self.following.pop()\r
2792 if self.failed:\r
f7496d71 2793 return\r
f51461c8
LG
2794 self.match(self.input, 63, self.FOLLOW_63_in_direct_declarator836)\r
2795 if self.failed:\r
f7496d71 2796 return\r
f51461c8
LG
2797 # C.g:304:35: ( declarator_suffix )+\r
2798 cnt33 = 0\r
2799 while True: #loop33\r
2800 alt33 = 2\r
2801 LA33_0 = self.input.LA(1)\r
2802\r
2803 if (LA33_0 == 62) :\r
2804 LA33 = self.input.LA(2)\r
2805 if LA33 == 63:\r
2806 LA33_30 = self.input.LA(3)\r
2807\r
2808 if (self.synpred70()) :\r
2809 alt33 = 1\r
2810\r
2811\r
2812 elif LA33 == 58:\r
2813 LA33_31 = self.input.LA(3)\r
2814\r
2815 if (self.synpred70()) :\r
2816 alt33 = 1\r
2817\r
2818\r
2819 elif LA33 == 66:\r
2820 LA33_32 = self.input.LA(3)\r
2821\r
2822 if (self.synpred70()) :\r
2823 alt33 = 1\r
2824\r
2825\r
2826 elif LA33 == 59:\r
2827 LA33_33 = self.input.LA(3)\r
2828\r
2829 if (self.synpred70()) :\r
2830 alt33 = 1\r
2831\r
2832\r
2833 elif LA33 == 60:\r
2834 LA33_34 = self.input.LA(3)\r
2835\r
2836 if (self.synpred70()) :\r
2837 alt33 = 1\r
2838\r
2839\r
2840 elif LA33 == IDENTIFIER:\r
2841 LA33_35 = self.input.LA(3)\r
2842\r
2843 if (self.synpred70()) :\r
2844 alt33 = 1\r
2845\r
2846\r
2847 elif LA33 == 29 or LA33 == 30 or LA33 == 31 or LA33 == 32 or LA33 == 33:\r
2848 LA33_37 = self.input.LA(3)\r
2849\r
2850 if (self.synpred70()) :\r
2851 alt33 = 1\r
2852\r
2853\r
2854 elif LA33 == 34:\r
2855 LA33_38 = self.input.LA(3)\r
2856\r
2857 if (self.synpred70()) :\r
2858 alt33 = 1\r
2859\r
2860\r
2861 elif LA33 == 35:\r
2862 LA33_39 = self.input.LA(3)\r
2863\r
2864 if (self.synpred70()) :\r
2865 alt33 = 1\r
2866\r
2867\r
2868 elif LA33 == 36:\r
2869 LA33_40 = self.input.LA(3)\r
2870\r
2871 if (self.synpred70()) :\r
2872 alt33 = 1\r
2873\r
2874\r
2875 elif LA33 == 37:\r
2876 LA33_41 = self.input.LA(3)\r
2877\r
2878 if (self.synpred70()) :\r
2879 alt33 = 1\r
2880\r
2881\r
2882 elif LA33 == 38:\r
2883 LA33_42 = self.input.LA(3)\r
2884\r
2885 if (self.synpred70()) :\r
2886 alt33 = 1\r
2887\r
2888\r
2889 elif LA33 == 39:\r
2890 LA33_43 = self.input.LA(3)\r
2891\r
2892 if (self.synpred70()) :\r
2893 alt33 = 1\r
2894\r
2895\r
2896 elif LA33 == 40:\r
2897 LA33_44 = self.input.LA(3)\r
2898\r
2899 if (self.synpred70()) :\r
2900 alt33 = 1\r
2901\r
2902\r
2903 elif LA33 == 41:\r
2904 LA33_45 = self.input.LA(3)\r
2905\r
2906 if (self.synpred70()) :\r
2907 alt33 = 1\r
2908\r
2909\r
2910 elif LA33 == 42:\r
2911 LA33_46 = self.input.LA(3)\r
2912\r
2913 if (self.synpred70()) :\r
2914 alt33 = 1\r
2915\r
2916\r
2917 elif LA33 == 45 or LA33 == 46:\r
2918 LA33_47 = self.input.LA(3)\r
2919\r
2920 if (self.synpred70()) :\r
2921 alt33 = 1\r
2922\r
2923\r
2924 elif LA33 == 48:\r
2925 LA33_48 = self.input.LA(3)\r
2926\r
2927 if (self.synpred70()) :\r
2928 alt33 = 1\r
2929\r
2930\r
2931 elif LA33 == 49 or LA33 == 50 or LA33 == 51 or LA33 == 52 or LA33 == 53 or LA33 == 54 or LA33 == 55 or LA33 == 56 or LA33 == 57 or LA33 == 61:\r
2932 LA33_49 = self.input.LA(3)\r
2933\r
2934 if (self.synpred70()) :\r
2935 alt33 = 1\r
2936\r
2937\r
2938\r
2939 elif (LA33_0 == 64) :\r
2940 LA33 = self.input.LA(2)\r
2941 if LA33 == 65:\r
2942 LA33_51 = self.input.LA(3)\r
2943\r
2944 if (self.synpred70()) :\r
2945 alt33 = 1\r
2946\r
2947\r
2948 elif LA33 == 62:\r
2949 LA33_52 = self.input.LA(3)\r
2950\r
2951 if (self.synpred70()) :\r
2952 alt33 = 1\r
2953\r
2954\r
2955 elif LA33 == IDENTIFIER:\r
2956 LA33_53 = self.input.LA(3)\r
2957\r
2958 if (self.synpred70()) :\r
2959 alt33 = 1\r
2960\r
2961\r
2962 elif LA33 == HEX_LITERAL:\r
2963 LA33_54 = self.input.LA(3)\r
2964\r
2965 if (self.synpred70()) :\r
2966 alt33 = 1\r
2967\r
2968\r
2969 elif LA33 == OCTAL_LITERAL:\r
2970 LA33_55 = self.input.LA(3)\r
2971\r
2972 if (self.synpred70()) :\r
2973 alt33 = 1\r
2974\r
2975\r
2976 elif LA33 == DECIMAL_LITERAL:\r
2977 LA33_56 = self.input.LA(3)\r
2978\r
2979 if (self.synpred70()) :\r
2980 alt33 = 1\r
2981\r
2982\r
2983 elif LA33 == CHARACTER_LITERAL:\r
2984 LA33_57 = self.input.LA(3)\r
2985\r
2986 if (self.synpred70()) :\r
2987 alt33 = 1\r
2988\r
2989\r
2990 elif LA33 == STRING_LITERAL:\r
2991 LA33_58 = self.input.LA(3)\r
2992\r
2993 if (self.synpred70()) :\r
2994 alt33 = 1\r
2995\r
2996\r
2997 elif LA33 == FLOATING_POINT_LITERAL:\r
2998 LA33_59 = self.input.LA(3)\r
2999\r
3000 if (self.synpred70()) :\r
3001 alt33 = 1\r
3002\r
3003\r
3004 elif LA33 == 72:\r
3005 LA33_60 = self.input.LA(3)\r
3006\r
3007 if (self.synpred70()) :\r
3008 alt33 = 1\r
3009\r
3010\r
3011 elif LA33 == 73:\r
3012 LA33_61 = self.input.LA(3)\r
3013\r
3014 if (self.synpred70()) :\r
3015 alt33 = 1\r
3016\r
3017\r
3018 elif LA33 == 66 or LA33 == 68 or LA33 == 69 or LA33 == 77 or LA33 == 78 or LA33 == 79:\r
3019 LA33_62 = self.input.LA(3)\r
3020\r
3021 if (self.synpred70()) :\r
3022 alt33 = 1\r
3023\r
3024\r
3025 elif LA33 == 74:\r
3026 LA33_63 = self.input.LA(3)\r
3027\r
3028 if (self.synpred70()) :\r
3029 alt33 = 1\r
3030\r
3031\r
3032\r
3033\r
3034\r
3035 if alt33 == 1:\r
3036 # C.g:0:0: declarator_suffix\r
3037 self.following.append(self.FOLLOW_declarator_suffix_in_direct_declarator838)\r
3038 self.declarator_suffix()\r
3039 self.following.pop()\r
3040 if self.failed:\r
f7496d71 3041 return\r
f51461c8
LG
3042\r
3043\r
3044 else:\r
3045 if cnt33 >= 1:\r
3046 break #loop33\r
3047\r
3048 if self.backtracking > 0:\r
3049 self.failed = True\r
f7496d71 3050 return\r
f51461c8
LG
3051\r
3052 eee = EarlyExitException(33, self.input)\r
3053 raise eee\r
3054\r
3055 cnt33 += 1\r
3056\r
3057\r
3058\r
3059\r
3060\r
5b0671c1 3061 except RecognitionException as re:\r
f51461c8
LG
3062 self.reportError(re)\r
3063 self.recover(self.input, re)\r
3064 finally:\r
3065 if self.backtracking > 0:\r
3066 self.memoize(self.input, 23, direct_declarator_StartIndex)\r
3067\r
3068 pass\r
3069\r
f7496d71 3070 return\r
f51461c8
LG
3071\r
3072 # $ANTLR end direct_declarator\r
3073\r
3074\r
3075 # $ANTLR start declarator_suffix\r
3076 # C.g:307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );\r
3077 def declarator_suffix(self, ):\r
3078\r
3079 declarator_suffix_StartIndex = self.input.index()\r
3080 try:\r
3081 try:\r
3082 if self.backtracking > 0 and self.alreadyParsedRule(self.input, 24):\r
f7496d71 3083 return\r
f51461c8
LG
3084\r
3085 # C.g:308:2: ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' )\r
3086 alt35 = 5\r
3087 LA35_0 = self.input.LA(1)\r
3088\r
3089 if (LA35_0 == 64) :\r
3090 LA35_1 = self.input.LA(2)\r
3091\r
3092 if (LA35_1 == 65) :\r
3093 alt35 = 2\r
3094 elif ((IDENTIFIER <= LA35_1 <= FLOATING_POINT_LITERAL) or LA35_1 == 62 or LA35_1 == 66 or (68 <= LA35_1 <= 69) or (72 <= LA35_1 <= 74) or (77 <= LA35_1 <= 79)) :\r
3095 alt35 = 1\r
3096 else:\r
3097 if self.backtracking > 0:\r
3098 self.failed = True\r
f7496d71 3099 return\r
f51461c8
LG
3100\r
3101 nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 1, self.input)\r
3102\r
3103 raise nvae\r
3104\r
3105 elif (LA35_0 == 62) :\r
3106 LA35 = self.input.LA(2)\r
3107 if LA35 == 63:\r
3108 alt35 = 5\r
3109 elif LA35 == 29 or LA35 == 30 or LA35 == 31 or LA35 == 32 or LA35 == 33 or LA35 == 34 or LA35 == 35 or LA35 == 36 or LA35 == 37 or LA35 == 38 or LA35 == 39 or LA35 == 40 or LA35 == 41 or LA35 == 42 or LA35 == 45 or LA35 == 46 or LA35 == 48 or LA35 == 49 or LA35 == 50 or LA35 == 51 or LA35 == 52 or LA35 == 53 or LA35 == 54 or LA35 == 55 or LA35 == 56 or LA35 == 57 or LA35 == 58 or LA35 == 59 or LA35 == 60 or LA35 == 61 or LA35 == 66:\r
3110 alt35 = 3\r
3111 elif LA35 == IDENTIFIER:\r
3112 LA35_29 = self.input.LA(3)\r
3113\r
3114 if (self.synpred73()) :\r
3115 alt35 = 3\r
3116 elif (self.synpred74()) :\r
3117 alt35 = 4\r
3118 else:\r
3119 if self.backtracking > 0:\r
3120 self.failed = True\r
f7496d71 3121 return\r
f51461c8
LG
3122\r
3123 nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 29, self.input)\r
3124\r
3125 raise nvae\r
3126\r
3127 else:\r
3128 if self.backtracking > 0:\r
3129 self.failed = True\r
f7496d71 3130 return\r
f51461c8
LG
3131\r
3132 nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 2, self.input)\r
3133\r
3134 raise nvae\r
3135\r
3136 else:\r
3137 if self.backtracking > 0:\r
3138 self.failed = True\r
f7496d71 3139 return\r
f51461c8
LG
3140\r
3141 nvae = NoViableAltException("307:1: declarator_suffix : ( '[' constant_expression ']' | '[' ']' | '(' parameter_type_list ')' | '(' identifier_list ')' | '(' ')' );", 35, 0, self.input)\r
3142\r
3143 raise nvae\r
3144\r
3145 if alt35 == 1:\r
3146 # C.g:308:6: '[' constant_expression ']'\r
3147 self.match(self.input, 64, self.FOLLOW_64_in_declarator_suffix852)\r
3148 if self.failed:\r
f7496d71 3149 return\r
f51461c8
LG
3150 self.following.append(self.FOLLOW_constant_expression_in_declarator_suffix854)\r
3151 self.constant_expression()\r
3152 self.following.pop()\r
3153 if self.failed:\r
f7496d71 3154 return\r
f51461c8
LG
3155 self.match(self.input, 65, self.FOLLOW_65_in_declarator_suffix856)\r
3156 if self.failed:\r
f7496d71 3157 return\r
f51461c8
LG
3158\r
3159\r
3160 elif alt35 == 2:\r
3161 # C.g:309:9: '[' ']'\r
3162 self.match(self.input, 64, self.FOLLOW_64_in_declarator_suffix866)\r
3163 if self.failed:\r
f7496d71 3164 return\r
f51461c8
LG
3165 self.match(self.input, 65, self.FOLLOW_65_in_declarator_suffix868)\r
3166 if self.failed:\r
f7496d71 3167 return\r
f51461c8
LG
3168\r
3169\r
3170 elif alt35 == 3:\r
3171 # C.g:310:9: '(' parameter_type_list ')'\r
3172 self.match(self.input, 62, self.FOLLOW_62_in_declarator_suffix878)\r
3173 if self.failed:\r
f7496d71 3174 return\r
f51461c8
LG
3175 self.following.append(self.FOLLOW_parameter_type_list_in_declarator_suffix880)\r
3176 self.parameter_type_list()\r
3177 self.following.pop()\r
3178 if self.failed:\r
f7496d71 3179 return\r
f51461c8
LG
3180 self.match(self.input, 63, self.FOLLOW_63_in_declarator_suffix882)\r
3181 if self.failed:\r
f7496d71 3182 return\r
f51461c8
LG
3183\r
3184\r
3185 elif alt35 == 4:\r
3186 # C.g:311:9: '(' identifier_list ')'\r
3187 self.match(self.input, 62, self.FOLLOW_62_in_declarator_suffix892)\r
3188 if self.failed:\r
f7496d71 3189 return\r
f51461c8
LG
3190 self.following.append(self.FOLLOW_identifier_list_in_declarator_suffix894)\r
3191 self.identifier_list()\r
3192 self.following.pop()\r
3193 if self.failed:\r
f7496d71 3194 return\r
f51461c8
LG
3195 self.match(self.input, 63, self.FOLLOW_63_in_declarator_suffix896)\r
3196 if self.failed:\r
f7496d71 3197 return\r
f51461c8
LG
3198\r
3199\r
3200 elif alt35 == 5:\r
3201 # C.g:312:9: '(' ')'\r
3202 self.match(self.input, 62, self.FOLLOW_62_in_declarator_suffix906)\r
3203 if self.failed:\r
f7496d71 3204 return\r
f51461c8
LG
3205 self.match(self.input, 63, self.FOLLOW_63_in_declarator_suffix908)\r
3206 if self.failed:\r
f7496d71 3207 return\r
f51461c8
LG
3208\r
3209\r
3210\r
5b0671c1 3211 except RecognitionException as re:\r
f51461c8
LG
3212 self.reportError(re)\r
3213 self.recover(self.input, re)\r
3214 finally:\r
3215 if self.backtracking > 0:\r
3216 self.memoize(self.input, 24, declarator_suffix_StartIndex)\r
3217\r
3218 pass\r
3219\r