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