GlueGen v2.6.0-rc-20250712
GlueGen, Native Binding Generator for Java™ (public API).
HeaderParser.java
Go to the documentation of this file.
1// $ANTLR 2.7.7 (2006-11-01): "expandedHeaderParser.g" -> "HeaderParser.java"$
2
3 package com.jogamp.gluegen.cgram;
4
5 import java.io.*;
6 import java.util.*;
7
8 import antlr.CommonAST;
9 import com.jogamp.gluegen.ASTLocusTag;
10 import com.jogamp.gluegen.ConstantDefinition;
11 import com.jogamp.gluegen.ConstantDefinition.CNumber;
12 import com.jogamp.gluegen.GlueGenException;
13 import com.jogamp.gluegen.JavaConfiguration;
14 import com.jogamp.gluegen.cgram.types.*;
15 import com.jogamp.gluegen.cgram.types.EnumType;
16 import com.jogamp.gluegen.cgram.types.EnumType.Enumerator;
17
18import antlr.TreeParser;
19import antlr.Token;
20import antlr.collections.AST;
21import antlr.RecognitionException;
22import antlr.ANTLRException;
23import antlr.NoViableAltException;
24import antlr.MismatchedTokenException;
25import antlr.SemanticException;
26import antlr.collections.impl.BitSet;
27import antlr.ASTPair;
28import antlr.collections.impl.ASTArray;
29
30
31public class HeaderParser extends antlr.TreeParser implements HeaderParserTokenTypes
32 {
33
34 /** Name assigned to a anonymous EnumType (e.g., "enum { ... }"). */
35 public static final String ANONYMOUS_ENUM_NAME = "<anonymous>";
36
37 boolean debug = false;
38
39 public boolean getDebug() {
40 return debug;
41 }
42
43 public void setDebug(boolean debug) {
44 this.debug = debug;
45 }
46
47 /** Set the configuration for this
48 HeaderParser. Must be done before parsing. */
50 this.cfg = cfg;
51 }
52
53 /** Set the dictionary mapping typedef names to types for this
54 HeaderParser. Must be done before parsing. */
56 this.typedefDictionary = dict;
57 }
58
59 /** Returns the typedef dictionary this HeaderParser uses. */
61 return typedefDictionary;
62 }
63
64 /** Set the dictionary mapping struct names (i.e., the "foo" in
65 "struct foo { ... };") to types for this HeaderParser. Must be done
66 before parsing. */
68 this.structDictionary = dict;
69 }
70
71 /** Returns the struct name dictionary this HeaderParser uses. */
73 return structDictionary;
74 }
75
76 /** Get the canonicalization map, which is a regular HashMap
77 mapping Type to Type and which is used for looking up the unique
78 instances of e.g. pointer-to-structure types that have been typedefed
79 and therefore have names. */
80 public Map getCanonMap() {
81 return canonMap;
82 }
83
84 /** Pre-define the list of EnumTypes for this HeaderParser. Must be
85 done before parsing. */
86 public void setEnums(List<EnumType> enumTypes) {
87 // FIXME: Need to take the input set of EnumTypes, extract all
88 // the enumerates from each EnumType, and fill in the enumHash
89 // so that each enumerate maps to the enumType to which it
90 // belongs.
91 throw new RuntimeException("setEnums is Unimplemented!");
92 }
93
94 /** Returns the EnumTypes this HeaderParser processed. */
95 public List<EnumType> getEnums() {
96 return new ArrayList<EnumType>(enumHash.values());
97 }
98
99 /** Clears the list of functions this HeaderParser has parsed.
100 Useful when reusing the same HeaderParser for more than one
101 header file. */
102 public void clearParsedFunctions() {
103 functions.clear();
104 }
105
106 /** Returns the list of FunctionSymbols this HeaderParser has parsed. */
107 public List<FunctionSymbol> getParsedFunctions() {
108 return functions;
109 }
110
111 private CompoundType lookupInStructDictionary(String structName,
112 CompoundTypeKind kind,
113 int cvAttrs, final ASTLocusTag locusTag)
114 {
115 CompoundType t = (CompoundType) structDictionary.get(structName);
116 if (t == null) {
117 t = CompoundType.create(structName, null, kind, cvAttrs, locusTag);
118 structDictionary.put(structName, t);
119 debugPrintln("Adding compound mapping: [" + structName + "] -> "+getDebugTypeString(t)+" @ "+locusTag);
120 debugPrintln(t.getStructString());
121 }
122 return t;
123 }
124
125 private Type lookupInTypedefDictionary(final AST _t, String typeName) {
126 Type t = typedefDictionary.get(typeName);
127 if (t == null) {
128 throwGlueGenException(_t,
129 "Undefined reference to typedef name " + typeName);
130 }
131 return t;
132 }
133
134 static class ParameterDeclaration {
135 private String id;
136 private Type type;
137
138 ParameterDeclaration(String id, Type type) {
139 this.id = id;
140 this.type = type;
141 }
142 String id() { return id; }
143 Type type() { return type; }
144 void setType(final Type t) { type = t; }
145 public String toString() { return "ParamDecl["+id+": "+type.getDebugString()+"]"; }
146 }
147
148 // A box for a Type. Allows type to be passed down to be modified by recursive rules.
149 static class TypeBox {
150 private Type origType;
151 private Type type;
152 private boolean isTypedef;
153
154 TypeBox(Type type) {
155 this(type, false);
156 }
157
158 TypeBox(Type type, boolean isTypedef) {
159 this.origType = type;
160 this.isTypedef = isTypedef;
161 }
162
163 Type type() {
164 if (type == null) {
165 return origType;
166 }
167 return type;
168 }
169 void setType(Type type) {
170 this.type = type;
171 }
172 void reset() {
173 type = null;
174 }
175
176 boolean isTypedef() { return isTypedef; }
177
178 // for easier debugging
179 public String toString() {
180 String tStr = "Type=NULL_REF";
181 if (type == origType) {
182 tStr = "Type=ORIG_TYPE";
183 } else if (type != null) {
184 tStr = "Type: name=\"" + type.getCVAttributesString() + " " +
185 type.getName() + "\"; signature=\"" + type + "\"; class " +
186 type.getClass().getName();
187 }
188 String oStr = "OrigType=NULL_REF";
189 if (origType != null) {
190 oStr = "OrigType: name=\"" + origType.getCVAttributesString() + " " +
191 origType.getName() + "\"; signature=\"" + origType + "\"; class " +
192 origType.getClass().getName();
193 }
194 return "<["+tStr + "] [" + oStr + "] " + " isTypedef=" + isTypedef+">";
195 }
196 }
197
198 private String getDebugTypeString(Type t) {
199 if(debug) {
200 return getTypeString(t);
201 } else {
202 return null;
203 }
204 }
205 private String getTypeString(Type t) {
206 StringBuilder sb = new StringBuilder();
207 sb.append("[");
208 if(null!=t) {
209 sb.append(t.getDebugString());
210 sb.append(", opaque ").append(isOpaque(t)).append("]");
211 } else {
212 sb.append("nil]");
213 }
214 return sb.toString();
215 }
216 private boolean isOpaque(final Type type) {
217 return (cfg.typeInfo(type) != null);
218 }
219
220 private void debugPrintln(String msg) {
221 if(debug) {
222 System.err.println(msg);
223 }
224 }
225
226 private void debugPrint(String msg) {
227 if(debug) {
228 System.err.print(msg);
229 }
230 }
231
232 private JavaConfiguration cfg;
233 private TypeDictionary typedefDictionary;
234 private TypeDictionary structDictionary;
235 private List<FunctionSymbol> functions = new ArrayList<FunctionSymbol>();
236 // hash from name of an enumerated value to the EnumType to which it belongs
237 private HashMap<String, EnumType> enumHash = new HashMap<String, EnumType>();
238 private HashMap<String, EnumType> enumMap = new HashMap<String, EnumType>();
239
240 // Storage class specifiers
241 private static final int AUTO = 1 << 0;
242 private static final int REGISTER = 1 << 1;
243 private static final int TYPEDEF = 1 << 2;
244 // Function storage class specifiers
245 private static final int EXTERN = 1 << 3;
246 private static final int STATIC = 1 << 4;
247 private static final int INLINE = 1 << 5;
248 // Type qualifiers
249 private static final int CONST = 1 << 6;
250 private static final int VOLATILE = 1 << 7;
251 private static final int SIGNED = 1 << 8;
252 private static final int UNSIGNED = 1 << 9;
253
254 private boolean isFuncDeclaration; // Used to only process function typedefs
255 private String funcDeclName;
256 private List<ParameterDeclaration> funcDeclParams;
257 private ASTLocusTag funcLocusTag;
258
259 private void resetFuncDeclaration() {
260 isFuncDeclaration = false;
261 funcDeclName = null;
262 funcDeclParams = null;
263 funcLocusTag = null;
264 }
265 private void setFuncDeclaration(final String name, final List<ParameterDeclaration> p, final ASTLocusTag locusTag) {
266 isFuncDeclaration = true;
267 funcDeclName = name;
268 funcDeclParams = p;
269 funcLocusTag = locusTag;
270 }
271
272 private void processDeclaration(Type returnType) {
273 if (isFuncDeclaration) {
274 final FunctionSymbol sym = new FunctionSymbol(funcDeclName,
275 new FunctionType(null, null, returnType, 0, funcLocusTag),
276 funcLocusTag);
277 debugPrintln("Function ... "+sym.toString()+" @ "+funcLocusTag);
278 if (funcDeclParams != null) { // handle funcs w/ empty parameter lists (e.g., "foo()")
279 for (Iterator<ParameterDeclaration> iter = funcDeclParams.iterator(); iter.hasNext(); ) {
280 ParameterDeclaration pd = iter.next();
281 pd.setType(pd.type());
282 debugPrintln(" add "+pd.toString());
283 sym.addArgument(pd.type(), pd.id());
284 }
285 }
286 debugPrintln("Function Added "+sym.toString());
287 functions.add(sym);
288 resetFuncDeclaration();
289 }
290 }
291
292 private int attrs2CVAttrs(int attrs) {
293 int cvAttrs = 0;
294 if ((attrs & CONST) != 0) {
295 cvAttrs |= CVAttributes.CONST;
296 }
297 if ((attrs & VOLATILE) != 0) {
298 cvAttrs |= CVAttributes.VOLATILE;
299 }
300 return cvAttrs;
301 }
302
303 /** Helper routine which handles creating a pointer or array type
304 for [] expressions */
305 private void handleArrayExpr(TypeBox tb, AST t, ASTLocusTag locusTag) {
306 if (t != null) {
307 try {
308 final int len = parseIntConstExpr(t);
309 tb.setType(canonicalize(new ArrayType(tb.type(), SizeThunk.mul(SizeThunk.constant(len), tb.type().getSize()), len, 0, locusTag)));
310 return;
311 } catch (RecognitionException e) {
312 // Fall through
313 }
314 }
315 tb.setType(canonicalize(new PointerType(SizeThunk.POINTER,
316 tb.type(), 0, locusTag)));
317 }
318
319 private int parseIntConstExpr(AST t) throws RecognitionException {
320 return intConstExpr(t);
321 }
322
323 /** Utility function: creates a new EnumType with the given name, or
324 returns an existing one if it has already been created. */
325 private EnumType getEnumType(String enumTypeName, ASTLocusTag locusTag) {
326 EnumType enumType = null;
327 Iterator<EnumType> it = enumHash.values().iterator();
328 while (it.hasNext()) {
329 EnumType potentialMatch = it.next();
330 if (potentialMatch.getName().equals(enumTypeName)) {
331 enumType = potentialMatch;
332 break;
333 }
334 }
335
336 if (enumType == null) {
337 // This isn't quite correct. In theory the enum should expand to
338 // the size of the largest element, so if there were a long long
339 // entry the enum should expand to e.g. int64. However, using
340 // "long" here (which is what used to be the case) was
341 // definitely incorrect and caused problems.
342 enumType = new EnumType(enumTypeName, SizeThunk.INT32, locusTag);
343 }
344
345 return enumType;
346 }
347
348 // Map used to canonicalize types. For example, we may typedef
349 // struct foo { ... } *pfoo; subsequent references to struct foo* should
350 // point to the same PointerType object that had its name set to "pfoo".
351 // Opaque canonical types are excluded.
352 private Map<Type, Type> canonMap = new HashMap<Type, Type>();
353 private Type canonicalize(Type t) {
354 Type res = (Type) canonMap.get(t);
355 if (res != null) {
356 return res;
357 } else {
358 canonMap.put(t, t);
359 return t;
360 }
361 }
362
363 private void throwGlueGenException(final AST t, final String message) throws GlueGenException {
364 // dumpASTTree("XXX", t);
365 throw new GlueGenException(message, findASTLocusTag(t));
366 }
367 private void throwGlueGenException(final ASTLocusTag locusTag, final String message) throws GlueGenException {
368 // dumpASTTree("XXX", t);
369 throw new GlueGenException(message, locusTag);
370 }
371
372 /**
373 * Return ASTLocusTag in tree, or null if not found.
374 */
375 private ASTLocusTag findASTLocusTag(final AST astIn) {
376 AST ast = astIn;
377 while(null != ast) {
378 if( ast instanceof TNode ) {
379 final TNode tn = (TNode) ast;
380 final ASTLocusTag tag = tn.getASTLocusTag();
381 if( null != tag ) {
382 return tag;
383 }
384 }
385 ast = ast.getFirstChild();
386 }
387 return null;
388 }
389 private void dumpASTTree(final String pre, final AST t) {
390 int i=0;
391 AST it = t;
392 while( null != it ) {
393 it = dumpAST(pre+"."+i, it);
394 i++;
395 }
396 }
397 private AST dumpAST(final String pre, final AST ast) {
398 if( null == ast ) {
399 System.err.println(pre+".0: AST NULL");
400 return null;
401 } else {
402 System.err.println(pre+".0: AST Type: "+ast.getClass().getName());
403 System.err.println(pre+".1: line:col "+ast.getLine()+":"+ast.getColumn()+" -> "+ast.getText());
404 if( ast instanceof TNode ) {
405 final TNode tn = (TNode) ast;
406 final ASTLocusTag tag = tn.getASTLocusTag();
407 System.err.println(pre+".TN.1: "+tag);
408 final Hashtable<String, Object> attributes = tn.getAttributesTable();
409 System.err.println(pre+".TN.2: "+attributes);
410 }
411 return ast.getFirstChild();
412 }
413 }
414public HeaderParser() {
415 tokenNames = _tokenNames;
416}
417
418 public final String declarator(AST _t,
419 TypeBox tb
420 ) throws RecognitionException {
421 String s;
422
423 TNode declarator_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
424 TNode id = null;
425 TNode e = null;
426
427 resetFuncDeclaration();
428 s = null;
429 List<ParameterDeclaration> params = null;
430 String funcPointerName = null;
431 TypeBox dummyTypeBox = null;
432 final ASTLocusTag locusTag = findASTLocusTag(declarator_AST_in);
433
434
435 try { // for error handling
436 AST __t2 = _t;
437 TNode tmp1_AST_in = (TNode)_t;
438 match(_t,NDeclarator);
439 _t = _t.getFirstChild();
440 {
441 if (_t==null) _t=ASTNULL;
442 switch ( _t.getType()) {
443 case NPointerGroup:
444 {
445 pointerGroup(_t,tb);
446 _t = _retTree;
447 break;
448 }
449 case ID:
450 case LPAREN:
451 {
452 break;
453 }
454 default:
455 {
456 throw new NoViableAltException(_t);
457 }
458 }
459 }
460 {
461 if (_t==null) _t=ASTNULL;
462 switch ( _t.getType()) {
463 case ID:
464 {
465 id = (TNode)_t;
466 match(_t,ID);
467 _t = _t.getNextSibling();
468 if ( inputState.guessing==0 ) {
469 s = id.getText();
470 }
471 break;
472 }
473 case LPAREN:
474 {
475 TNode tmp2_AST_in = (TNode)_t;
476 match(_t,LPAREN);
477 _t = _t.getNextSibling();
478 funcPointerName=declarator(_t,dummyTypeBox);
479 _t = _retTree;
480 TNode tmp3_AST_in = (TNode)_t;
481 match(_t,RPAREN);
482 _t = _t.getNextSibling();
483 break;
484 }
485 default:
486 {
487 throw new NoViableAltException(_t);
488 }
489 }
490 }
491 {
492 _loop10:
493 do {
494 if (_t==null) _t=ASTNULL;
495 switch ( _t.getType()) {
497 {
498 AST __t6 = _t;
499 TNode tmp4_AST_in = (TNode)_t;
500 match(_t,NParameterTypeList);
501 _t = _t.getFirstChild();
502 {
503 if (_t==null) _t=ASTNULL;
504 switch ( _t.getType()) {
506 {
507 params=parameterTypeList(_t);
508 _t = _retTree;
509 break;
510 }
511 case ID:
512 case RPAREN:
513 {
514 {
515 if (_t==null) _t=ASTNULL;
516 switch ( _t.getType()) {
517 case ID:
518 {
519 idList(_t);
520 _t = _retTree;
521 break;
522 }
523 case RPAREN:
524 {
525 break;
526 }
527 default:
528 {
529 throw new NoViableAltException(_t);
530 }
531 }
532 }
533 break;
534 }
535 default:
536 {
537 throw new NoViableAltException(_t);
538 }
539 }
540 }
541 TNode tmp5_AST_in = (TNode)_t;
542 match(_t,RPAREN);
543 _t = _t.getNextSibling();
544 _t = __t6;
545 _t = _t.getNextSibling();
546 if ( inputState.guessing==0 ) {
547
548 if (id != null) {
549 setFuncDeclaration(id.getText(), params, locusTag);
550 } else if ( funcPointerName != null ) {
551 /* TypeBox becomes function pointer in this case */
552 final FunctionType ft = new FunctionType(null, null, tb.type(), 0, locusTag);
553 if (params == null) {
554 // If the function pointer has no declared parameters, it's a
555 // void function. I'm not sure if the parameter name is
556 // ever referenced anywhere when the type is VoidType, so
557 // just in case I'll set it to a comment string so it will
558 // still compile if written out to code anywhere.
559 ft.addArgument(new VoidType(0, locusTag), "/*unnamed-void*/");
560 } else {
561 for (Iterator iter = params.iterator(); iter.hasNext(); ) {
562 ParameterDeclaration pd = (ParameterDeclaration) iter.next();
563 ft.addArgument(pd.type(), pd.id());
564 }
565 }
566 tb.setType(canonicalize(new PointerType(SizeThunk.POINTER,
567 ft, 0, locusTag)));
568 s = funcPointerName;
569 }
570
571 }
572 break;
573 }
574 case LBRACKET:
575 {
576 TNode tmp6_AST_in = (TNode)_t;
577 match(_t,LBRACKET);
578 _t = _t.getNextSibling();
579 {
580 if (_t==null) _t=ASTNULL;
581 switch ( _t.getType()) {
582 case ID:
583 case ASSIGN:
584 case STAR:
585 case LPAREN:
586 case DIV_ASSIGN:
587 case PLUS_ASSIGN:
588 case MINUS_ASSIGN:
589 case STAR_ASSIGN:
590 case MOD_ASSIGN:
591 case RSHIFT_ASSIGN:
592 case LSHIFT_ASSIGN:
593 case BAND_ASSIGN:
594 case BOR_ASSIGN:
595 case BXOR_ASSIGN:
596 case QUESTION:
597 case LOR:
598 case LAND:
599 case BOR:
600 case BXOR:
601 case BAND:
602 case EQUAL:
603 case NOT_EQUAL:
604 case LT:
605 case LTE:
606 case GT:
607 case GTE:
608 case LSHIFT:
609 case RSHIFT:
610 case PLUS:
611 case MINUS:
612 case DIV:
613 case MOD:
614 case INC:
615 case DEC:
616 case LITERAL_sizeof:
617 case CharLiteral:
618 case NCast:
619 case NExpressionGroup:
620 case NInitializer:
621 case NEmptyExpression:
622 case NCommaExpr:
623 case NUnaryExpr:
624 case NPostfixExpr:
625 case NRangeExpr:
626 case NStringSeq:
628 case NGnuAsmExpr:
629 case Number:
631 {
632 e = _t==ASTNULL ? null : (TNode)_t;
633 expr(_t);
634 _t = _retTree;
635 break;
636 }
637 case RBRACKET:
638 {
639 break;
640 }
641 default:
642 {
643 throw new NoViableAltException(_t);
644 }
645 }
646 }
647 TNode tmp7_AST_in = (TNode)_t;
648 match(_t,RBRACKET);
649 _t = _t.getNextSibling();
650 if ( inputState.guessing==0 ) {
651 handleArrayExpr(tb, e, locusTag);
652 }
653 break;
654 }
655 default:
656 {
657 break _loop10;
658 }
659 }
660 } while (true);
661 }
662 _t = __t2;
663 _t = _t.getNextSibling();
664 }
665 catch (RecognitionException ex) {
666 if (inputState.guessing==0) {
667 reportError(ex);
668 if (_t!=null) {_t = _t.getNextSibling();}
669 } else {
670 throw ex;
671 }
672 }
673 _retTree = _t;
674 return s;
675 }
676
677 public final void pointerGroup(AST _t,
678 TypeBox tb
679 ) throws RecognitionException {
680
681 TNode pointerGroup_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
682 int x = 0; int y = 0;
683
684 try { // for error handling
685 AST __t93 = _t;
686 TNode tmp8_AST_in = (TNode)_t;
687 match(_t,NPointerGroup);
688 _t = _t.getFirstChild();
689 {
690 int _cnt97=0;
691 _loop97:
692 do {
693 if (_t==null) _t=ASTNULL;
694 if ((_t.getType()==STAR)) {
695 TNode tmp9_AST_in = (TNode)_t;
696 match(_t,STAR);
697 _t = _t.getNextSibling();
698 if ( inputState.guessing==0 ) {
699 x = 0; y = 0;
700 }
701 {
702 _loop96:
703 do {
704 if (_t==null) _t=ASTNULL;
705 if ((_tokenSet_0.member(_t.getType()))) {
706 y=typeQualifier(_t);
707 _t = _retTree;
708 if ( inputState.guessing==0 ) {
709 x |= y;
710 }
711 }
712 else {
713 break _loop96;
714 }
715
716 } while (true);
717 }
718 if ( inputState.guessing==0 ) {
719
720 debugPrintln("IN PTR GROUP: TB=" + tb);
721 if (tb != null) {
722 tb.setType(canonicalize(new PointerType(SizeThunk.POINTER,
723 tb.type(),
724 attrs2CVAttrs(x),
725 findASTLocusTag(pointerGroup_AST_in))));
726 }
727
728 }
729 }
730 else {
731 if ( _cnt97>=1 ) { break _loop97; } else {throw new NoViableAltException(_t);}
732 }
733
734 _cnt97++;
735 } while (true);
736 }
737 _t = __t93;
738 _t = _t.getNextSibling();
739 }
740 catch (RecognitionException ex) {
741 if (inputState.guessing==0) {
742 reportError(ex);
743 if (_t!=null) {_t = _t.getNextSibling();}
744 } else {
745 throw ex;
746 }
747 }
748 _retTree = _t;
749 }
750
751 public final List<ParameterDeclaration> parameterTypeList(AST _t) throws RecognitionException {
752 List<ParameterDeclaration> l;
753
754 TNode parameterTypeList_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
755 l = new ArrayList<ParameterDeclaration>(); ParameterDeclaration decl = null;
756
757 try { // for error handling
758 {
759 int _cnt21=0;
760 _loop21:
761 do {
762 if (_t==null) _t=ASTNULL;
763 if ((_t.getType()==NParameterDeclaration)) {
764 decl=parameterDeclaration(_t);
765 _t = _retTree;
766 if ( inputState.guessing==0 ) {
767 if (decl != null) { l.add(decl); }
768 }
769 {
770 if (_t==null) _t=ASTNULL;
771 switch ( _t.getType()) {
772 case COMMA:
773 {
774 TNode tmp10_AST_in = (TNode)_t;
775 match(_t,COMMA);
776 _t = _t.getNextSibling();
777 break;
778 }
779 case SEMI:
780 {
781 TNode tmp11_AST_in = (TNode)_t;
782 match(_t,SEMI);
783 _t = _t.getNextSibling();
784 break;
785 }
786 case RPAREN:
787 case VARARGS:
789 {
790 break;
791 }
792 default:
793 {
794 throw new NoViableAltException(_t);
795 }
796 }
797 }
798 }
799 else {
800 if ( _cnt21>=1 ) { break _loop21; } else {throw new NoViableAltException(_t);}
801 }
802
803 _cnt21++;
804 } while (true);
805 }
806 {
807 if (_t==null) _t=ASTNULL;
808 switch ( _t.getType()) {
809 case VARARGS:
810 {
811 TNode tmp12_AST_in = (TNode)_t;
812 match(_t,VARARGS);
813 _t = _t.getNextSibling();
814 break;
815 }
816 case RPAREN:
817 {
818 break;
819 }
820 default:
821 {
822 throw new NoViableAltException(_t);
823 }
824 }
825 }
826 }
827 catch (RecognitionException ex) {
828 if (inputState.guessing==0) {
829 reportError(ex);
830 if (_t!=null) {_t = _t.getNextSibling();}
831 } else {
832 throw ex;
833 }
834 }
835 _retTree = _t;
836 return l;
837 }
838
839 public final void idList(AST _t) throws RecognitionException {
840
841 TNode idList_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
842
843 try { // for error handling
844 TNode tmp13_AST_in = (TNode)_t;
845 match(_t,ID);
846 _t = _t.getNextSibling();
847 {
848 _loop137:
849 do {
850 if (_t==null) _t=ASTNULL;
851 if ((_t.getType()==COMMA)) {
852 TNode tmp14_AST_in = (TNode)_t;
853 match(_t,COMMA);
854 _t = _t.getNextSibling();
855 TNode tmp15_AST_in = (TNode)_t;
856 match(_t,ID);
857 _t = _t.getNextSibling();
858 }
859 else {
860 break _loop137;
861 }
862
863 } while (true);
864 }
865 }
866 catch (RecognitionException ex) {
867 if (inputState.guessing==0) {
868 reportError(ex);
869 if (_t!=null) {_t = _t.getNextSibling();}
870 } else {
871 throw ex;
872 }
873 }
874 _retTree = _t;
875 }
876
877 public final void expr(AST _t) throws RecognitionException {
878
879 TNode expr_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
880
881 try { // for error handling
882 if (_t==null) _t=ASTNULL;
883 switch ( _t.getType()) {
884 case ASSIGN:
885 case DIV_ASSIGN:
886 case PLUS_ASSIGN:
887 case MINUS_ASSIGN:
888 case STAR_ASSIGN:
889 case MOD_ASSIGN:
890 case RSHIFT_ASSIGN:
891 case LSHIFT_ASSIGN:
892 case BAND_ASSIGN:
893 case BOR_ASSIGN:
894 case BXOR_ASSIGN:
895 {
896 assignExpr(_t);
897 _t = _retTree;
898 break;
899 }
900 case QUESTION:
901 {
902 conditionalExpr(_t);
903 _t = _retTree;
904 break;
905 }
906 case LOR:
907 {
908 logicalOrExpr(_t);
909 _t = _retTree;
910 break;
911 }
912 case LAND:
913 {
914 logicalAndExpr(_t);
915 _t = _retTree;
916 break;
917 }
918 case BOR:
919 {
920 inclusiveOrExpr(_t);
921 _t = _retTree;
922 break;
923 }
924 case BXOR:
925 {
926 exclusiveOrExpr(_t);
927 _t = _retTree;
928 break;
929 }
930 case BAND:
931 {
932 bitAndExpr(_t);
933 _t = _retTree;
934 break;
935 }
936 case EQUAL:
937 case NOT_EQUAL:
938 {
939 equalityExpr(_t);
940 _t = _retTree;
941 break;
942 }
943 case LT:
944 case LTE:
945 case GT:
946 case GTE:
947 {
948 relationalExpr(_t);
949 _t = _retTree;
950 break;
951 }
952 case LSHIFT:
953 case RSHIFT:
954 {
955 shiftExpr(_t);
956 _t = _retTree;
957 break;
958 }
959 case PLUS:
960 case MINUS:
961 {
962 additiveExpr(_t);
963 _t = _retTree;
964 break;
965 }
966 case STAR:
967 case DIV:
968 case MOD:
969 {
970 multExpr(_t);
971 _t = _retTree;
972 break;
973 }
974 case NCast:
975 {
976 castExpr(_t);
977 _t = _retTree;
978 break;
979 }
980 case INC:
981 case DEC:
982 case LITERAL_sizeof:
983 case NUnaryExpr:
985 {
986 unaryExpr(_t);
987 _t = _retTree;
988 break;
989 }
990 case NPostfixExpr:
991 {
992 postfixExpr(_t);
993 _t = _retTree;
994 break;
995 }
996 case ID:
997 case CharLiteral:
998 case NExpressionGroup:
999 case NStringSeq:
1000 case Number:
1001 {
1002 primaryExpr(_t);
1003 _t = _retTree;
1004 break;
1005 }
1006 case NCommaExpr:
1007 {
1008 commaExpr(_t);
1009 _t = _retTree;
1010 break;
1011 }
1012 case NEmptyExpression:
1013 {
1014 emptyExpr(_t);
1015 _t = _retTree;
1016 break;
1017 }
1018 case LPAREN:
1019 {
1021 _t = _retTree;
1022 break;
1023 }
1024 case NInitializer:
1025 case NLcurlyInitializer:
1026 {
1027 initializer(_t);
1028 _t = _retTree;
1029 break;
1030 }
1031 case NRangeExpr:
1032 {
1033 rangeExpr(_t);
1034 _t = _retTree;
1035 break;
1036 }
1037 case NGnuAsmExpr:
1038 {
1039 gnuAsmExpr(_t);
1040 _t = _retTree;
1041 break;
1042 }
1043 default:
1044 {
1045 throw new NoViableAltException(_t);
1046 }
1047 }
1048 }
1049 catch (RecognitionException ex) {
1050 if (inputState.guessing==0) {
1051 reportError(ex);
1052 if (_t!=null) {_t = _t.getNextSibling();}
1053 } else {
1054 throw ex;
1055 }
1056 }
1057 _retTree = _t;
1058 }
1059
1060 public final void typelessDeclaration(AST _t) throws RecognitionException {
1061
1062 TNode typelessDeclaration_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
1063
1064 TypeBox tb = null;
1065
1066
1067 try { // for error handling
1068 AST __t12 = _t;
1069 TNode tmp16_AST_in = (TNode)_t;
1070 match(_t,NTypeMissing);
1071 _t = _t.getFirstChild();
1072 initDeclList(_t,tb);
1073 _t = _retTree;
1074 TNode tmp17_AST_in = (TNode)_t;
1075 match(_t,SEMI);
1076 _t = _t.getNextSibling();
1077 _t = __t12;
1078 _t = _t.getNextSibling();
1079 }
1080 catch (RecognitionException ex) {
1081 if (inputState.guessing==0) {
1082 reportError(ex);
1083 if (_t!=null) {_t = _t.getNextSibling();}
1084 } else {
1085 throw ex;
1086 }
1087 }
1088 _retTree = _t;
1089 }
1090
1091 public final void initDeclList(AST _t,
1092 TypeBox tb
1093 ) throws RecognitionException {
1094
1095 TNode initDeclList_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
1096
1097 try { // for error handling
1098 {
1099 int _cnt86=0;
1100 _loop86:
1101 do {
1102 if (_t==null) _t=ASTNULL;
1103 if ((_t.getType()==NInitDecl)) {
1104 initDecl(_t,tb);
1105 _t = _retTree;
1106 }
1107 else {
1108 if ( _cnt86>=1 ) { break _loop86; } else {throw new NoViableAltException(_t);}
1109 }
1110
1111 _cnt86++;
1112 } while (true);
1113 }
1114 }
1115 catch (RecognitionException ex) {
1116 if (inputState.guessing==0) {
1117 reportError(ex);
1118 if (_t!=null) {_t = _t.getNextSibling();}
1119 } else {
1120 throw ex;
1121 }
1122 }
1123 _retTree = _t;
1124 }
1125
1126 public final void declaration(AST _t) throws RecognitionException {
1127
1128 TNode declaration_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
1129
1130 TypeBox tb = null;
1131
1132
1133 try { // for error handling
1134 AST __t14 = _t;
1135 TNode tmp18_AST_in = (TNode)_t;
1136 match(_t,NDeclaration);
1137 _t = _t.getFirstChild();
1138 tb=declSpecifiers(_t);
1139 _t = _retTree;
1140 {
1141 if (_t==null) _t=ASTNULL;
1142 switch ( _t.getType()) {
1143 case NInitDecl:
1144 {
1145 initDeclList(_t,tb);
1146 _t = _retTree;
1147 break;
1148 }
1149 case SEMI:
1150 {
1151 break;
1152 }
1153 default:
1154 {
1155 throw new NoViableAltException(_t);
1156 }
1157 }
1158 }
1159 {
1160 int _cnt17=0;
1161 _loop17:
1162 do {
1163 if (_t==null) _t=ASTNULL;
1164 if ((_t.getType()==SEMI)) {
1165 TNode tmp19_AST_in = (TNode)_t;
1166 match(_t,SEMI);
1167 _t = _t.getNextSibling();
1168 }
1169 else {
1170 if ( _cnt17>=1 ) { break _loop17; } else {throw new NoViableAltException(_t);}
1171 }
1172
1173 _cnt17++;
1174 } while (true);
1175 }
1176 _t = __t14;
1177 _t = _t.getNextSibling();
1178 if ( inputState.guessing==0 ) {
1179 processDeclaration(tb.type());
1180 }
1181 }
1182 catch (RecognitionException ex) {
1183 if (inputState.guessing==0) {
1184 reportError(ex);
1185 if (_t!=null) {_t = _t.getNextSibling();}
1186 } else {
1187 throw ex;
1188 }
1189 }
1190 _retTree = _t;
1191 }
1192
1193 public final TypeBox declSpecifiers(AST _t) throws RecognitionException {
1194 TypeBox tb;
1195
1196 TNode declSpecifiers_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
1197
1198 tb = null;
1199 Type t = null;
1200 int x = 0;
1201 int y = 0;
1202
1203
1204 try { // for error handling
1205 {
1206 int _cnt33=0;
1207 _loop33:
1208 do {
1209 if (_t==null) _t=ASTNULL;
1210 switch ( _t.getType()) {
1211 case LITERAL_typedef:
1212 case LITERAL_auto:
1213 case LITERAL_register:
1214 case LITERAL_extern:
1215 case LITERAL_static:
1216 case LITERAL_inline:
1217 {
1219 _t = _retTree;
1220 if ( inputState.guessing==0 ) {
1221 x |= y;
1222 }
1223 break;
1224 }
1225 case LITERAL_volatile:
1226 case LITERAL_const:
1227 case LITERAL_signed:
1228 case LITERAL_unsigned:
1229 {
1230 y=typeQualifier(_t);
1231 _t = _retTree;
1232 if ( inputState.guessing==0 ) {
1233 x |= y;
1234 }
1235 break;
1236 }
1237 case LITERAL_struct:
1238 case LITERAL_union:
1239 case LITERAL_enum:
1240 case LITERAL_void:
1241 case LITERAL_char:
1242 case LITERAL_short:
1243 case LITERAL_int:
1244 case LITERAL_long:
1245 case LITERAL_float:
1246 case LITERAL_double:
1247 case 27:
1248 case 28:
1249 case 29:
1250 case 30:
1251 case 31:
1252 case 32:
1253 case LITERAL_wchar_t:
1254 case 34:
1255 case 35:
1256 case 36:
1257 case 37:
1258 case LITERAL_ptrdiff_t:
1259 case LITERAL_intptr_t:
1260 case LITERAL_size_t:
1261 case LITERAL_uintptr_t:
1262 case NTypedefName:
1263 case LITERAL_typeof:
1264 case LITERAL___complex:
1265 {
1266 t=typeSpecifier(_t,x);
1267 _t = _retTree;
1268 break;
1269 }
1270 default:
1271 {
1272 if ( _cnt33>=1 ) { break _loop33; } else {throw new NoViableAltException(_t);}
1273 }
1274 }
1275 _cnt33++;
1276 } while (true);
1277 }
1278 if ( inputState.guessing==0 ) {
1279
1280 if (t == null &&
1281 (x & (SIGNED | UNSIGNED)) != 0) {
1282 t = new IntType("int", SizeThunk.INTxx,
1283 ((x & UNSIGNED) != 0),
1284 attrs2CVAttrs(x),
1285 findASTLocusTag(declSpecifiers_AST_in));
1286 }
1287 tb = new TypeBox(t, ((x & TYPEDEF) != 0));
1288
1289 }
1290 }
1291 catch (RecognitionException ex) {
1292 if (inputState.guessing==0) {
1293 reportError(ex);
1294 if (_t!=null) {_t = _t.getNextSibling();}
1295 } else {
1296 throw ex;
1297 }
1298 }
1299 _retTree = _t;
1300 return tb;
1301 }
1302
1303 public final ParameterDeclaration parameterDeclaration(AST _t) throws RecognitionException {
1304 ParameterDeclaration pd;
1305
1306 TNode parameterDeclaration_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
1307
1308 Type t = null;
1309 String decl = null;
1310 pd = null;
1311 TypeBox tb = null;
1312
1313
1314 try { // for error handling
1315 AST __t24 = _t;
1316 TNode tmp20_AST_in = (TNode)_t;
1317 match(_t,NParameterDeclaration);
1318 _t = _t.getFirstChild();
1319 tb=declSpecifiers(_t);
1320 _t = _retTree;
1321 {
1322 if (_t==null) _t=ASTNULL;
1323 switch ( _t.getType()) {
1324 case NDeclarator:
1325 {
1326 decl=declarator(_t,tb);
1327 _t = _retTree;
1328 break;
1329 }
1331 {
1333 _t = _retTree;
1334 break;
1335 }
1336 case 3:
1337 {
1338 break;
1339 }
1340 default:
1341 {
1342 throw new NoViableAltException(_t);
1343 }
1344 }
1345 }
1346 _t = __t24;
1347 _t = _t.getNextSibling();
1348 if ( inputState.guessing==0 ) {
1349
1350 if( null == tb ) {
1351 throwGlueGenException(parameterDeclaration_AST_in,
1352 String.format("Undefined type for declaration '%s'", decl));
1353 }
1354 pd = new ParameterDeclaration(decl, tb.type());
1355
1356 }
1357 }
1358 catch (RecognitionException ex) {
1359 if (inputState.guessing==0) {
1360 reportError(ex);
1361 if (_t!=null) {_t = _t.getNextSibling();}
1362 } else {
1363 throw ex;
1364 }
1365 }
1366 _retTree = _t;
1367 return pd;
1368 }
1369
1370 public final void nonemptyAbstractDeclarator(AST _t,
1371 TypeBox tb
1372 ) throws RecognitionException {
1373
1374 TNode nonemptyAbstractDeclarator_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
1375 TNode e1 = null;
1376 TNode e2 = null;
1377
1378 final ASTLocusTag locusTag = findASTLocusTag(nonemptyAbstractDeclarator_AST_in);
1379
1380
1381 try { // for error handling
1382 AST __t104 = _t;
1383 TNode tmp21_AST_in = (TNode)_t;
1385 _t = _t.getFirstChild();
1386 {
1387 if (_t==null) _t=ASTNULL;
1388 switch ( _t.getType()) {
1389 case NPointerGroup:
1390 {
1391 pointerGroup(_t,tb);
1392 _t = _retTree;
1393 {
1394 _loop111:
1395 do {
1396 if (_t==null) _t=ASTNULL;
1397 switch ( _t.getType()) {
1398 case LPAREN:
1399 {
1400 {
1401 TNode tmp22_AST_in = (TNode)_t;
1402 match(_t,LPAREN);
1403 _t = _t.getNextSibling();
1404 {
1405 if (_t==null) _t=ASTNULL;
1406 switch ( _t.getType()) {
1408 {
1410 _t = _retTree;
1411 break;
1412 }
1414 {
1416 _t = _retTree;
1417 break;
1418 }
1419 case RPAREN:
1420 {
1421 break;
1422 }
1423 default:
1424 {
1425 throw new NoViableAltException(_t);
1426 }
1427 }
1428 }
1429 TNode tmp23_AST_in = (TNode)_t;
1430 match(_t,RPAREN);
1431 _t = _t.getNextSibling();
1432 }
1433 break;
1434 }
1435 case LBRACKET:
1436 {
1437 {
1438 TNode tmp24_AST_in = (TNode)_t;
1439 match(_t,LBRACKET);
1440 _t = _t.getNextSibling();
1441 {
1442 if (_t==null) _t=ASTNULL;
1443 switch ( _t.getType()) {
1444 case ID:
1445 case ASSIGN:
1446 case STAR:
1447 case LPAREN:
1448 case DIV_ASSIGN:
1449 case PLUS_ASSIGN:
1450 case MINUS_ASSIGN:
1451 case STAR_ASSIGN:
1452 case MOD_ASSIGN:
1453 case RSHIFT_ASSIGN:
1454 case LSHIFT_ASSIGN:
1455 case BAND_ASSIGN:
1456 case BOR_ASSIGN:
1457 case BXOR_ASSIGN:
1458 case QUESTION:
1459 case LOR:
1460 case LAND:
1461 case BOR:
1462 case BXOR:
1463 case BAND:
1464 case EQUAL:
1465 case NOT_EQUAL:
1466 case LT:
1467 case LTE:
1468 case GT:
1469 case GTE:
1470 case LSHIFT:
1471 case RSHIFT:
1472 case PLUS:
1473 case MINUS:
1474 case DIV:
1475 case MOD:
1476 case INC:
1477 case DEC:
1478 case LITERAL_sizeof:
1479 case CharLiteral:
1480 case NCast:
1481 case NExpressionGroup:
1482 case NInitializer:
1483 case NEmptyExpression:
1484 case NCommaExpr:
1485 case NUnaryExpr:
1486 case NPostfixExpr:
1487 case NRangeExpr:
1488 case NStringSeq:
1489 case NLcurlyInitializer:
1490 case NGnuAsmExpr:
1491 case Number:
1492 case LITERAL___alignof:
1493 {
1494 e1 = _t==ASTNULL ? null : (TNode)_t;
1495 expr(_t);
1496 _t = _retTree;
1497 break;
1498 }
1499 case RBRACKET:
1500 {
1501 break;
1502 }
1503 default:
1504 {
1505 throw new NoViableAltException(_t);
1506 }
1507 }
1508 }
1509 TNode tmp25_AST_in = (TNode)_t;
1510 match(_t,RBRACKET);
1511 _t = _t.getNextSibling();
1512 }
1513 if ( inputState.guessing==0 ) {
1514 handleArrayExpr(tb, e1, locusTag);
1515 }
1516 break;
1517 }
1518 default:
1519 {
1520 break _loop111;
1521 }
1522 }
1523 } while (true);
1524 }
1525 break;
1526 }
1527 case LPAREN:
1528 case LBRACKET:
1529 {
1530 {
1531 int _cnt117=0;
1532 _loop117:
1533 do {
1534 if (_t==null) _t=ASTNULL;
1535 switch ( _t.getType()) {
1536 case LPAREN:
1537 {
1538 {
1539 TNode tmp26_AST_in = (TNode)_t;
1540 match(_t,LPAREN);
1541 _t = _t.getNextSibling();
1542 {
1543 if (_t==null) _t=ASTNULL;
1544 switch ( _t.getType()) {
1546 {
1548 _t = _retTree;
1549 break;
1550 }
1552 {
1554 _t = _retTree;
1555 break;
1556 }
1557 case RPAREN:
1558 {
1559 break;
1560 }
1561 default:
1562 {
1563 throw new NoViableAltException(_t);
1564 }
1565 }
1566 }
1567 TNode tmp27_AST_in = (TNode)_t;
1568 match(_t,RPAREN);
1569 _t = _t.getNextSibling();
1570 }
1571 break;
1572 }
1573 case LBRACKET:
1574 {
1575 {
1576 TNode tmp28_AST_in = (TNode)_t;
1577 match(_t,LBRACKET);
1578 _t = _t.getNextSibling();
1579 {
1580 if (_t==null) _t=ASTNULL;
1581 switch ( _t.getType()) {
1582 case ID:
1583 case ASSIGN:
1584 case STAR:
1585 case LPAREN:
1586 case DIV_ASSIGN:
1587 case PLUS_ASSIGN:
1588 case MINUS_ASSIGN:
1589 case STAR_ASSIGN:
1590 case MOD_ASSIGN:
1591 case RSHIFT_ASSIGN:
1592 case LSHIFT_ASSIGN:
1593 case BAND_ASSIGN:
1594 case BOR_ASSIGN:
1595 case BXOR_ASSIGN:
1596 case QUESTION:
1597 case LOR:
1598 case LAND:
1599 case BOR:
1600 case BXOR:
1601 case BAND:
1602 case EQUAL:
1603 case NOT_EQUAL:
1604 case LT:
1605 case LTE:
1606 case GT:
1607 case GTE:
1608 case LSHIFT:
1609 case RSHIFT:
1610 case PLUS:
1611 case MINUS:
1612 case DIV:
1613 case MOD:
1614 case INC:
1615 case DEC:
1616 case LITERAL_sizeof:
1617 case CharLiteral:
1618 case NCast:
1619 case NExpressionGroup:
1620 case NInitializer:
1621 case NEmptyExpression:
1622 case NCommaExpr:
1623 case NUnaryExpr:
1624 case NPostfixExpr:
1625 case NRangeExpr:
1626 case NStringSeq:
1627 case NLcurlyInitializer:
1628 case NGnuAsmExpr:
1629 case Number:
1630 case LITERAL___alignof:
1631 {
1632 e2 = _t==ASTNULL ? null : (TNode)_t;
1633 expr(_t);
1634 _t = _retTree;
1635 break;
1636 }
1637 case RBRACKET:
1638 {
1639 break;
1640 }
1641 default:
1642 {
1643 throw new NoViableAltException(_t);
1644 }
1645 }
1646 }
1647 TNode tmp29_AST_in = (TNode)_t;
1648 match(_t,RBRACKET);
1649 _t = _t.getNextSibling();
1650 }
1651 if ( inputState.guessing==0 ) {
1652 handleArrayExpr(tb, e2, locusTag);
1653 }
1654 break;
1655 }
1656 default:
1657 {
1658 if ( _cnt117>=1 ) { break _loop117; } else {throw new NoViableAltException(_t);}
1659 }
1660 }
1661 _cnt117++;
1662 } while (true);
1663 }
1664 break;
1665 }
1666 default:
1667 {
1668 throw new NoViableAltException(_t);
1669 }
1670 }
1671 }
1672 _t = __t104;
1673 _t = _t.getNextSibling();
1674 }
1675 catch (RecognitionException ex) {
1676 if (inputState.guessing==0) {
1677 reportError(ex);
1678 if (_t!=null) {_t = _t.getNextSibling();}
1679 } else {
1680 throw ex;
1681 }
1682 }
1683 _retTree = _t;
1684 }
1685
1686 public final void functionDef(AST _t) throws RecognitionException {
1687
1688 TNode functionDef_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
1689
1690 TypeBox tb = null;
1691
1692
1693 try { // for error handling
1694 AST __t27 = _t;
1695 TNode tmp30_AST_in = (TNode)_t;
1696 match(_t,NFunctionDef);
1697 _t = _t.getFirstChild();
1698 {
1699 if (_t==null) _t=ASTNULL;
1700 switch ( _t.getType()) {
1701 case LITERAL_volatile:
1702 case LITERAL_struct:
1703 case LITERAL_union:
1704 case LITERAL_enum:
1705 case LITERAL_extern:
1706 case LITERAL_static:
1707 case LITERAL_const:
1708 case LITERAL_void:
1709 case LITERAL_char:
1710 case LITERAL_short:
1711 case LITERAL_int:
1712 case LITERAL_long:
1713 case LITERAL_float:
1714 case LITERAL_double:
1715 case LITERAL_signed:
1716 case LITERAL_unsigned:
1717 case 27:
1718 case 28:
1719 case 29:
1720 case 30:
1721 case 31:
1722 case 32:
1723 case LITERAL_wchar_t:
1724 case 34:
1725 case 35:
1726 case 36:
1727 case 37:
1728 case LITERAL_ptrdiff_t:
1729 case LITERAL_intptr_t:
1730 case LITERAL_size_t:
1731 case LITERAL_uintptr_t:
1732 case NTypedefName:
1733 case LITERAL_inline:
1734 case LITERAL_typeof:
1735 case LITERAL___complex:
1736 {
1738 _t = _retTree;
1739 break;
1740 }
1741 case NDeclarator:
1742 {
1743 break;
1744 }
1745 default:
1746 {
1747 throw new NoViableAltException(_t);
1748 }
1749 }
1750 }
1751 declarator(_t,tb);
1752 _t = _retTree;
1753 {
1754 _loop30:
1755 do {
1756 if (_t==null) _t=ASTNULL;
1757 switch ( _t.getType()) {
1758 case NDeclaration:
1759 {
1760 declaration(_t);
1761 _t = _retTree;
1762 break;
1763 }
1764 case VARARGS:
1765 {
1766 TNode tmp31_AST_in = (TNode)_t;
1767 match(_t,VARARGS);
1768 _t = _t.getNextSibling();
1769 break;
1770 }
1771 default:
1772 {
1773 break _loop30;
1774 }
1775 }
1776 } while (true);
1777 }
1779 _t = _retTree;
1780 _t = __t27;
1781 _t = _t.getNextSibling();
1782 }
1783 catch (RecognitionException ex) {
1784 if (inputState.guessing==0) {
1785 reportError(ex);
1786 if (_t!=null) {_t = _t.getNextSibling();}
1787 } else {
1788 throw ex;
1789 }
1790 }
1791 _retTree = _t;
1792 }
1793
1794 public final void functionDeclSpecifiers(AST _t) throws RecognitionException {
1795
1796 TNode functionDeclSpecifiers_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
1797
1798 try { // for error handling
1799 {
1800 int _cnt100=0;
1801 _loop100:
1802 do {
1803 if (_t==null) _t=ASTNULL;
1804 switch ( _t.getType()) {
1805 case LITERAL_extern:
1806 case LITERAL_static:
1807 case LITERAL_inline:
1808 {
1810 _t = _retTree;
1811 break;
1812 }
1813 case LITERAL_volatile:
1814 case LITERAL_const:
1815 case LITERAL_signed:
1816 case LITERAL_unsigned:
1817 {
1818 typeQualifier(_t);
1819 _t = _retTree;
1820 break;
1821 }
1822 case LITERAL_struct:
1823 case LITERAL_union:
1824 case LITERAL_enum:
1825 case LITERAL_void:
1826 case LITERAL_char:
1827 case LITERAL_short:
1828 case LITERAL_int:
1829 case LITERAL_long:
1830 case LITERAL_float:
1831 case LITERAL_double:
1832 case 27:
1833 case 28:
1834 case 29:
1835 case 30:
1836 case 31:
1837 case 32:
1838 case LITERAL_wchar_t:
1839 case 34:
1840 case 35:
1841 case 36:
1842 case 37:
1843 case LITERAL_ptrdiff_t:
1844 case LITERAL_intptr_t:
1845 case LITERAL_size_t:
1846 case LITERAL_uintptr_t:
1847 case NTypedefName:
1848 case LITERAL_typeof:
1849 case LITERAL___complex:
1850 {
1851 typeSpecifier(_t,0);
1852 _t = _retTree;
1853 break;
1854 }
1855 default:
1856 {
1857 if ( _cnt100>=1 ) { break _loop100; } else {throw new NoViableAltException(_t);}
1858 }
1859 }
1860 _cnt100++;
1861 } while (true);
1862 }
1863 }
1864 catch (RecognitionException ex) {
1865 if (inputState.guessing==0) {
1866 reportError(ex);
1867 if (_t!=null) {_t = _t.getNextSibling();}
1868 } else {
1869 throw ex;
1870 }
1871 }
1872 _retTree = _t;
1873 }
1874
1875 public final void compoundStatement(AST _t) throws RecognitionException {
1876
1877 TNode compoundStatement_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
1878
1879 try { // for error handling
1880 AST __t159 = _t;
1881 TNode tmp32_AST_in = (TNode)_t;
1882 match(_t,NCompoundStatement);
1883 _t = _t.getFirstChild();
1884 {
1885 _loop161:
1886 do {
1887 if (_t==null) _t=ASTNULL;
1888 switch ( _t.getType()) {
1889 case NDeclaration:
1890 case LITERAL___label__:
1891 {
1892 declarationList(_t);
1893 _t = _retTree;
1894 break;
1895 }
1896 case NFunctionDef:
1897 {
1898 functionDef(_t);
1899 _t = _retTree;
1900 break;
1901 }
1902 default:
1903 {
1904 break _loop161;
1905 }
1906 }
1907 } while (true);
1908 }
1909 {
1910 if (_t==null) _t=ASTNULL;
1911 switch ( _t.getType()) {
1912 case SEMI:
1913 case LITERAL_while:
1914 case LITERAL_do:
1915 case LITERAL_for:
1916 case LITERAL_goto:
1917 case LITERAL_continue:
1918 case LITERAL_break:
1919 case LITERAL_return:
1920 case LITERAL_case:
1921 case LITERAL_default:
1922 case LITERAL_if:
1923 case LITERAL_switch:
1924 case NStatementExpr:
1925 case NCompoundStatement:
1926 case NLabel:
1927 {
1928 statementList(_t);
1929 _t = _retTree;
1930 break;
1931 }
1932 case RCURLY:
1933 {
1934 break;
1935 }
1936 default:
1937 {
1938 throw new NoViableAltException(_t);
1939 }
1940 }
1941 }
1942 TNode tmp33_AST_in = (TNode)_t;
1943 match(_t,RCURLY);
1944 _t = _t.getNextSibling();
1945 _t = __t159;
1946 _t = _t.getNextSibling();
1947 }
1948 catch (RecognitionException ex) {
1949 if (inputState.guessing==0) {
1950 reportError(ex);
1951 if (_t!=null) {_t = _t.getNextSibling();}
1952 } else {
1953 throw ex;
1954 }
1955 }
1956 _retTree = _t;
1957 }
1958
1959 public final int storageClassSpecifier(AST _t) throws RecognitionException {
1960 int x;
1961
1962 TNode storageClassSpecifier_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
1963 x = 0;
1964
1965 try { // for error handling
1966 if (_t==null) _t=ASTNULL;
1967 switch ( _t.getType()) {
1968 case LITERAL_auto:
1969 {
1970 TNode tmp34_AST_in = (TNode)_t;
1971 match(_t,LITERAL_auto);
1972 _t = _t.getNextSibling();
1973 if ( inputState.guessing==0 ) {
1974 x |= AUTO;
1975 }
1976 break;
1977 }
1978 case LITERAL_register:
1979 {
1980 TNode tmp35_AST_in = (TNode)_t;
1981 match(_t,LITERAL_register);
1982 _t = _t.getNextSibling();
1983 if ( inputState.guessing==0 ) {
1984 x |= REGISTER;
1985 }
1986 break;
1987 }
1988 case LITERAL_typedef:
1989 {
1990 TNode tmp36_AST_in = (TNode)_t;
1991 match(_t,LITERAL_typedef);
1992 _t = _t.getNextSibling();
1993 if ( inputState.guessing==0 ) {
1994 x |= TYPEDEF;
1995 }
1996 break;
1997 }
1998 case LITERAL_extern:
1999 case LITERAL_static:
2000 case LITERAL_inline:
2001 {
2003 _t = _retTree;
2004 break;
2005 }
2006 default:
2007 {
2008 throw new NoViableAltException(_t);
2009 }
2010 }
2011 }
2012 catch (RecognitionException ex) {
2013 if (inputState.guessing==0) {
2014 reportError(ex);
2015 if (_t!=null) {_t = _t.getNextSibling();}
2016 } else {
2017 throw ex;
2018 }
2019 }
2020 _retTree = _t;
2021 return x;
2022 }
2023
2024 public final int typeQualifier(AST _t) throws RecognitionException {
2025 int x;
2026
2027 TNode typeQualifier_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
2028 x = 0;
2029
2030 try { // for error handling
2031 if (_t==null) _t=ASTNULL;
2032 switch ( _t.getType()) {
2033 case LITERAL_const:
2034 {
2035 TNode tmp37_AST_in = (TNode)_t;
2036 match(_t,LITERAL_const);
2037 _t = _t.getNextSibling();
2038 if ( inputState.guessing==0 ) {
2039 x |= CONST;
2040 }
2041 break;
2042 }
2043 case LITERAL_volatile:
2044 {
2045 TNode tmp38_AST_in = (TNode)_t;
2046 match(_t,LITERAL_volatile);
2047 _t = _t.getNextSibling();
2048 if ( inputState.guessing==0 ) {
2049 x |= VOLATILE;
2050 }
2051 break;
2052 }
2053 case LITERAL_signed:
2054 {
2055 TNode tmp39_AST_in = (TNode)_t;
2056 match(_t,LITERAL_signed);
2057 _t = _t.getNextSibling();
2058 if ( inputState.guessing==0 ) {
2059 x |= SIGNED;
2060 }
2061 break;
2062 }
2063 case LITERAL_unsigned:
2064 {
2065 TNode tmp40_AST_in = (TNode)_t;
2066 match(_t,LITERAL_unsigned);
2067 _t = _t.getNextSibling();
2068 if ( inputState.guessing==0 ) {
2069 x |= UNSIGNED;
2070 }
2071 break;
2072 }
2073 default:
2074 {
2075 throw new NoViableAltException(_t);
2076 }
2077 }
2078 }
2079 catch (RecognitionException ex) {
2080 if (inputState.guessing==0) {
2081 reportError(ex);
2082 if (_t!=null) {_t = _t.getNextSibling();}
2083 } else {
2084 throw ex;
2085 }
2086 }
2087 _retTree = _t;
2088 return x;
2089 }
2090
2091 public final Type typeSpecifier(AST _t,
2092 int attributes
2093 ) throws RecognitionException {
2094 Type t;
2095
2096 TNode typeSpecifier_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
2097
2098 t = null;
2099 int cvAttrs = attrs2CVAttrs(attributes);
2100 boolean unsig = ((attributes & UNSIGNED) != 0);
2101 final ASTLocusTag locusTag = findASTLocusTag(typeSpecifier_AST_in);
2102
2103
2104 try { // for error handling
2105 if (_t==null) _t=ASTNULL;
2106 switch ( _t.getType()) {
2107 case LITERAL_void:
2108 {
2109 TNode tmp41_AST_in = (TNode)_t;
2110 match(_t,LITERAL_void);
2111 _t = _t.getNextSibling();
2112 if ( inputState.guessing==0 ) {
2113 t = new VoidType( cvAttrs, locusTag);
2114 }
2115 break;
2116 }
2117 case LITERAL_char:
2118 {
2119 TNode tmp42_AST_in = (TNode)_t;
2120 match(_t,LITERAL_char);
2121 _t = _t.getNextSibling();
2122 if ( inputState.guessing==0 ) {
2123 t = new IntType("char" , SizeThunk.INT8, unsig, cvAttrs, false, false, locusTag);
2124 }
2125 break;
2126 }
2127 case LITERAL_short:
2128 {
2129 TNode tmp43_AST_in = (TNode)_t;
2130 match(_t,LITERAL_short);
2131 _t = _t.getNextSibling();
2132 if ( inputState.guessing==0 ) {
2133 t = new IntType("short", SizeThunk.INT16, unsig, cvAttrs, false, false, locusTag);
2134 }
2135 break;
2136 }
2137 case LITERAL_int:
2138 {
2139 TNode tmp44_AST_in = (TNode)_t;
2140 match(_t,LITERAL_int);
2141 _t = _t.getNextSibling();
2142 if ( inputState.guessing==0 ) {
2143 t = new IntType("int" , SizeThunk.INTxx, unsig, cvAttrs, false, false, locusTag);
2144 }
2145 break;
2146 }
2147 case LITERAL_long:
2148 {
2149 TNode tmp45_AST_in = (TNode)_t;
2150 match(_t,LITERAL_long);
2151 _t = _t.getNextSibling();
2152 if ( inputState.guessing==0 ) {
2153 t = new IntType("long" , SizeThunk.LONG, unsig, cvAttrs, false, false, locusTag);
2154 }
2155 break;
2156 }
2157 case LITERAL_float:
2158 {
2159 TNode tmp46_AST_in = (TNode)_t;
2160 match(_t,LITERAL_float);
2161 _t = _t.getNextSibling();
2162 if ( inputState.guessing==0 ) {
2163 t = new FloatType("float", SizeThunk.FLOAT, cvAttrs, locusTag);
2164 }
2165 break;
2166 }
2167 case LITERAL_double:
2168 {
2169 TNode tmp47_AST_in = (TNode)_t;
2170 match(_t,LITERAL_double);
2171 _t = _t.getNextSibling();
2172 if ( inputState.guessing==0 ) {
2173 t = new DoubleType("double", SizeThunk.DOUBLE, cvAttrs, locusTag);
2174 }
2175 break;
2176 }
2177 case 31:
2178 {
2179 TNode tmp48_AST_in = (TNode)_t;
2180 match(_t,31);
2181 _t = _t.getNextSibling();
2182 if ( inputState.guessing==0 ) {
2183 t = new IntType("__int32", SizeThunk.INT32, unsig, cvAttrs, true, false, locusTag);
2184 }
2185 break;
2186 }
2187 case 35:
2188 {
2189 TNode tmp49_AST_in = (TNode)_t;
2190 match(_t,35);
2191 _t = _t.getNextSibling();
2192 if ( inputState.guessing==0 ) {
2193 t = new IntType("__int64", SizeThunk.INT64, unsig, cvAttrs, true, false, locusTag);
2194 }
2195 break;
2196 }
2197 case 27:
2198 {
2199 TNode tmp50_AST_in = (TNode)_t;
2200 match(_t,27);
2201 _t = _t.getNextSibling();
2202 if ( inputState.guessing==0 ) {
2203 t = new IntType("int8_t", SizeThunk.INT8, unsig, cvAttrs, true, false, locusTag);
2204 }
2205 break;
2206 }
2207 case 28:
2208 {
2209 TNode tmp51_AST_in = (TNode)_t;
2210 match(_t,28);
2211 _t = _t.getNextSibling();
2212 if ( inputState.guessing==0 ) {
2213 t = new IntType("uint8_t", SizeThunk.INT8, unsig, cvAttrs, true, true, locusTag);
2214 }
2215 break;
2216 }
2217 case 29:
2218 {
2219 TNode tmp52_AST_in = (TNode)_t;
2220 match(_t,29);
2221 _t = _t.getNextSibling();
2222 if ( inputState.guessing==0 ) {
2223 t = new IntType("int16_t", SizeThunk.INT16, unsig, cvAttrs, true, false, locusTag);
2224 }
2225 break;
2226 }
2227 case 30:
2228 {
2229 TNode tmp53_AST_in = (TNode)_t;
2230 match(_t,30);
2231 _t = _t.getNextSibling();
2232 if ( inputState.guessing==0 ) {
2233 t = new IntType("uint16_t", SizeThunk.INT16, unsig, cvAttrs, true, true, locusTag);
2234 }
2235 break;
2236 }
2237 case 32:
2238 {
2239 TNode tmp54_AST_in = (TNode)_t;
2240 match(_t,32);
2241 _t = _t.getNextSibling();
2242 if ( inputState.guessing==0 ) {
2243 t = new IntType("int32_t", SizeThunk.INT32, unsig, cvAttrs, true, false, locusTag);
2244 }
2245 break;
2246 }
2247 case LITERAL_wchar_t:
2248 {
2249 TNode tmp55_AST_in = (TNode)_t;
2250 match(_t,LITERAL_wchar_t);
2251 _t = _t.getNextSibling();
2252 if ( inputState.guessing==0 ) {
2253 t = new IntType("wchar_t", SizeThunk.INT32, unsig, cvAttrs, true, false, locusTag);
2254 }
2255 break;
2256 }
2257 case 34:
2258 {
2259 TNode tmp56_AST_in = (TNode)_t;
2260 match(_t,34);
2261 _t = _t.getNextSibling();
2262 if ( inputState.guessing==0 ) {
2263 t = new IntType("uint32_t", SizeThunk.INT32, unsig, cvAttrs, true, true, locusTag);
2264 }
2265 break;
2266 }
2267 case 36:
2268 {
2269 TNode tmp57_AST_in = (TNode)_t;
2270 match(_t,36);
2271 _t = _t.getNextSibling();
2272 if ( inputState.guessing==0 ) {
2273 t = new IntType("int64_t", SizeThunk.INT64, unsig, cvAttrs, true, false, locusTag);
2274 }
2275 break;
2276 }
2277 case 37:
2278 {
2279 TNode tmp58_AST_in = (TNode)_t;
2280 match(_t,37);
2281 _t = _t.getNextSibling();
2282 if ( inputState.guessing==0 ) {
2283 t = new IntType("uint64_t", SizeThunk.INT64, unsig, cvAttrs, true, true, locusTag);
2284 }
2285 break;
2286 }
2287 case LITERAL_ptrdiff_t:
2288 {
2289 TNode tmp59_AST_in = (TNode)_t;
2290 match(_t,LITERAL_ptrdiff_t);
2291 _t = _t.getNextSibling();
2292 if ( inputState.guessing==0 ) {
2293 t = new IntType("ptrdiff_t", SizeThunk.POINTER, unsig, cvAttrs, true, false, locusTag);
2294 }
2295 break;
2296 }
2297 case LITERAL_intptr_t:
2298 {
2299 TNode tmp60_AST_in = (TNode)_t;
2300 match(_t,LITERAL_intptr_t);
2301 _t = _t.getNextSibling();
2302 if ( inputState.guessing==0 ) {
2303 t = new IntType("intptr_t", SizeThunk.POINTER, unsig, cvAttrs, true, false, locusTag);
2304 }
2305 break;
2306 }
2307 case LITERAL_size_t:
2308 {
2309 TNode tmp61_AST_in = (TNode)_t;
2310 match(_t,LITERAL_size_t);
2311 _t = _t.getNextSibling();
2312 if ( inputState.guessing==0 ) {
2313 t = new IntType("size_t", SizeThunk.POINTER, unsig, cvAttrs, true, true, locusTag);
2314 }
2315 break;
2316 }
2317 case LITERAL_uintptr_t:
2318 {
2319 TNode tmp62_AST_in = (TNode)_t;
2320 match(_t,LITERAL_uintptr_t);
2321 _t = _t.getNextSibling();
2322 if ( inputState.guessing==0 ) {
2323 t = new IntType("uintptr_t", SizeThunk.POINTER, unsig, cvAttrs, true, true, locusTag);
2324 }
2325 break;
2326 }
2327 case LITERAL_struct:
2328 {
2329 t=structSpecifier(_t,cvAttrs);
2330 _t = _retTree;
2331 {
2332 _loop39:
2333 do {
2334 if (_t==null) _t=ASTNULL;
2335 if ((_t.getType()==NAsmAttribute||_t.getType()==LITERAL___attribute)) {
2336 attributeDecl(_t);
2337 _t = _retTree;
2338 }
2339 else {
2340 break _loop39;
2341 }
2342
2343 } while (true);
2344 }
2345 break;
2346 }
2347 case LITERAL_union:
2348 {
2349 t=unionSpecifier(_t,cvAttrs);
2350 _t = _retTree;
2351 {
2352 _loop41:
2353 do {
2354 if (_t==null) _t=ASTNULL;
2355 if ((_t.getType()==NAsmAttribute||_t.getType()==LITERAL___attribute)) {
2356 attributeDecl(_t);
2357 _t = _retTree;
2358 }
2359 else {
2360 break _loop41;
2361 }
2362
2363 } while (true);
2364 }
2365 break;
2366 }
2367 case LITERAL_enum:
2368 {
2369 t=enumSpecifier(_t,cvAttrs);
2370 _t = _retTree;
2371 break;
2372 }
2373 case NTypedefName:
2374 {
2375 t=typedefName(_t,cvAttrs);
2376 _t = _retTree;
2377 break;
2378 }
2379 case LITERAL_typeof:
2380 {
2381 AST __t42 = _t;
2382 TNode tmp63_AST_in = (TNode)_t;
2383 match(_t,LITERAL_typeof);
2384 _t = _t.getFirstChild();
2385 TNode tmp64_AST_in = (TNode)_t;
2386 match(_t,LPAREN);
2387 _t = _t.getNextSibling();
2388 {
2389 if (_t==null) _t=ASTNULL;
2390 switch ( _t.getType()) {
2391 case LITERAL_volatile:
2392 case LITERAL_struct:
2393 case LITERAL_union:
2394 case LITERAL_enum:
2395 case LITERAL_const:
2396 case LITERAL_void:
2397 case LITERAL_char:
2398 case LITERAL_short:
2399 case LITERAL_int:
2400 case LITERAL_long:
2401 case LITERAL_float:
2402 case LITERAL_double:
2403 case LITERAL_signed:
2404 case LITERAL_unsigned:
2405 case 27:
2406 case 28:
2407 case 29:
2408 case 30:
2409 case 31:
2410 case 32:
2411 case LITERAL_wchar_t:
2412 case 34:
2413 case 35:
2414 case 36:
2415 case 37:
2416 case LITERAL_ptrdiff_t:
2417 case LITERAL_intptr_t:
2418 case LITERAL_size_t:
2419 case LITERAL_uintptr_t:
2420 case NTypedefName:
2421 case LITERAL_typeof:
2422 case LITERAL___complex:
2423 {
2424 typeName(_t);
2425 _t = _retTree;
2426 break;
2427 }
2428 case ID:
2429 case ASSIGN:
2430 case STAR:
2431 case LPAREN:
2432 case DIV_ASSIGN:
2433 case PLUS_ASSIGN:
2434 case MINUS_ASSIGN:
2435 case STAR_ASSIGN:
2436 case MOD_ASSIGN:
2437 case RSHIFT_ASSIGN:
2438 case LSHIFT_ASSIGN:
2439 case BAND_ASSIGN:
2440 case BOR_ASSIGN:
2441 case BXOR_ASSIGN:
2442 case QUESTION:
2443 case LOR:
2444 case LAND:
2445 case BOR:
2446 case BXOR:
2447 case BAND:
2448 case EQUAL:
2449 case NOT_EQUAL:
2450 case LT:
2451 case LTE:
2452 case GT:
2453 case GTE:
2454 case LSHIFT:
2455 case RSHIFT:
2456 case PLUS:
2457 case MINUS:
2458 case DIV:
2459 case MOD:
2460 case INC:
2461 case DEC:
2462 case LITERAL_sizeof:
2463 case CharLiteral:
2464 case NCast:
2465 case NExpressionGroup:
2466 case NInitializer:
2467 case NEmptyExpression:
2468 case NCommaExpr:
2469 case NUnaryExpr:
2470 case NPostfixExpr:
2471 case NRangeExpr:
2472 case NStringSeq:
2473 case NLcurlyInitializer:
2474 case NGnuAsmExpr:
2475 case Number:
2476 case LITERAL___alignof:
2477 {
2478 expr(_t);
2479 _t = _retTree;
2480 break;
2481 }
2482 default:
2483 {
2484 throw new NoViableAltException(_t);
2485 }
2486 }
2487 }
2488 TNode tmp65_AST_in = (TNode)_t;
2489 match(_t,RPAREN);
2490 _t = _t.getNextSibling();
2491 _t = __t42;
2492 _t = _t.getNextSibling();
2493 break;
2494 }
2495 case LITERAL___complex:
2496 {
2497 TNode tmp66_AST_in = (TNode)_t;
2498 match(_t,LITERAL___complex);
2499 _t = _t.getNextSibling();
2500 break;
2501 }
2502 default:
2503 {
2504 throw new NoViableAltException(_t);
2505 }
2506 }
2507 }
2508 catch (RecognitionException ex) {
2509 if (inputState.guessing==0) {
2510 reportError(ex);
2511 if (_t!=null) {_t = _t.getNextSibling();}
2512 } else {
2513 throw ex;
2514 }
2515 }
2516 _retTree = _t;
2517 return t;
2518 }
2519
2520 public final int functionStorageClassSpecifier(AST _t) throws RecognitionException {
2521 int x;
2522
2523 TNode functionStorageClassSpecifier_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
2524 x = 0;
2525
2526 try { // for error handling
2527 if (_t==null) _t=ASTNULL;
2528 switch ( _t.getType()) {
2529 case LITERAL_extern:
2530 {
2531 TNode tmp67_AST_in = (TNode)_t;
2532 match(_t,LITERAL_extern);
2533 _t = _t.getNextSibling();
2534 if ( inputState.guessing==0 ) {
2535 x |= EXTERN;
2536 }
2537 break;
2538 }
2539 case LITERAL_static:
2540 {
2541 TNode tmp68_AST_in = (TNode)_t;
2542 match(_t,LITERAL_static);
2543 _t = _t.getNextSibling();
2544 if ( inputState.guessing==0 ) {
2545 x |= STATIC;
2546 }
2547 break;
2548 }
2549 case LITERAL_inline:
2550 {
2551 TNode tmp69_AST_in = (TNode)_t;
2552 match(_t,LITERAL_inline);
2553 _t = _t.getNextSibling();
2554 if ( inputState.guessing==0 ) {
2555 x |= INLINE;
2556 }
2557 break;
2558 }
2559 default:
2560 {
2561 throw new NoViableAltException(_t);
2562 }
2563 }
2564 }
2565 catch (RecognitionException ex) {
2566 if (inputState.guessing==0) {
2567 reportError(ex);
2568 if (_t!=null) {_t = _t.getNextSibling();}
2569 } else {
2570 throw ex;
2571 }
2572 }
2573 _retTree = _t;
2574 return x;
2575 }
2576
2577 public final Type structSpecifier(AST _t,
2578 int cvAttrs
2579 ) throws RecognitionException {
2580 Type t;
2581
2582 TNode structSpecifier_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
2583 t = null;
2584
2585 try { // for error handling
2586 AST __t49 = _t;
2587 TNode tmp70_AST_in = (TNode)_t;
2588 match(_t,LITERAL_struct);
2589 _t = _t.getFirstChild();
2591 _t = _retTree;
2592 _t = __t49;
2593 _t = _t.getNextSibling();
2594 }
2595 catch (RecognitionException ex) {
2596 if (inputState.guessing==0) {
2597 reportError(ex);
2598 if (_t!=null) {_t = _t.getNextSibling();}
2599 } else {
2600 throw ex;
2601 }
2602 }
2603 _retTree = _t;
2604 return t;
2605 }
2606
2607 public final void attributeDecl(AST _t) throws RecognitionException {
2608
2609 TNode attributeDecl_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
2610
2611 try { // for error handling
2612 if (_t==null) _t=ASTNULL;
2613 switch ( _t.getType()) {
2615 {
2616 AST __t131 = _t;
2617 TNode tmp71_AST_in = (TNode)_t;
2618 match(_t,LITERAL___attribute);
2619 _t = _t.getFirstChild();
2620 {
2621 _loop133:
2622 do {
2623 if (_t==null) _t=ASTNULL;
2624 if (((_t.getType() >= LITERAL_typedef && _t.getType() <= LITERAL___imag))) {
2625 TNode tmp72_AST_in = (TNode)_t;
2626 if ( _t==null ) throw new MismatchedTokenException();
2627 _t = _t.getNextSibling();
2628 }
2629 else {
2630 break _loop133;
2631 }
2632
2633 } while (true);
2634 }
2635 _t = __t131;
2636 _t = _t.getNextSibling();
2637 break;
2638 }
2639 case NAsmAttribute:
2640 {
2641 AST __t134 = _t;
2642 TNode tmp73_AST_in = (TNode)_t;
2643 match(_t,NAsmAttribute);
2644 _t = _t.getFirstChild();
2645 TNode tmp74_AST_in = (TNode)_t;
2646 match(_t,LPAREN);
2647 _t = _t.getNextSibling();
2648 expr(_t);
2649 _t = _retTree;
2650 TNode tmp75_AST_in = (TNode)_t;
2651 match(_t,RPAREN);
2652 _t = _t.getNextSibling();
2653 _t = __t134;
2654 _t = _t.getNextSibling();
2655 break;
2656 }
2657 default:
2658 {
2659 throw new NoViableAltException(_t);
2660 }
2661 }
2662 }
2663 catch (RecognitionException ex) {
2664 if (inputState.guessing==0) {
2665 reportError(ex);
2666 if (_t!=null) {_t = _t.getNextSibling();}
2667 } else {
2668 throw ex;
2669 }
2670 }
2671 _retTree = _t;
2672 }
2673
2674 public final Type unionSpecifier(AST _t,
2675 int cvAttrs
2676 ) throws RecognitionException {
2677 Type t;
2678
2679 TNode unionSpecifier_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
2680 t = null;
2681
2682 try { // for error handling
2683 AST __t51 = _t;
2684 TNode tmp76_AST_in = (TNode)_t;
2685 match(_t,LITERAL_union);
2686 _t = _t.getFirstChild();
2688 _t = _retTree;
2689 _t = __t51;
2690 _t = _t.getNextSibling();
2691 }
2692 catch (RecognitionException ex) {
2693 if (inputState.guessing==0) {
2694 reportError(ex);
2695 if (_t!=null) {_t = _t.getNextSibling();}
2696 } else {
2697 throw ex;
2698 }
2699 }
2700 _retTree = _t;
2701 return t;
2702 }
2703
2704 public final Type enumSpecifier(AST _t,
2705 int cvAttrs
2706 ) throws RecognitionException {
2707 Type t;
2708
2709 TNode enumSpecifier_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
2710 TNode i = null;
2711
2712 t = null;
2713 EnumType e = null;
2714 ASTLocusTag locusTag = findASTLocusTag(enumSpecifier_AST_in);
2715
2716
2717 try { // for error handling
2718 AST __t75 = _t;
2719 TNode tmp77_AST_in = (TNode)_t;
2720 match(_t,LITERAL_enum);
2721 _t = _t.getFirstChild();
2722 {
2723 boolean synPredMatched78 = false;
2724 if (_t==null) _t=ASTNULL;
2725 if (((_t.getType()==ID))) {
2726 AST __t78 = _t;
2727 synPredMatched78 = true;
2728 inputState.guessing++;
2729 try {
2730 {
2731 TNode tmp78_AST_in = (TNode)_t;
2732 match(_t,ID);
2733 _t = _t.getNextSibling();
2734 TNode tmp79_AST_in = (TNode)_t;
2735 match(_t,LCURLY);
2736 _t = _t.getNextSibling();
2737 }
2738 }
2739 catch (RecognitionException pe) {
2740 synPredMatched78 = false;
2741 }
2742 _t = __t78;
2743inputState.guessing--;
2744 }
2745 if ( synPredMatched78 ) {
2746 i = (TNode)_t;
2747 match(_t,ID);
2748 _t = _t.getNextSibling();
2749 TNode tmp80_AST_in = (TNode)_t;
2750 match(_t,LCURLY);
2751 _t = _t.getNextSibling();
2752 enumList(_t,(EnumType)(e = getEnumType(i.getText(), locusTag)));
2753 _t = _retTree;
2754 TNode tmp81_AST_in = (TNode)_t;
2755 match(_t,RCURLY);
2756 _t = _t.getNextSibling();
2757 }
2758 else if ((_t.getType()==LCURLY)) {
2759 TNode tmp82_AST_in = (TNode)_t;
2760 match(_t,LCURLY);
2761 _t = _t.getNextSibling();
2762 enumList(_t,(EnumType)(e = getEnumType(ANONYMOUS_ENUM_NAME, locusTag)));
2763 _t = _retTree;
2764 TNode tmp83_AST_in = (TNode)_t;
2765 match(_t,RCURLY);
2766 _t = _t.getNextSibling();
2767 }
2768 else if ((_t.getType()==ID)) {
2769 TNode tmp84_AST_in = (TNode)_t;
2770 match(_t,ID);
2771 _t = _t.getNextSibling();
2772 if ( inputState.guessing==0 ) {
2773 e = getEnumType(i.getText(), locusTag);
2774 }
2775 }
2776 else {
2777 throw new NoViableAltException(_t);
2778 }
2779
2780 }
2781 if ( inputState.guessing==0 ) {
2782
2783 debugPrintln("Adding enum mapping: "+getDebugTypeString(e));
2784 if( null != e ) {
2785 final String eName = e.getName();
2786 if( null != eName && !eName.equals(ANONYMOUS_ENUM_NAME) ) { // validate only non-anonymous enum
2787 final EnumType dupE = enumMap.get(eName);
2788 if( null != dupE && !dupE.equalSemantics(e) ) {
2789 throwGlueGenException(enumSpecifier_AST_in,
2790 String.format("Duplicate enum w/ incompatible type:%n this '%s',%n have '%s',%n %s: previous definition is here",
2791 getTypeString(e), getTypeString(dupE), dupE.getASTLocusTag().toString(new StringBuilder(), "note", true)));
2792 }
2793 enumMap.put(eName, (EnumType)e.clone(locusTag));
2794 }
2795 }
2796 t = e; // return val
2797
2798 }
2799 _t = __t75;
2800 _t = _t.getNextSibling();
2801 }
2802 catch (RecognitionException ex) {
2803 if (inputState.guessing==0) {
2804 reportError(ex);
2805 if (_t!=null) {_t = _t.getNextSibling();}
2806 } else {
2807 throw ex;
2808 }
2809 }
2810 _retTree = _t;
2811 return t;
2812 }
2813
2814 public final Type typedefName(AST _t,
2815 int cvAttrs
2816 ) throws RecognitionException {
2817 Type t;
2818
2819 TNode typedefName_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
2820 TNode id = null;
2821 t = null;
2822
2823 try { // for error handling
2824 AST __t47 = _t;
2825 TNode tmp85_AST_in = (TNode)_t;
2826 match(_t,NTypedefName);
2827 _t = _t.getFirstChild();
2828 id = (TNode)_t;
2829 match(_t,ID);
2830 _t = _t.getNextSibling();
2831 _t = __t47;
2832 _t = _t.getNextSibling();
2833 if ( inputState.guessing==0 ) {
2834
2835 final Type t0 = lookupInTypedefDictionary(typedefName_AST_in, id.getText());
2836 debugPrint("Adding typedef lookup: [" + id.getText() + "] -> "+getDebugTypeString(t0));
2837 final Type t1 = t0.newCVVariant(cvAttrs);
2838 debugPrintln(" - cvvar -> "+getDebugTypeString(t1));
2839 t = canonicalize(t1);
2840 debugPrintln(" - canon -> "+getDebugTypeString(t));
2841
2842 }
2843 }
2844 catch (RecognitionException ex) {
2845 if (inputState.guessing==0) {
2846 reportError(ex);
2847 if (_t!=null) {_t = _t.getNextSibling();}
2848 } else {
2849 throw ex;
2850 }
2851 }
2852 _retTree = _t;
2853 return t;
2854 }
2855
2856 public final void typeName(AST _t) throws RecognitionException {
2857
2858 TNode typeName_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
2859
2860 TypeBox tb = null;
2861
2862
2863 try { // for error handling
2865 _t = _retTree;
2866 {
2867 if (_t==null) _t=ASTNULL;
2868 switch ( _t.getType()) {
2870 {
2872 _t = _retTree;
2873 break;
2874 }
2875 case RPAREN:
2876 {
2877 break;
2878 }
2879 default:
2880 {
2881 throw new NoViableAltException(_t);
2882 }
2883 }
2884 }
2885 }
2886 catch (RecognitionException ex) {
2887 if (inputState.guessing==0) {
2888 reportError(ex);
2889 if (_t!=null) {_t = _t.getNextSibling();}
2890 } else {
2891 throw ex;
2892 }
2893 }
2894 _retTree = _t;
2895 }
2896
2897 public final CompoundType structOrUnionBody(AST _t,
2898 CompoundTypeKind kind, int cvAttrs
2899 ) throws RecognitionException {
2900 CompoundType t;
2901
2902 TNode structOrUnionBody_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
2903 TNode id = null;
2904 TNode id2 = null;
2905
2906 t = null;
2907 boolean addedAny = false;
2908 final ASTLocusTag locusTag = findASTLocusTag(structOrUnionBody_AST_in);
2909
2910
2911 try { // for error handling
2912 {
2913 boolean synPredMatched55 = false;
2914 if (_t==null) _t=ASTNULL;
2915 if (((_t.getType()==ID))) {
2916 AST __t55 = _t;
2917 synPredMatched55 = true;
2918 inputState.guessing++;
2919 try {
2920 {
2921 TNode tmp86_AST_in = (TNode)_t;
2922 match(_t,ID);
2923 _t = _t.getNextSibling();
2924 TNode tmp87_AST_in = (TNode)_t;
2925 match(_t,LCURLY);
2926 _t = _t.getNextSibling();
2927 }
2928 }
2929 catch (RecognitionException pe) {
2930 synPredMatched55 = false;
2931 }
2932 _t = __t55;
2933inputState.guessing--;
2934 }
2935 if ( synPredMatched55 ) {
2936 id = (TNode)_t;
2937 match(_t,ID);
2938 _t = _t.getNextSibling();
2939 TNode tmp88_AST_in = (TNode)_t;
2940 match(_t,LCURLY);
2941 _t = _t.getNextSibling();
2942 if ( inputState.guessing==0 ) {
2943
2944 // fully declared struct, i.e. not anonymous
2945 t = (CompoundType) canonicalize(lookupInStructDictionary(id.getText(), kind, cvAttrs, locusTag));
2946
2947 }
2948 {
2949 if (_t==null) _t=ASTNULL;
2950 switch ( _t.getType()) {
2951 case LITERAL_volatile:
2952 case LITERAL_struct:
2953 case LITERAL_union:
2954 case LITERAL_enum:
2955 case LITERAL_const:
2956 case LITERAL_void:
2957 case LITERAL_char:
2958 case LITERAL_short:
2959 case LITERAL_int:
2960 case LITERAL_long:
2961 case LITERAL_float:
2962 case LITERAL_double:
2963 case LITERAL_signed:
2964 case LITERAL_unsigned:
2965 case 27:
2966 case 28:
2967 case 29:
2968 case 30:
2969 case 31:
2970 case 32:
2971 case LITERAL_wchar_t:
2972 case 34:
2973 case 35:
2974 case 36:
2975 case 37:
2976 case LITERAL_ptrdiff_t:
2977 case LITERAL_intptr_t:
2978 case LITERAL_size_t:
2979 case LITERAL_uintptr_t:
2980 case NTypedefName:
2981 case LITERAL_typeof:
2982 case LITERAL___complex:
2983 {
2984 addedAny=structDeclarationList(_t,t);
2985 _t = _retTree;
2986 break;
2987 }
2988 case RCURLY:
2989 {
2990 break;
2991 }
2992 default:
2993 {
2994 throw new NoViableAltException(_t);
2995 }
2996 }
2997 }
2998 TNode tmp89_AST_in = (TNode)_t;
2999 match(_t,RCURLY);
3000 _t = _t.getNextSibling();
3001 if ( inputState.guessing==0 ) {
3002 t.setBodyParsed();
3003 }
3004 }
3005 else if ((_t.getType()==LCURLY)) {
3006 TNode tmp90_AST_in = (TNode)_t;
3007 match(_t,LCURLY);
3008 _t = _t.getNextSibling();
3009 if ( inputState.guessing==0 ) {
3010
3011 // anonymous declared struct
3012 t = CompoundType.create(null, null, kind, cvAttrs, locusTag);
3013
3014 }
3015 {
3016 if (_t==null) _t=ASTNULL;
3017 switch ( _t.getType()) {
3018 case LITERAL_volatile:
3019 case LITERAL_struct:
3020 case LITERAL_union:
3021 case LITERAL_enum:
3022 case LITERAL_const:
3023 case LITERAL_void:
3024 case LITERAL_char:
3025 case LITERAL_short:
3026 case LITERAL_int:
3027 case LITERAL_long:
3028 case LITERAL_float:
3029 case LITERAL_double:
3030 case LITERAL_signed:
3031 case LITERAL_unsigned:
3032 case 27:
3033 case 28:
3034 case 29:
3035 case 30:
3036 case 31:
3037 case 32:
3038 case LITERAL_wchar_t:
3039 case 34:
3040 case 35:
3041 case 36:
3042 case 37:
3043 case LITERAL_ptrdiff_t:
3044 case LITERAL_intptr_t:
3045 case LITERAL_size_t:
3046 case LITERAL_uintptr_t:
3047 case NTypedefName:
3048 case LITERAL_typeof:
3049 case LITERAL___complex:
3050 {
3052 _t = _retTree;
3053 break;
3054 }
3055 case RCURLY:
3056 {
3057 break;
3058 }
3059 default:
3060 {
3061 throw new NoViableAltException(_t);
3062 }
3063 }
3064 }
3065 TNode tmp91_AST_in = (TNode)_t;
3066 match(_t,RCURLY);
3067 _t = _t.getNextSibling();
3068 if ( inputState.guessing==0 ) {
3069 t.setBodyParsed();
3070 }
3071 }
3072 else if ((_t.getType()==ID)) {
3073 id2 = (TNode)_t;
3074 match(_t,ID);
3075 _t = _t.getNextSibling();
3076 if ( inputState.guessing==0 ) {
3077
3078 // anonymous struct
3079 t = (CompoundType) canonicalize(lookupInStructDictionary(id2.getText(), kind, cvAttrs, locusTag));
3080
3081 }
3082 }
3083 else {
3084 throw new NoViableAltException(_t);
3085 }
3086
3087 }
3088 if ( inputState.guessing==0 ) {
3089
3090 debugPrintln("Adding compound body: [" + t.getName() + "] -> "+getDebugTypeString(t)+" @ "+locusTag);
3091 debugPrintln(t.getStructString());
3092
3093 }
3094 }
3095 catch (RecognitionException ex) {
3096 if (inputState.guessing==0) {
3097 reportError(ex);
3098 if (_t!=null) {_t = _t.getNextSibling();}
3099 } else {
3100 throw ex;
3101 }
3102 }
3103 _retTree = _t;
3104 return t;
3105 }
3106
3107 public final boolean structDeclarationList(AST _t,
3108 CompoundType t
3109 ) throws RecognitionException {
3110 boolean addedAny;
3111
3112 TNode structDeclarationList_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
3113
3114 addedAny = false;
3115 boolean addedOne = false;
3116
3117
3118 try { // for error handling
3119 {
3120 int _cnt60=0;
3121 _loop60:
3122 do {
3123 if (_t==null) _t=ASTNULL;
3124 if ((_tokenSet_1.member(_t.getType()))) {
3125 addedOne=structDeclaration(_t,t);
3126 _t = _retTree;
3127 if ( inputState.guessing==0 ) {
3128 addedAny |= addedOne;
3129 }
3130 }
3131 else {
3132 if ( _cnt60>=1 ) { break _loop60; } else {throw new NoViableAltException(_t);}
3133 }
3134
3135 _cnt60++;
3136 } while (true);
3137 }
3138 }
3139 catch (RecognitionException ex) {
3140 if (inputState.guessing==0) {
3141 reportError(ex);
3142 if (_t!=null) {_t = _t.getNextSibling();}
3143 } else {
3144 throw ex;
3145 }
3146 }
3147 _retTree = _t;
3148 return addedAny;
3149 }
3150
3151 public final boolean structDeclaration(AST _t,
3152 CompoundType containingType
3153 ) throws RecognitionException {
3154 boolean addedAny;
3155
3156 TNode structDeclaration_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
3157
3158 addedAny = false;
3159 Type t = null;
3160
3161
3162 try { // for error handling
3164 _t = _retTree;
3165 addedAny=structDeclaratorList(_t,containingType, t);
3166 _t = _retTree;
3167 if ( inputState.guessing==0 ) {
3168
3169 if (!addedAny) {
3170 if (t != null) {
3171 CompoundType ct = t.asCompound();
3172 if( null == ct ) {
3173 throwGlueGenException(structDeclaration_AST_in,
3174 String.format("Anonymous compound, w/ NULL type:%n containing '%s'",
3175 getTypeString(containingType)));
3176 }
3177 if ( ct.isUnion() ) {
3178 // Anonymous union
3179 containingType.addField(new Field(null, t, null));
3180 }
3181 }
3182 }
3183
3184 }
3185 }
3186 catch (RecognitionException ex) {
3187 if (inputState.guessing==0) {
3188 reportError(ex);
3189 if (_t!=null) {_t = _t.getNextSibling();}
3190 } else {
3191 throw ex;
3192 }
3193 }
3194 _retTree = _t;
3195 return addedAny;
3196 }
3197
3198 public final Type specifierQualifierList(AST _t) throws RecognitionException {
3199 Type t;
3200
3201 TNode specifierQualifierList_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
3202
3203 t = null; int x = 0; int y = 0;
3204
3205
3206 try { // for error handling
3207 {
3208 int _cnt64=0;
3209 _loop64:
3210 do {
3211 if (_t==null) _t=ASTNULL;
3212 switch ( _t.getType()) {
3213 case LITERAL_struct:
3214 case LITERAL_union:
3215 case LITERAL_enum:
3216 case LITERAL_void:
3217 case LITERAL_char:
3218 case LITERAL_short:
3219 case LITERAL_int:
3220 case LITERAL_long:
3221 case LITERAL_float:
3222 case LITERAL_double:
3223 case 27:
3224 case 28:
3225 case 29:
3226 case 30:
3227 case 31:
3228 case 32:
3229 case LITERAL_wchar_t:
3230 case 34:
3231 case 35:
3232 case 36:
3233 case 37:
3234 case LITERAL_ptrdiff_t:
3235 case LITERAL_intptr_t:
3236 case LITERAL_size_t:
3237 case LITERAL_uintptr_t:
3238 case NTypedefName:
3239 case LITERAL_typeof:
3240 case LITERAL___complex:
3241 {
3242 t=typeSpecifier(_t,x);
3243 _t = _retTree;
3244 break;
3245 }
3246 case LITERAL_volatile:
3247 case LITERAL_const:
3248 case LITERAL_signed:
3249 case LITERAL_unsigned:
3250 {
3251 y=typeQualifier(_t);
3252 _t = _retTree;
3253 if ( inputState.guessing==0 ) {
3254 x |= y;
3255 }
3256 break;
3257 }
3258 default:
3259 {
3260 if ( _cnt64>=1 ) { break _loop64; } else {throw new NoViableAltException(_t);}
3261 }
3262 }
3263 _cnt64++;
3264 } while (true);
3265 }
3266 if ( inputState.guessing==0 ) {
3267
3268 if (t == null &&
3269 (x & (SIGNED | UNSIGNED)) != 0) {
3270 t = new IntType("int", SizeThunk.INTxx, ((x & UNSIGNED) != 0), attrs2CVAttrs(x),
3271 findASTLocusTag(specifierQualifierList_AST_in));
3272 }
3273
3274 }
3275 }
3276 catch (RecognitionException ex) {
3277 if (inputState.guessing==0) {
3278 reportError(ex);
3279 if (_t!=null) {_t = _t.getNextSibling();}
3280 } else {
3281 throw ex;
3282 }
3283 }
3284 _retTree = _t;
3285 return t;
3286 }
3287
3288 public final boolean structDeclaratorList(AST _t,
3289 CompoundType containingType, Type t
3290 ) throws RecognitionException {
3291 boolean addedAny;
3292
3293 TNode structDeclaratorList_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
3294
3295 addedAny = false;
3296 boolean y = false;
3297
3298
3299 try { // for error handling
3300 {
3301 int _cnt67=0;
3302 _loop67:
3303 do {
3304 if (_t==null) _t=ASTNULL;
3305 if ((_t.getType()==NStructDeclarator)) {
3306 y=structDeclarator(_t,containingType, t);
3307 _t = _retTree;
3308 if ( inputState.guessing==0 ) {
3309 addedAny = y;
3310 }
3311 }
3312 else {
3313 if ( _cnt67>=1 ) { break _loop67; } else {throw new NoViableAltException(_t);}
3314 }
3315
3316 _cnt67++;
3317 } while (true);
3318 }
3319 }
3320 catch (RecognitionException ex) {
3321 if (inputState.guessing==0) {
3322 reportError(ex);
3323 if (_t!=null) {_t = _t.getNextSibling();}
3324 } else {
3325 throw ex;
3326 }
3327 }
3328 _retTree = _t;
3329 return addedAny;
3330 }
3331
3332 public final boolean structDeclarator(AST _t,
3333 CompoundType containingType, Type t
3334 ) throws RecognitionException {
3335 boolean addedAny;
3336
3337 TNode structDeclarator_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
3338
3339 addedAny = false;
3340 String s = null;
3341 TypeBox tb = new TypeBox(t);
3342
3343
3344 try { // for error handling
3345 AST __t69 = _t;
3346 TNode tmp92_AST_in = (TNode)_t;
3347 match(_t,NStructDeclarator);
3348 _t = _t.getFirstChild();
3349 {
3350 if (_t==null) _t=ASTNULL;
3351 switch ( _t.getType()) {
3352 case NDeclarator:
3353 {
3354 s=declarator(_t,tb);
3355 _t = _retTree;
3356 if ( inputState.guessing==0 ) {
3357 containingType.addField(new Field(s, tb.type(), null)); addedAny = true;
3358 }
3359 break;
3360 }
3361 case 3:
3362 case COLON:
3363 case NAsmAttribute:
3365 {
3366 break;
3367 }
3368 default:
3369 {
3370 throw new NoViableAltException(_t);
3371 }
3372 }
3373 }
3374 {
3375 if (_t==null) _t=ASTNULL;
3376 switch ( _t.getType()) {
3377 case COLON:
3378 {
3379 TNode tmp93_AST_in = (TNode)_t;
3380 match(_t,COLON);
3381 _t = _t.getNextSibling();
3382 expr(_t);
3383 _t = _retTree;
3384 if ( inputState.guessing==0 ) {
3385 /* FIXME: bit types not handled yet */
3386 }
3387 break;
3388 }
3389 case 3:
3390 case NAsmAttribute:
3392 {
3393 break;
3394 }
3395 default:
3396 {
3397 throw new NoViableAltException(_t);
3398 }
3399 }
3400 }
3401 {
3402 _loop73:
3403 do {
3404 if (_t==null) _t=ASTNULL;
3405 if ((_t.getType()==NAsmAttribute||_t.getType()==LITERAL___attribute)) {
3406 attributeDecl(_t);
3407 _t = _retTree;
3408 }
3409 else {
3410 break _loop73;
3411 }
3412
3413 } while (true);
3414 }
3415 _t = __t69;
3416 _t = _t.getNextSibling();
3417 }
3418 catch (RecognitionException ex) {
3419 if (inputState.guessing==0) {
3420 reportError(ex);
3421 if (_t!=null) {_t = _t.getNextSibling();}
3422 } else {
3423 throw ex;
3424 }
3425 }
3426 _retTree = _t;
3427 return addedAny;
3428 }
3429
3430 public final void enumList(AST _t,
3431 EnumType enumeration
3432 ) throws RecognitionException {
3433
3434 TNode enumList_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
3435
3436 ConstantDefinition defEnumerant = new ConstantDefinition("def", "0", new CNumber(true, false, 0), findASTLocusTag(enumList_AST_in));
3437
3438
3439 try { // for error handling
3440 {
3441 int _cnt81=0;
3442 _loop81:
3443 do {
3444 if (_t==null) _t=ASTNULL;
3445 if ((_t.getType()==ID)) {
3446 defEnumerant=enumerator(_t,enumeration, defEnumerant);
3447 _t = _retTree;
3448 }
3449 else {
3450 if ( _cnt81>=1 ) { break _loop81; } else {throw new NoViableAltException(_t);}
3451 }
3452
3453 _cnt81++;
3454 } while (true);
3455 }
3456 }
3457 catch (RecognitionException ex) {
3458 if (inputState.guessing==0) {
3459 reportError(ex);
3460 if (_t!=null) {_t = _t.getNextSibling();}
3461 } else {
3462 throw ex;
3463 }
3464 }
3465 _retTree = _t;
3466 }
3467
3468 public final ConstantDefinition enumerator(AST _t,
3469 EnumType enumeration, ConstantDefinition defaultValue
3470 ) throws RecognitionException {
3471 ConstantDefinition newDefaultValue;
3472
3473 TNode enumerator_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
3474 TNode eName = null;
3475 TNode eVal = null;
3476
3477 newDefaultValue = defaultValue;
3478
3479
3480 try { // for error handling
3481 eName = (TNode)_t;
3482 match(_t,ID);
3483 _t = _t.getNextSibling();
3484 {
3485 if (_t==null) _t=ASTNULL;
3486 switch ( _t.getType()) {
3487 case ASSIGN:
3488 {
3489 TNode tmp94_AST_in = (TNode)_t;
3490 match(_t,ASSIGN);
3491 _t = _t.getNextSibling();
3492 eVal = _t==ASTNULL ? null : (TNode)_t;
3493 expr(_t);
3494 _t = _retTree;
3495 break;
3496 }
3497 case RCURLY:
3498 case ID:
3499 {
3500 break;
3501 }
3502 default:
3503 {
3504 throw new NoViableAltException(_t);
3505 }
3506 }
3507 }
3508 if ( inputState.guessing==0 ) {
3509
3510 final String eTxt = eName.getText();
3511 final Enumerator newEnum;
3512 if (eVal != null) {
3513 String vTxt = eVal.getAllChildrenText(eTxt);
3514 if (enumHash.containsKey(vTxt)) {
3515 EnumType oldEnumType = enumHash.get(vTxt);
3516 Enumerator oldEnum = oldEnumType.getEnum(vTxt);
3517 newEnum = oldEnum;
3518 } else {
3519 newEnum = new Enumerator(eTxt, vTxt);
3520 }
3521 } else if( defaultValue.hasNumber() ) {
3522 newEnum = new Enumerator(eTxt, defaultValue.getNumber());
3523 } else {
3524 newEnum = new Enumerator(eTxt, defaultValue.getNativeExpr());
3525 }
3526 final ASTLocusTag locus = findASTLocusTag(enumerator_AST_in);
3527 final CNumber newEnumNum = newEnum.getNumber();
3528 if( null != newEnumNum && newEnumNum.isInteger ) {
3529 final long n = newEnumNum.i+1;
3530 newDefaultValue = new ConstantDefinition("def", String.valueOf(n), new CNumber(newEnumNum.isLong, newEnumNum.isUnsigned, n), locus);
3531 } else {
3532 newDefaultValue = new ConstantDefinition("def", "("+newEnum.getExpr()+")+1", null, locus);
3533 }
3534 if (enumHash.containsKey(eTxt)) {
3535 EnumType oldEnumType = enumHash.get(eTxt);
3536 final Enumerator oldEnum = oldEnumType.getEnum(eTxt);
3537 final String oldExpr = oldEnum.getExpr();
3538 if( !oldExpr.equals(newEnum.getExpr()) ) {
3539 throwGlueGenException(enumerator_AST_in,
3540 String.format("Duplicate enum value '%s.%s' w/ diff value:%n this %s,%n have %s",
3541 oldEnumType.getName(), eTxt, newEnum, oldEnum));
3542 }
3543 // remove old definition
3544 oldEnumType.removeEnumerate(eTxt);
3545 }
3546 // insert new definition
3547 enumeration.addEnum(eTxt, newEnum);
3548 enumHash.put(eTxt, enumeration);
3549 debugPrintln("ENUM [" + enumeration.getName() + "]: " + eTxt + " = " + newEnum +
3550 " (new default = " + newDefaultValue + ")");
3551
3552 }
3553 }
3554 catch (RecognitionException ex) {
3555 if (inputState.guessing==0) {
3556 reportError(ex);
3557 if (_t!=null) {_t = _t.getNextSibling();}
3558 } else {
3559 throw ex;
3560 }
3561 }
3562 _retTree = _t;
3563 return newDefaultValue;
3564 }
3565
3566 public final void initDecl(AST _t,
3567 TypeBox tb
3568 ) throws RecognitionException {
3569
3570 TNode initDecl_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
3571
3572 String declName = null;
3573 final ASTLocusTag locusTag = findASTLocusTag(initDecl_AST_in);
3574
3575
3576 try { // for error handling
3577 AST __t88 = _t;
3578 TNode tmp95_AST_in = (TNode)_t;
3579 match(_t,NInitDecl);
3580 _t = _t.getFirstChild();
3581 declName=declarator(_t,tb);
3582 _t = _retTree;
3583 if ( inputState.guessing==0 ) {
3584
3585 debugPrintln("GOT declName: " + declName + " TB=" + tb);
3586
3587 }
3588 {
3589 _loop90:
3590 do {
3591 if (_t==null) _t=ASTNULL;
3592 if ((_t.getType()==NAsmAttribute||_t.getType()==LITERAL___attribute)) {
3593 attributeDecl(_t);
3594 _t = _retTree;
3595 }
3596 else {
3597 break _loop90;
3598 }
3599
3600 } while (true);
3601 }
3602 {
3603 if (_t==null) _t=ASTNULL;
3604 switch ( _t.getType()) {
3605 case ASSIGN:
3606 {
3607 TNode tmp96_AST_in = (TNode)_t;
3608 match(_t,ASSIGN);
3609 _t = _t.getNextSibling();
3610 initializer(_t);
3611 _t = _retTree;
3612 break;
3613 }
3614 case COLON:
3615 {
3616 TNode tmp97_AST_in = (TNode)_t;
3617 match(_t,COLON);
3618 _t = _t.getNextSibling();
3619 expr(_t);
3620 _t = _retTree;
3621 break;
3622 }
3623 case 3:
3624 {
3625 break;
3626 }
3627 default:
3628 {
3629 throw new NoViableAltException(_t);
3630 }
3631 }
3632 }
3633 _t = __t88;
3634 _t = _t.getNextSibling();
3635 if ( inputState.guessing==0 ) {
3636
3637 if ((declName != null) && (tb != null) && tb.isTypedef()) {
3638 Type t = tb.type();
3639 debugPrintln("Adding typedef mapping: [" + declName + "] -> "+getDebugTypeString(t));
3640 final Type tg;
3641 if( t.isPointer() ) {
3642 tg = t.getTargetType();
3643 debugPrintln(" - has target: "+getDebugTypeString(tg));
3644 } else {
3645 tg = null;
3646 }
3647 // NOTE: Struct Name Resolution (JavaEmitter, HeaderParser)
3648 // Also see NOTE below.
3649 if (!t.isTypedef()) {
3650 if( t.isCompound() || t.isEnum() ) {
3651 // This aliases '_a' -> 'A' for 'typedef struct _a { } A;' in-place
3652 // This aliases '_a' -> 'A' for 'typedef enum _a { } A;' in-place
3653 t.setTypedefName(declName);
3654 debugPrintln(" - alias.11 -> "+getDebugTypeString(t));
3655 } else {
3656 // Use new typedef, using a copy to preserve canonicalized base type
3657 t = t.clone(locusTag);
3658 t.setTypedefName(declName);
3659 debugPrintln(" - newdefine.12 -> "+getDebugTypeString(t));
3660 }
3661 } else {
3662 // Adds typeInfo alias w/ t's typeInfo, if exists
3663 cfg.addTypeInfo(declName, t);
3664 final Type alias;
3665 if( t.isCompound() ) {
3666 // This aliases 'D' -> 'A' for 'typedef struct _a { } A, D;' in-place
3667 debugPrintln(" - alias.21 -> "+getDebugTypeString(t));
3668 } else {
3669 // copy to preserve canonicalized base type
3670 t = t.clone(locusTag);
3671 t.setTypedefName(declName);
3672 debugPrintln(" - copy.22 -> "+getDebugTypeString(t));
3673 }
3674 }
3675 final Type dupT = typedefDictionary.get(declName);
3676 if( null != dupT && !dupT.equalSemantics(t) ) {
3677 throwGlueGenException(locusTag,
3678 String.format("Duplicate typedef w/ incompatible type:%n this '%s',%n have '%s',%n %s: previous definition is here",
3679 getTypeString(t), getTypeString(dupT), dupT.getASTLocusTag().toString(new StringBuilder(), "note", true)));
3680 }
3681 t = canonicalize(t);
3682 debugPrintln(" - canon -> "+getDebugTypeString(t));
3683 typedefDictionary.put(declName, t);
3684 // Clear out PointerGroup effects in case another typedef variant follows
3685 tb.reset();
3686 }
3687
3688 }
3689 }
3690 catch (RecognitionException ex) {
3691 if (inputState.guessing==0) {
3692 reportError(ex);
3693 if (_t!=null) {_t = _t.getNextSibling();}
3694 } else {
3695 throw ex;
3696 }
3697 }
3698 _retTree = _t;
3699 }
3700
3701 public final void initializer(AST _t) throws RecognitionException {
3702
3703 TNode initializer_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
3704
3705 try { // for error handling
3706 if (_t==null) _t=ASTNULL;
3707 switch ( _t.getType()) {
3708 case NInitializer:
3709 {
3710 AST __t139 = _t;
3711 TNode tmp98_AST_in = (TNode)_t;
3712 match(_t,NInitializer);
3713 _t = _t.getFirstChild();
3714 {
3715 if (_t==null) _t=ASTNULL;
3716 switch ( _t.getType()) {
3718 {
3720 _t = _retTree;
3721 break;
3722 }
3723 case ID:
3724 case ASSIGN:
3725 case STAR:
3726 case LPAREN:
3727 case DIV_ASSIGN:
3728 case PLUS_ASSIGN:
3729 case MINUS_ASSIGN:
3730 case STAR_ASSIGN:
3731 case MOD_ASSIGN:
3732 case RSHIFT_ASSIGN:
3733 case LSHIFT_ASSIGN:
3734 case BAND_ASSIGN:
3735 case BOR_ASSIGN:
3736 case BXOR_ASSIGN:
3737 case QUESTION:
3738 case LOR:
3739 case LAND:
3740 case BOR:
3741 case BXOR:
3742 case BAND:
3743 case EQUAL:
3744 case NOT_EQUAL:
3745 case LT:
3746 case LTE:
3747 case GT:
3748 case GTE:
3749 case LSHIFT:
3750 case RSHIFT:
3751 case PLUS:
3752 case MINUS:
3753 case DIV:
3754 case MOD:
3755 case INC:
3756 case DEC:
3757 case LITERAL_sizeof:
3758 case CharLiteral:
3759 case NCast:
3760 case NExpressionGroup:
3761 case NInitializer:
3762 case NEmptyExpression:
3763 case NCommaExpr:
3764 case NUnaryExpr:
3765 case NPostfixExpr:
3766 case NRangeExpr:
3767 case NStringSeq:
3768 case NLcurlyInitializer:
3769 case NGnuAsmExpr:
3770 case Number:
3771 case LITERAL___alignof:
3772 {
3773 break;
3774 }
3775 default:
3776 {
3777 throw new NoViableAltException(_t);
3778 }
3779 }
3780 }
3781 expr(_t);
3782 _t = _retTree;
3783 _t = __t139;
3784 _t = _t.getNextSibling();
3785 break;
3786 }
3787 case NLcurlyInitializer:
3788 {
3790 _t = _retTree;
3791 break;
3792 }
3793 default:
3794 {
3795 throw new NoViableAltException(_t);
3796 }
3797 }
3798 }
3799 catch (RecognitionException ex) {
3800 if (inputState.guessing==0) {
3801 reportError(ex);
3802 if (_t!=null) {_t = _t.getNextSibling();}
3803 } else {
3804 throw ex;
3805 }
3806 }
3807 _retTree = _t;
3808 }
3809
3810 public final int intConstExpr(AST _t) throws RecognitionException {
3811 int i;
3812
3813 TNode intConstExpr_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
3814 TNode n = null;
3815 TNode e = null;
3816 i = -1;
3817
3818 try { // for error handling
3819 if (_t==null) _t=ASTNULL;
3820 switch ( _t.getType()) {
3821 case Number:
3822 {
3823 n = (TNode)_t;
3824 match(_t,Number);
3825 _t = _t.getNextSibling();
3826 if ( inputState.guessing==0 ) {
3827 return Integer.parseInt(n.getText());
3828 }
3829 break;
3830 }
3831 case ID:
3832 {
3833 e = (TNode)_t;
3834 match(_t,ID);
3835 _t = _t.getNextSibling();
3836 if ( inputState.guessing==0 ) {
3837
3838 final String enumName = e.getText();
3839 final EnumType enumType = enumHash.get(enumName);
3840 if( null == enumType ) {
3841 throwGlueGenException(intConstExpr_AST_in,
3842 "Error: intConstExpr ID "+enumName+" recognized, but no containing enum-type found");
3843 }
3844 final Enumerator enumerator = enumType.getEnum(enumName);
3845 final CNumber number = enumerator.getNumber();
3846 if( null != number && number.isInteger && !number.isLong ) {
3847 debugPrintln("INFO: intConstExpr: enum[Type "+enumType.getName()+", "+enumerator+"]");
3848 } else {
3849 throwGlueGenException(intConstExpr_AST_in,
3850 "Error: intConstExpr ID "+enumName+" enum "+enumerator+" not an int32_t");
3851 }
3852 return (int)number.i;
3853
3854 }
3855 break;
3856 }
3857 default:
3858 {
3859 throw new NoViableAltException(_t);
3860 }
3861 }
3862 }
3863 catch (RecognitionException ex) {
3864 if (inputState.guessing==0) {
3865 reportError(ex);
3866 if (_t!=null) {_t = _t.getNextSibling();}
3867 } else {
3868 throw ex;
3869 }
3870 }
3871 _retTree = _t;
3872 return i;
3873 }
3874
3875 public final void translationUnit(AST _t) throws RecognitionException {
3876
3877 TNode translationUnit_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
3878
3879 {
3880 if (_t==null) _t=ASTNULL;
3881 switch ( _t.getType()) {
3882 case LITERAL_asm:
3883 case SEMI:
3884 case NDeclaration:
3885 case NFunctionDef:
3886 case NTypeMissing:
3887 {
3888 externalList(_t);
3889 _t = _retTree;
3890 break;
3891 }
3892 case 3:
3893 {
3894 break;
3895 }
3896 default:
3897 {
3898 throw new NoViableAltException(_t);
3899 }
3900 }
3901 }
3902 _retTree = _t;
3903 }
3904
3905 public final void externalList(AST _t) throws RecognitionException {
3906
3907 TNode externalList_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
3908
3909 try { // for error handling
3910 {
3911 int _cnt123=0;
3912 _loop123:
3913 do {
3914 if (_t==null) _t=ASTNULL;
3915 if ((_tokenSet_2.member(_t.getType()))) {
3916 externalDef(_t);
3917 _t = _retTree;
3918 }
3919 else {
3920 if ( _cnt123>=1 ) { break _loop123; } else {throw new NoViableAltException(_t);}
3921 }
3922
3923 _cnt123++;
3924 } while (true);
3925 }
3926 }
3927 catch (RecognitionException ex) {
3928 if (inputState.guessing==0) {
3929 reportError(ex);
3930 if (_t!=null) {_t = _t.getNextSibling();}
3931 } else {
3932 throw ex;
3933 }
3934 }
3935 _retTree = _t;
3936 }
3937
3938 public final void externalDef(AST _t) throws RecognitionException {
3939
3940 TNode externalDef_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
3941
3942 try { // for error handling
3943 if (_t==null) _t=ASTNULL;
3944 switch ( _t.getType()) {
3945 case NDeclaration:
3946 {
3947 declaration(_t);
3948 _t = _retTree;
3949 break;
3950 }
3951 case NFunctionDef:
3952 {
3953 functionDef(_t);
3954 _t = _retTree;
3955 break;
3956 }
3957 case LITERAL_asm:
3958 {
3959 asm_expr(_t);
3960 _t = _retTree;
3961 break;
3962 }
3963 case SEMI:
3964 {
3965 TNode tmp99_AST_in = (TNode)_t;
3966 match(_t,SEMI);
3967 _t = _t.getNextSibling();
3968 break;
3969 }
3970 case NTypeMissing:
3971 {
3973 _t = _retTree;
3974 break;
3975 }
3976 default:
3977 {
3978 throw new NoViableAltException(_t);
3979 }
3980 }
3981 }
3982 catch (RecognitionException ex) {
3983 if (inputState.guessing==0) {
3984 reportError(ex);
3985 if (_t!=null) {_t = _t.getNextSibling();}
3986 } else {
3987 throw ex;
3988 }
3989 }
3990 _retTree = _t;
3991 }
3992
3993 public final void asm_expr(AST _t) throws RecognitionException {
3994
3995 TNode asm_expr_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
3996
3997 try { // for error handling
3998 AST __t126 = _t;
3999 TNode tmp100_AST_in = (TNode)_t;
4000 match(_t,LITERAL_asm);
4001 _t = _t.getFirstChild();
4002 {
4003 if (_t==null) _t=ASTNULL;
4004 switch ( _t.getType()) {
4005 case LITERAL_volatile:
4006 {
4007 TNode tmp101_AST_in = (TNode)_t;
4008 match(_t,LITERAL_volatile);
4009 _t = _t.getNextSibling();
4010 break;
4011 }
4012 case LCURLY:
4013 {
4014 break;
4015 }
4016 default:
4017 {
4018 throw new NoViableAltException(_t);
4019 }
4020 }
4021 }
4022 TNode tmp102_AST_in = (TNode)_t;
4023 match(_t,LCURLY);
4024 _t = _t.getNextSibling();
4025 expr(_t);
4026 _t = _retTree;
4027 TNode tmp103_AST_in = (TNode)_t;
4028 match(_t,RCURLY);
4029 _t = _t.getNextSibling();
4030 {
4031 int _cnt129=0;
4032 _loop129:
4033 do {
4034 if (_t==null) _t=ASTNULL;
4035 if ((_t.getType()==SEMI)) {
4036 TNode tmp104_AST_in = (TNode)_t;
4037 match(_t,SEMI);
4038 _t = _t.getNextSibling();
4039 }
4040 else {
4041 if ( _cnt129>=1 ) { break _loop129; } else {throw new NoViableAltException(_t);}
4042 }
4043
4044 _cnt129++;
4045 } while (true);
4046 }
4047 _t = __t126;
4048 _t = _t.getNextSibling();
4049 }
4050 catch (RecognitionException ex) {
4051 if (inputState.guessing==0) {
4052 reportError(ex);
4053 if (_t!=null) {_t = _t.getNextSibling();}
4054 } else {
4055 throw ex;
4056 }
4057 }
4058 _retTree = _t;
4059 }
4060
4061 public final void initializerElementLabel(AST _t) throws RecognitionException {
4062
4063 TNode initializerElementLabel_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
4064
4065 try { // for error handling
4066 AST __t142 = _t;
4067 TNode tmp105_AST_in = (TNode)_t;
4068 match(_t,NInitializerElementLabel);
4069 _t = _t.getFirstChild();
4070 {
4071 if (_t==null) _t=ASTNULL;
4072 switch ( _t.getType()) {
4073 case LBRACKET:
4074 {
4075 {
4076 TNode tmp106_AST_in = (TNode)_t;
4077 match(_t,LBRACKET);
4078 _t = _t.getNextSibling();
4079 expr(_t);
4080 _t = _retTree;
4081 TNode tmp107_AST_in = (TNode)_t;
4082 match(_t,RBRACKET);
4083 _t = _t.getNextSibling();
4084 {
4085 if (_t==null) _t=ASTNULL;
4086 switch ( _t.getType()) {
4087 case ASSIGN:
4088 {
4089 TNode tmp108_AST_in = (TNode)_t;
4090 match(_t,ASSIGN);
4091 _t = _t.getNextSibling();
4092 break;
4093 }
4094 case 3:
4095 {
4096 break;
4097 }
4098 default:
4099 {
4100 throw new NoViableAltException(_t);
4101 }
4102 }
4103 }
4104 }
4105 break;
4106 }
4107 case ID:
4108 {
4109 TNode tmp109_AST_in = (TNode)_t;
4110 match(_t,ID);
4111 _t = _t.getNextSibling();
4112 TNode tmp110_AST_in = (TNode)_t;
4113 match(_t,COLON);
4114 _t = _t.getNextSibling();
4115 break;
4116 }
4117 case DOT:
4118 {
4119 TNode tmp111_AST_in = (TNode)_t;
4120 match(_t,DOT);
4121 _t = _t.getNextSibling();
4122 TNode tmp112_AST_in = (TNode)_t;
4123 match(_t,ID);
4124 _t = _t.getNextSibling();
4125 TNode tmp113_AST_in = (TNode)_t;
4126 match(_t,ASSIGN);
4127 _t = _t.getNextSibling();
4128 break;
4129 }
4130 default:
4131 {
4132 throw new NoViableAltException(_t);
4133 }
4134 }
4135 }
4136 _t = __t142;
4137 _t = _t.getNextSibling();
4138 }
4139 catch (RecognitionException ex) {
4140 if (inputState.guessing==0) {
4141 reportError(ex);
4142 if (_t!=null) {_t = _t.getNextSibling();}
4143 } else {
4144 throw ex;
4145 }
4146 }
4147 _retTree = _t;
4148 }
4149
4150 public final void lcurlyInitializer(AST _t) throws RecognitionException {
4151
4152 TNode lcurlyInitializer_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
4153
4154 try { // for error handling
4155 AST __t147 = _t;
4156 TNode tmp114_AST_in = (TNode)_t;
4157 match(_t,NLcurlyInitializer);
4158 _t = _t.getFirstChild();
4159 initializerList(_t);
4160 _t = _retTree;
4161 TNode tmp115_AST_in = (TNode)_t;
4162 match(_t,RCURLY);
4163 _t = _t.getNextSibling();
4164 _t = __t147;
4165 _t = _t.getNextSibling();
4166 }
4167 catch (RecognitionException ex) {
4168 if (inputState.guessing==0) {
4169 reportError(ex);
4170 if (_t!=null) {_t = _t.getNextSibling();}
4171 } else {
4172 throw ex;
4173 }
4174 }
4175 _retTree = _t;
4176 }
4177
4178 public final void initializerList(AST _t) throws RecognitionException {
4179
4180 TNode initializerList_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
4181
4182 try { // for error handling
4183 {
4184 _loop150:
4185 do {
4186 if (_t==null) _t=ASTNULL;
4187 if ((_t.getType()==NInitializer||_t.getType()==NLcurlyInitializer)) {
4188 initializer(_t);
4189 _t = _retTree;
4190 }
4191 else {
4192 break _loop150;
4193 }
4194
4195 } while (true);
4196 }
4197 }
4198 catch (RecognitionException ex) {
4199 if (inputState.guessing==0) {
4200 reportError(ex);
4201 if (_t!=null) {_t = _t.getNextSibling();}
4202 } else {
4203 throw ex;
4204 }
4205 }
4206 _retTree = _t;
4207 }
4208
4209 public final void declarationList(AST _t) throws RecognitionException {
4210
4211 TNode declarationList_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
4212
4213 try { // for error handling
4214 {
4215 int _cnt153=0;
4216 _loop153:
4217 do {
4218 if (_t==null) _t=ASTNULL;
4219 if ((_t.getType()==LITERAL___label__)) {
4220 localLabelDecl(_t);
4221 _t = _retTree;
4222 }
4223 else if ((_t.getType()==NDeclaration)) {
4224 declaration(_t);
4225 _t = _retTree;
4226 }
4227 else {
4228 if ( _cnt153>=1 ) { break _loop153; } else {throw new NoViableAltException(_t);}
4229 }
4230
4231 _cnt153++;
4232 } while (true);
4233 }
4234 }
4235 catch (RecognitionException ex) {
4236 if (inputState.guessing==0) {
4237 reportError(ex);
4238 if (_t!=null) {_t = _t.getNextSibling();}
4239 } else {
4240 throw ex;
4241 }
4242 }
4243 _retTree = _t;
4244 }
4245
4246 public final void localLabelDecl(AST _t) throws RecognitionException {
4247
4248 TNode localLabelDecl_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
4249
4250 try { // for error handling
4251 AST __t155 = _t;
4252 TNode tmp116_AST_in = (TNode)_t;
4253 match(_t,LITERAL___label__);
4254 _t = _t.getFirstChild();
4255 {
4256 int _cnt157=0;
4257 _loop157:
4258 do {
4259 if (_t==null) _t=ASTNULL;
4260 if ((_t.getType()==ID)) {
4261 TNode tmp117_AST_in = (TNode)_t;
4262 match(_t,ID);
4263 _t = _t.getNextSibling();
4264 }
4265 else {
4266 if ( _cnt157>=1 ) { break _loop157; } else {throw new NoViableAltException(_t);}
4267 }
4268
4269 _cnt157++;
4270 } while (true);
4271 }
4272 _t = __t155;
4273 _t = _t.getNextSibling();
4274 }
4275 catch (RecognitionException ex) {
4276 if (inputState.guessing==0) {
4277 reportError(ex);
4278 if (_t!=null) {_t = _t.getNextSibling();}
4279 } else {
4280 throw ex;
4281 }
4282 }
4283 _retTree = _t;
4284 }
4285
4286 public final void statementList(AST _t) throws RecognitionException {
4287
4288 TNode statementList_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
4289
4290 try { // for error handling
4291 {
4292 int _cnt165=0;
4293 _loop165:
4294 do {
4295 if (_t==null) _t=ASTNULL;
4296 if ((_tokenSet_3.member(_t.getType()))) {
4297 statement(_t);
4298 _t = _retTree;
4299 }
4300 else {
4301 if ( _cnt165>=1 ) { break _loop165; } else {throw new NoViableAltException(_t);}
4302 }
4303
4304 _cnt165++;
4305 } while (true);
4306 }
4307 }
4308 catch (RecognitionException ex) {
4309 if (inputState.guessing==0) {
4310 reportError(ex);
4311 if (_t!=null) {_t = _t.getNextSibling();}
4312 } else {
4313 throw ex;
4314 }
4315 }
4316 _retTree = _t;
4317 }
4318
4319 public final void statement(AST _t) throws RecognitionException {
4320
4321 TNode statement_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
4322
4323 try { // for error handling
4324 statementBody(_t);
4325 _t = _retTree;
4326 }
4327 catch (RecognitionException ex) {
4328 if (inputState.guessing==0) {
4329 reportError(ex);
4330 if (_t!=null) {_t = _t.getNextSibling();}
4331 } else {
4332 throw ex;
4333 }
4334 }
4335 _retTree = _t;
4336 }
4337
4338 public final void statementBody(AST _t) throws RecognitionException {
4339
4340 TNode statementBody_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
4341
4342 try { // for error handling
4343 if (_t==null) _t=ASTNULL;
4344 switch ( _t.getType()) {
4345 case SEMI:
4346 {
4347 TNode tmp118_AST_in = (TNode)_t;
4348 match(_t,SEMI);
4349 _t = _t.getNextSibling();
4350 break;
4351 }
4352 case NCompoundStatement:
4353 {
4355 _t = _retTree;
4356 break;
4357 }
4358 case NStatementExpr:
4359 {
4360 AST __t168 = _t;
4361 TNode tmp119_AST_in = (TNode)_t;
4362 match(_t,NStatementExpr);
4363 _t = _t.getFirstChild();
4364 expr(_t);
4365 _t = _retTree;
4366 _t = __t168;
4367 _t = _t.getNextSibling();
4368 break;
4369 }
4370 case LITERAL_while:
4371 {
4372 AST __t169 = _t;
4373 TNode tmp120_AST_in = (TNode)_t;
4374 match(_t,LITERAL_while);
4375 _t = _t.getFirstChild();
4376 expr(_t);
4377 _t = _retTree;
4378 statement(_t);
4379 _t = _retTree;
4380 _t = __t169;
4381 _t = _t.getNextSibling();
4382 break;
4383 }
4384 case LITERAL_do:
4385 {
4386 AST __t170 = _t;
4387 TNode tmp121_AST_in = (TNode)_t;
4388 match(_t,LITERAL_do);
4389 _t = _t.getFirstChild();
4390 statement(_t);
4391 _t = _retTree;
4392 expr(_t);
4393 _t = _retTree;
4394 _t = __t170;
4395 _t = _t.getNextSibling();
4396 break;
4397 }
4398 case LITERAL_for:
4399 {
4400 AST __t171 = _t;
4401 TNode tmp122_AST_in = (TNode)_t;
4402 match(_t,LITERAL_for);
4403 _t = _t.getFirstChild();
4404 expr(_t);
4405 _t = _retTree;
4406 expr(_t);
4407 _t = _retTree;
4408 expr(_t);
4409 _t = _retTree;
4410 statement(_t);
4411 _t = _retTree;
4412 _t = __t171;
4413 _t = _t.getNextSibling();
4414 break;
4415 }
4416 case LITERAL_goto:
4417 {
4418 AST __t172 = _t;
4419 TNode tmp123_AST_in = (TNode)_t;
4420 match(_t,LITERAL_goto);
4421 _t = _t.getFirstChild();
4422 expr(_t);
4423 _t = _retTree;
4424 _t = __t172;
4425 _t = _t.getNextSibling();
4426 break;
4427 }
4428 case LITERAL_continue:
4429 {
4430 TNode tmp124_AST_in = (TNode)_t;
4431 match(_t,LITERAL_continue);
4432 _t = _t.getNextSibling();
4433 break;
4434 }
4435 case LITERAL_break:
4436 {
4437 TNode tmp125_AST_in = (TNode)_t;
4438 match(_t,LITERAL_break);
4439 _t = _t.getNextSibling();
4440 break;
4441 }
4442 case LITERAL_return:
4443 {
4444 AST __t173 = _t;
4445 TNode tmp126_AST_in = (TNode)_t;
4446 match(_t,LITERAL_return);
4447 _t = _t.getFirstChild();
4448 {
4449 if (_t==null) _t=ASTNULL;
4450 switch ( _t.getType()) {
4451 case ID:
4452 case ASSIGN:
4453 case STAR:
4454 case LPAREN:
4455 case DIV_ASSIGN:
4456 case PLUS_ASSIGN:
4457 case MINUS_ASSIGN:
4458 case STAR_ASSIGN:
4459 case MOD_ASSIGN:
4460 case RSHIFT_ASSIGN:
4461 case LSHIFT_ASSIGN:
4462 case BAND_ASSIGN:
4463 case BOR_ASSIGN:
4464 case BXOR_ASSIGN:
4465 case QUESTION:
4466 case LOR:
4467 case LAND:
4468 case BOR:
4469 case BXOR:
4470 case BAND:
4471 case EQUAL:
4472 case NOT_EQUAL:
4473 case LT:
4474 case LTE:
4475 case GT:
4476 case GTE:
4477 case LSHIFT:
4478 case RSHIFT:
4479 case PLUS:
4480 case MINUS:
4481 case DIV:
4482 case MOD:
4483 case INC:
4484 case DEC:
4485 case LITERAL_sizeof:
4486 case CharLiteral:
4487 case NCast:
4488 case NExpressionGroup:
4489 case NInitializer:
4490 case NEmptyExpression:
4491 case NCommaExpr:
4492 case NUnaryExpr:
4493 case NPostfixExpr:
4494 case NRangeExpr:
4495 case NStringSeq:
4496 case NLcurlyInitializer:
4497 case NGnuAsmExpr:
4498 case Number:
4499 case LITERAL___alignof:
4500 {
4501 expr(_t);
4502 _t = _retTree;
4503 break;
4504 }
4505 case 3:
4506 {
4507 break;
4508 }
4509 default:
4510 {
4511 throw new NoViableAltException(_t);
4512 }
4513 }
4514 }
4515 _t = __t173;
4516 _t = _t.getNextSibling();
4517 break;
4518 }
4519 case NLabel:
4520 {
4521 AST __t175 = _t;
4522 TNode tmp127_AST_in = (TNode)_t;
4523 match(_t,NLabel);
4524 _t = _t.getFirstChild();
4525 TNode tmp128_AST_in = (TNode)_t;
4526 match(_t,ID);
4527 _t = _t.getNextSibling();
4528 {
4529 if (_t==null) _t=ASTNULL;
4530 switch ( _t.getType()) {
4531 case SEMI:
4532 case LITERAL_while:
4533 case LITERAL_do:
4534 case LITERAL_for:
4535 case LITERAL_goto:
4536 case LITERAL_continue:
4537 case LITERAL_break:
4538 case LITERAL_return:
4539 case LITERAL_case:
4540 case LITERAL_default:
4541 case LITERAL_if:
4542 case LITERAL_switch:
4543 case NStatementExpr:
4544 case NCompoundStatement:
4545 case NLabel:
4546 {
4547 statement(_t);
4548 _t = _retTree;
4549 break;
4550 }
4551 case 3:
4552 {
4553 break;
4554 }
4555 default:
4556 {
4557 throw new NoViableAltException(_t);
4558 }
4559 }
4560 }
4561 _t = __t175;
4562 _t = _t.getNextSibling();
4563 break;
4564 }
4565 case LITERAL_case:
4566 {
4567 AST __t177 = _t;
4568 TNode tmp129_AST_in = (TNode)_t;
4569 match(_t,LITERAL_case);
4570 _t = _t.getFirstChild();
4571 expr(_t);
4572 _t = _retTree;
4573 {
4574 if (_t==null) _t=ASTNULL;
4575 switch ( _t.getType()) {
4576 case SEMI:
4577 case LITERAL_while:
4578 case LITERAL_do:
4579 case LITERAL_for:
4580 case LITERAL_goto:
4581 case LITERAL_continue:
4582 case LITERAL_break:
4583 case LITERAL_return:
4584 case LITERAL_case:
4585 case LITERAL_default:
4586 case LITERAL_if:
4587 case LITERAL_switch:
4588 case NStatementExpr:
4589 case NCompoundStatement:
4590 case NLabel:
4591 {
4592 statement(_t);
4593 _t = _retTree;
4594 break;
4595 }
4596 case 3:
4597 {
4598 break;
4599 }
4600 default:
4601 {
4602 throw new NoViableAltException(_t);
4603 }
4604 }
4605 }
4606 _t = __t177;
4607 _t = _t.getNextSibling();
4608 break;
4609 }
4610 case LITERAL_default:
4611 {
4612 AST __t179 = _t;
4613 TNode tmp130_AST_in = (TNode)_t;
4614 match(_t,LITERAL_default);
4615 _t = _t.getFirstChild();
4616 {
4617 if (_t==null) _t=ASTNULL;
4618 switch ( _t.getType()) {
4619 case SEMI:
4620 case LITERAL_while:
4621 case LITERAL_do:
4622 case LITERAL_for:
4623 case LITERAL_goto:
4624 case LITERAL_continue:
4625 case LITERAL_break:
4626 case LITERAL_return:
4627 case LITERAL_case:
4628 case LITERAL_default:
4629 case LITERAL_if:
4630 case LITERAL_switch:
4631 case NStatementExpr:
4632 case NCompoundStatement:
4633 case NLabel:
4634 {
4635 statement(_t);
4636 _t = _retTree;
4637 break;
4638 }
4639 case 3:
4640 {
4641 break;
4642 }
4643 default:
4644 {
4645 throw new NoViableAltException(_t);
4646 }
4647 }
4648 }
4649 _t = __t179;
4650 _t = _t.getNextSibling();
4651 break;
4652 }
4653 case LITERAL_if:
4654 {
4655 AST __t181 = _t;
4656 TNode tmp131_AST_in = (TNode)_t;
4657 match(_t,LITERAL_if);
4658 _t = _t.getFirstChild();
4659 expr(_t);
4660 _t = _retTree;
4661 statement(_t);
4662 _t = _retTree;
4663 {
4664 if (_t==null) _t=ASTNULL;
4665 switch ( _t.getType()) {
4666 case LITERAL_else:
4667 {
4668 TNode tmp132_AST_in = (TNode)_t;
4669 match(_t,LITERAL_else);
4670 _t = _t.getNextSibling();
4671 statement(_t);
4672 _t = _retTree;
4673 break;
4674 }
4675 case 3:
4676 {
4677 break;
4678 }
4679 default:
4680 {
4681 throw new NoViableAltException(_t);
4682 }
4683 }
4684 }
4685 _t = __t181;
4686 _t = _t.getNextSibling();
4687 break;
4688 }
4689 case LITERAL_switch:
4690 {
4691 AST __t183 = _t;
4692 TNode tmp133_AST_in = (TNode)_t;
4693 match(_t,LITERAL_switch);
4694 _t = _t.getFirstChild();
4695 expr(_t);
4696 _t = _retTree;
4697 statement(_t);
4698 _t = _retTree;
4699 _t = __t183;
4700 _t = _t.getNextSibling();
4701 break;
4702 }
4703 default:
4704 {
4705 throw new NoViableAltException(_t);
4706 }
4707 }
4708 }
4709 catch (RecognitionException ex) {
4710 if (inputState.guessing==0) {
4711 reportError(ex);
4712 if (_t!=null) {_t = _t.getNextSibling();}
4713 } else {
4714 throw ex;
4715 }
4716 }
4717 _retTree = _t;
4718 }
4719
4720 public final void assignExpr(AST _t) throws RecognitionException {
4721
4722 TNode assignExpr_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
4723
4724 try { // for error handling
4725 if (_t==null) _t=ASTNULL;
4726 switch ( _t.getType()) {
4727 case ASSIGN:
4728 {
4729 AST __t209 = _t;
4730 TNode tmp134_AST_in = (TNode)_t;
4731 match(_t,ASSIGN);
4732 _t = _t.getFirstChild();
4733 expr(_t);
4734 _t = _retTree;
4735 expr(_t);
4736 _t = _retTree;
4737 _t = __t209;
4738 _t = _t.getNextSibling();
4739 break;
4740 }
4741 case DIV_ASSIGN:
4742 {
4743 AST __t210 = _t;
4744 TNode tmp135_AST_in = (TNode)_t;
4745 match(_t,DIV_ASSIGN);
4746 _t = _t.getFirstChild();
4747 expr(_t);
4748 _t = _retTree;
4749 expr(_t);
4750 _t = _retTree;
4751 _t = __t210;
4752 _t = _t.getNextSibling();
4753 break;
4754 }
4755 case PLUS_ASSIGN:
4756 {
4757 AST __t211 = _t;
4758 TNode tmp136_AST_in = (TNode)_t;
4759 match(_t,PLUS_ASSIGN);
4760 _t = _t.getFirstChild();
4761 expr(_t);
4762 _t = _retTree;
4763 expr(_t);
4764 _t = _retTree;
4765 _t = __t211;
4766 _t = _t.getNextSibling();
4767 break;
4768 }
4769 case MINUS_ASSIGN:
4770 {
4771 AST __t212 = _t;
4772 TNode tmp137_AST_in = (TNode)_t;
4773 match(_t,MINUS_ASSIGN);
4774 _t = _t.getFirstChild();
4775 expr(_t);
4776 _t = _retTree;
4777 expr(_t);
4778 _t = _retTree;
4779 _t = __t212;
4780 _t = _t.getNextSibling();
4781 break;
4782 }
4783 case STAR_ASSIGN:
4784 {
4785 AST __t213 = _t;
4786 TNode tmp138_AST_in = (TNode)_t;
4787 match(_t,STAR_ASSIGN);
4788 _t = _t.getFirstChild();
4789 expr(_t);
4790 _t = _retTree;
4791 expr(_t);
4792 _t = _retTree;
4793 _t = __t213;
4794 _t = _t.getNextSibling();
4795 break;
4796 }
4797 case MOD_ASSIGN:
4798 {
4799 AST __t214 = _t;
4800 TNode tmp139_AST_in = (TNode)_t;
4801 match(_t,MOD_ASSIGN);
4802 _t = _t.getFirstChild();
4803 expr(_t);
4804 _t = _retTree;
4805 expr(_t);
4806 _t = _retTree;
4807 _t = __t214;
4808 _t = _t.getNextSibling();
4809 break;
4810 }
4811 case RSHIFT_ASSIGN:
4812 {
4813 AST __t215 = _t;
4814 TNode tmp140_AST_in = (TNode)_t;
4815 match(_t,RSHIFT_ASSIGN);
4816 _t = _t.getFirstChild();
4817 expr(_t);
4818 _t = _retTree;
4819 expr(_t);
4820 _t = _retTree;
4821 _t = __t215;
4822 _t = _t.getNextSibling();
4823 break;
4824 }
4825 case LSHIFT_ASSIGN:
4826 {
4827 AST __t216 = _t;
4828 TNode tmp141_AST_in = (TNode)_t;
4829 match(_t,LSHIFT_ASSIGN);
4830 _t = _t.getFirstChild();
4831 expr(_t);
4832 _t = _retTree;
4833 expr(_t);
4834 _t = _retTree;
4835 _t = __t216;
4836 _t = _t.getNextSibling();
4837 break;
4838 }
4839 case BAND_ASSIGN:
4840 {
4841 AST __t217 = _t;
4842 TNode tmp142_AST_in = (TNode)_t;
4843 match(_t,BAND_ASSIGN);
4844 _t = _t.getFirstChild();
4845 expr(_t);
4846 _t = _retTree;
4847 expr(_t);
4848 _t = _retTree;
4849 _t = __t217;
4850 _t = _t.getNextSibling();
4851 break;
4852 }
4853 case BOR_ASSIGN:
4854 {
4855 AST __t218 = _t;
4856 TNode tmp143_AST_in = (TNode)_t;
4857 match(_t,BOR_ASSIGN);
4858 _t = _t.getFirstChild();
4859 expr(_t);
4860 _t = _retTree;
4861 expr(_t);
4862 _t = _retTree;
4863 _t = __t218;
4864 _t = _t.getNextSibling();
4865 break;
4866 }
4867 case BXOR_ASSIGN:
4868 {
4869 AST __t219 = _t;
4870 TNode tmp144_AST_in = (TNode)_t;
4871 match(_t,BXOR_ASSIGN);
4872 _t = _t.getFirstChild();
4873 expr(_t);
4874 _t = _retTree;
4875 expr(_t);
4876 _t = _retTree;
4877 _t = __t219;
4878 _t = _t.getNextSibling();
4879 break;
4880 }
4881 default:
4882 {
4883 throw new NoViableAltException(_t);
4884 }
4885 }
4886 }
4887 catch (RecognitionException ex) {
4888 if (inputState.guessing==0) {
4889 reportError(ex);
4890 if (_t!=null) {_t = _t.getNextSibling();}
4891 } else {
4892 throw ex;
4893 }
4894 }
4895 _retTree = _t;
4896 }
4897
4898 public final void conditionalExpr(AST _t) throws RecognitionException {
4899
4900 TNode conditionalExpr_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
4901
4902 try { // for error handling
4903 AST __t221 = _t;
4904 TNode tmp145_AST_in = (TNode)_t;
4905 match(_t,QUESTION);
4906 _t = _t.getFirstChild();
4907 expr(_t);
4908 _t = _retTree;
4909 {
4910 if (_t==null) _t=ASTNULL;
4911 switch ( _t.getType()) {
4912 case ID:
4913 case ASSIGN:
4914 case STAR:
4915 case LPAREN:
4916 case DIV_ASSIGN:
4917 case PLUS_ASSIGN:
4918 case MINUS_ASSIGN:
4919 case STAR_ASSIGN:
4920 case MOD_ASSIGN:
4921 case RSHIFT_ASSIGN:
4922 case LSHIFT_ASSIGN:
4923 case BAND_ASSIGN:
4924 case BOR_ASSIGN:
4925 case BXOR_ASSIGN:
4926 case QUESTION:
4927 case LOR:
4928 case LAND:
4929 case BOR:
4930 case BXOR:
4931 case BAND:
4932 case EQUAL:
4933 case NOT_EQUAL:
4934 case LT:
4935 case LTE:
4936 case GT:
4937 case GTE:
4938 case LSHIFT:
4939 case RSHIFT:
4940 case PLUS:
4941 case MINUS:
4942 case DIV:
4943 case MOD:
4944 case INC:
4945 case DEC:
4946 case LITERAL_sizeof:
4947 case CharLiteral:
4948 case NCast:
4949 case NExpressionGroup:
4950 case NInitializer:
4951 case NEmptyExpression:
4952 case NCommaExpr:
4953 case NUnaryExpr:
4954 case NPostfixExpr:
4955 case NRangeExpr:
4956 case NStringSeq:
4957 case NLcurlyInitializer:
4958 case NGnuAsmExpr:
4959 case Number:
4960 case LITERAL___alignof:
4961 {
4962 expr(_t);
4963 _t = _retTree;
4964 break;
4965 }
4966 case COLON:
4967 {
4968 break;
4969 }
4970 default:
4971 {
4972 throw new NoViableAltException(_t);
4973 }
4974 }
4975 }
4976 TNode tmp146_AST_in = (TNode)_t;
4977 match(_t,COLON);
4978 _t = _t.getNextSibling();
4979 expr(_t);
4980 _t = _retTree;
4981 _t = __t221;
4982 _t = _t.getNextSibling();
4983 }
4984 catch (RecognitionException ex) {
4985 if (inputState.guessing==0) {
4986 reportError(ex);
4987 if (_t!=null) {_t = _t.getNextSibling();}
4988 } else {
4989 throw ex;
4990 }
4991 }
4992 _retTree = _t;
4993 }
4994
4995 public final void logicalOrExpr(AST _t) throws RecognitionException {
4996
4997 TNode logicalOrExpr_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
4998
4999 try { // for error handling
5000 AST __t224 = _t;
5001 TNode tmp147_AST_in = (TNode)_t;
5002 match(_t,LOR);
5003 _t = _t.getFirstChild();
5004 expr(_t);
5005 _t = _retTree;
5006 expr(_t);
5007 _t = _retTree;
5008 _t = __t224;
5009 _t = _t.getNextSibling();
5010 }
5011 catch (RecognitionException ex) {
5012 if (inputState.guessing==0) {
5013 reportError(ex);
5014 if (_t!=null) {_t = _t.getNextSibling();}
5015 } else {
5016 throw ex;
5017 }
5018 }
5019 _retTree = _t;
5020 }
5021
5022 public final void logicalAndExpr(AST _t) throws RecognitionException {
5023
5024 TNode logicalAndExpr_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
5025
5026 try { // for error handling
5027 AST __t226 = _t;
5028 TNode tmp148_AST_in = (TNode)_t;
5029 match(_t,LAND);
5030 _t = _t.getFirstChild();
5031 expr(_t);
5032 _t = _retTree;
5033 expr(_t);
5034 _t = _retTree;
5035 _t = __t226;
5036 _t = _t.getNextSibling();
5037 }
5038 catch (RecognitionException ex) {
5039 if (inputState.guessing==0) {
5040 reportError(ex);
5041 if (_t!=null) {_t = _t.getNextSibling();}
5042 } else {
5043 throw ex;
5044 }
5045 }
5046 _retTree = _t;
5047 }
5048
5049 public final void inclusiveOrExpr(AST _t) throws RecognitionException {
5050
5051 TNode inclusiveOrExpr_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
5052
5053 try { // for error handling
5054 AST __t228 = _t;
5055 TNode tmp149_AST_in = (TNode)_t;
5056 match(_t,BOR);
5057 _t = _t.getFirstChild();
5058 expr(_t);
5059 _t = _retTree;
5060 expr(_t);
5061 _t = _retTree;
5062 _t = __t228;
5063 _t = _t.getNextSibling();
5064 }
5065 catch (RecognitionException ex) {
5066 if (inputState.guessing==0) {
5067 reportError(ex);
5068 if (_t!=null) {_t = _t.getNextSibling();}
5069 } else {
5070 throw ex;
5071 }
5072 }
5073 _retTree = _t;
5074 }
5075
5076 public final void exclusiveOrExpr(AST _t) throws RecognitionException {
5077
5078 TNode exclusiveOrExpr_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
5079
5080 try { // for error handling
5081 AST __t230 = _t;
5082 TNode tmp150_AST_in = (TNode)_t;
5083 match(_t,BXOR);
5084 _t = _t.getFirstChild();
5085 expr(_t);
5086 _t = _retTree;
5087 expr(_t);
5088 _t = _retTree;
5089 _t = __t230;
5090 _t = _t.getNextSibling();
5091 }
5092 catch (RecognitionException ex) {
5093 if (inputState.guessing==0) {
5094 reportError(ex);
5095 if (_t!=null) {_t = _t.getNextSibling();}
5096 } else {
5097 throw ex;
5098 }
5099 }
5100 _retTree = _t;
5101 }
5102
5103 public final void bitAndExpr(AST _t) throws RecognitionException {
5104
5105 TNode bitAndExpr_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
5106
5107 try { // for error handling
5108 AST __t232 = _t;
5109 TNode tmp151_AST_in = (TNode)_t;
5110 match(_t,BAND);
5111 _t = _t.getFirstChild();
5112 expr(_t);
5113 _t = _retTree;
5114 expr(_t);
5115 _t = _retTree;
5116 _t = __t232;
5117 _t = _t.getNextSibling();
5118 }
5119 catch (RecognitionException ex) {
5120 if (inputState.guessing==0) {
5121 reportError(ex);
5122 if (_t!=null) {_t = _t.getNextSibling();}
5123 } else {
5124 throw ex;
5125 }
5126 }
5127 _retTree = _t;
5128 }
5129
5130 public final void equalityExpr(AST _t) throws RecognitionException {
5131
5132 TNode equalityExpr_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
5133
5134 try { // for error handling
5135 if (_t==null) _t=ASTNULL;
5136 switch ( _t.getType()) {
5137 case EQUAL:
5138 {
5139 AST __t234 = _t;
5140 TNode tmp152_AST_in = (TNode)_t;
5141 match(_t,EQUAL);
5142 _t = _t.getFirstChild();
5143 expr(_t);
5144 _t = _retTree;
5145 expr(_t);
5146 _t = _retTree;
5147 _t = __t234;
5148 _t = _t.getNextSibling();
5149 break;
5150 }
5151 case NOT_EQUAL:
5152 {
5153 AST __t235 = _t;
5154 TNode tmp153_AST_in = (TNode)_t;
5155 match(_t,NOT_EQUAL);
5156 _t = _t.getFirstChild();
5157 expr(_t);
5158 _t = _retTree;
5159 expr(_t);
5160 _t = _retTree;
5161 _t = __t235;
5162 _t = _t.getNextSibling();
5163 break;
5164 }
5165 default:
5166 {
5167 throw new NoViableAltException(_t);
5168 }
5169 }
5170 }
5171 catch (RecognitionException ex) {
5172 if (inputState.guessing==0) {
5173 reportError(ex);
5174 if (_t!=null) {_t = _t.getNextSibling();}
5175 } else {
5176 throw ex;
5177 }
5178 }
5179 _retTree = _t;
5180 }
5181
5182 public final void relationalExpr(AST _t) throws RecognitionException {
5183
5184 TNode relationalExpr_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
5185
5186 try { // for error handling
5187 if (_t==null) _t=ASTNULL;
5188 switch ( _t.getType()) {
5189 case LT:
5190 {
5191 AST __t237 = _t;
5192 TNode tmp154_AST_in = (TNode)_t;
5193 match(_t,LT);
5194 _t = _t.getFirstChild();
5195 expr(_t);
5196 _t = _retTree;
5197 expr(_t);
5198 _t = _retTree;
5199 _t = __t237;
5200 _t = _t.getNextSibling();
5201 break;
5202 }
5203 case LTE:
5204 {
5205 AST __t238 = _t;
5206 TNode tmp155_AST_in = (TNode)_t;
5207 match(_t,LTE);
5208 _t = _t.getFirstChild();
5209 expr(_t);
5210 _t = _retTree;
5211 expr(_t);
5212 _t = _retTree;
5213 _t = __t238;
5214 _t = _t.getNextSibling();
5215 break;
5216 }
5217 case GT:
5218 {
5219 AST __t239 = _t;
5220 TNode tmp156_AST_in = (TNode)_t;
5221 match(_t,GT);
5222 _t = _t.getFirstChild();
5223 expr(_t);
5224 _t = _retTree;
5225 expr(_t);
5226 _t = _retTree;
5227 _t = __t239;
5228 _t = _t.getNextSibling();
5229 break;
5230 }
5231 case GTE:
5232 {
5233 AST __t240 = _t;
5234 TNode tmp157_AST_in = (TNode)_t;
5235 match(_t,GTE);
5236 _t = _t.getFirstChild();
5237 expr(_t);
5238 _t = _retTree;
5239 expr(_t);
5240 _t = _retTree;
5241 _t = __t240;
5242 _t = _t.getNextSibling();
5243 break;
5244 }
5245 default:
5246 {
5247 throw new NoViableAltException(_t);
5248 }
5249 }
5250 }
5251 catch (RecognitionException ex) {
5252 if (inputState.guessing==0) {
5253 reportError(ex);
5254 if (_t!=null) {_t = _t.getNextSibling();}
5255 } else {
5256 throw ex;
5257 }
5258 }
5259 _retTree = _t;
5260 }
5261
5262 public final void shiftExpr(AST _t) throws RecognitionException {
5263
5264 TNode shiftExpr_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
5265
5266 try { // for error handling
5267 if (_t==null) _t=ASTNULL;
5268 switch ( _t.getType()) {
5269 case LSHIFT:
5270 {
5271 AST __t242 = _t;
5272 TNode tmp158_AST_in = (TNode)_t;
5273 match(_t,LSHIFT);
5274 _t = _t.getFirstChild();
5275 expr(_t);
5276 _t = _retTree;
5277 expr(_t);
5278 _t = _retTree;
5279 _t = __t242;
5280 _t = _t.getNextSibling();
5281 break;
5282 }
5283 case RSHIFT:
5284 {
5285 AST __t243 = _t;
5286 TNode tmp159_AST_in = (TNode)_t;
5287 match(_t,RSHIFT);
5288 _t = _t.getFirstChild();
5289 expr(_t);
5290 _t = _retTree;
5291 expr(_t);
5292 _t = _retTree;
5293 _t = __t243;
5294 _t = _t.getNextSibling();
5295 break;
5296 }
5297 default:
5298 {
5299 throw new NoViableAltException(_t);
5300 }
5301 }
5302 }
5303 catch (RecognitionException ex) {
5304 if (inputState.guessing==0) {
5305 reportError(ex);
5306 if (_t!=null) {_t = _t.getNextSibling();}
5307 } else {
5308 throw ex;
5309 }
5310 }
5311 _retTree = _t;
5312 }
5313
5314 public final void additiveExpr(AST _t) throws RecognitionException {
5315
5316 TNode additiveExpr_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
5317
5318 try { // for error handling
5319 if (_t==null) _t=ASTNULL;
5320 switch ( _t.getType()) {
5321 case PLUS:
5322 {
5323 AST __t245 = _t;
5324 TNode tmp160_AST_in = (TNode)_t;
5325 match(_t,PLUS);
5326 _t = _t.getFirstChild();
5327 expr(_t);
5328 _t = _retTree;
5329 expr(_t);
5330 _t = _retTree;
5331 _t = __t245;
5332 _t = _t.getNextSibling();
5333 break;
5334 }
5335 case MINUS:
5336 {
5337 AST __t246 = _t;
5338 TNode tmp161_AST_in = (TNode)_t;
5339 match(_t,MINUS);
5340 _t = _t.getFirstChild();
5341 expr(_t);
5342 _t = _retTree;
5343 expr(_t);
5344 _t = _retTree;
5345 _t = __t246;
5346 _t = _t.getNextSibling();
5347 break;
5348 }
5349 default:
5350 {
5351 throw new NoViableAltException(_t);
5352 }
5353 }
5354 }
5355 catch (RecognitionException ex) {
5356 if (inputState.guessing==0) {
5357 reportError(ex);
5358 if (_t!=null) {_t = _t.getNextSibling();}
5359 } else {
5360 throw ex;
5361 }
5362 }
5363 _retTree = _t;
5364 }
5365
5366 public final void multExpr(AST _t) throws RecognitionException {
5367
5368 TNode multExpr_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
5369
5370 try { // for error handling
5371 if (_t==null) _t=ASTNULL;
5372 switch ( _t.getType()) {
5373 case STAR:
5374 {
5375 AST __t248 = _t;
5376 TNode tmp162_AST_in = (TNode)_t;
5377 match(_t,STAR);
5378 _t = _t.getFirstChild();
5379 expr(_t);
5380 _t = _retTree;
5381 expr(_t);
5382 _t = _retTree;
5383 _t = __t248;
5384 _t = _t.getNextSibling();
5385 break;
5386 }
5387 case DIV:
5388 {
5389 AST __t249 = _t;
5390 TNode tmp163_AST_in = (TNode)_t;
5391 match(_t,DIV);
5392 _t = _t.getFirstChild();
5393 expr(_t);
5394 _t = _retTree;
5395 expr(_t);
5396 _t = _retTree;
5397 _t = __t249;
5398 _t = _t.getNextSibling();
5399 break;
5400 }
5401 case MOD:
5402 {
5403 AST __t250 = _t;
5404 TNode tmp164_AST_in = (TNode)_t;
5405 match(_t,MOD);
5406 _t = _t.getFirstChild();
5407 expr(_t);
5408 _t = _retTree;
5409 expr(_t);
5410 _t = _retTree;
5411 _t = __t250;
5412 _t = _t.getNextSibling();
5413 break;
5414 }
5415 default:
5416 {
5417 throw new NoViableAltException(_t);
5418 }
5419 }
5420 }
5421 catch (RecognitionException ex) {
5422 if (inputState.guessing==0) {
5423 reportError(ex);
5424 if (_t!=null) {_t = _t.getNextSibling();}
5425 } else {
5426 throw ex;
5427 }
5428 }
5429 _retTree = _t;
5430 }
5431
5432 public final void castExpr(AST _t) throws RecognitionException {
5433
5434 TNode castExpr_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
5435
5436 try { // for error handling
5437 AST __t252 = _t;
5438 TNode tmp165_AST_in = (TNode)_t;
5439 match(_t,NCast);
5440 _t = _t.getFirstChild();
5441 typeName(_t);
5442 _t = _retTree;
5443 TNode tmp166_AST_in = (TNode)_t;
5444 match(_t,RPAREN);
5445 _t = _t.getNextSibling();
5446 expr(_t);
5447 _t = _retTree;
5448 _t = __t252;
5449 _t = _t.getNextSibling();
5450 }
5451 catch (RecognitionException ex) {
5452 if (inputState.guessing==0) {
5453 reportError(ex);
5454 if (_t!=null) {_t = _t.getNextSibling();}
5455 } else {
5456 throw ex;
5457 }
5458 }
5459 _retTree = _t;
5460 }
5461
5462 public final void unaryExpr(AST _t) throws RecognitionException {
5463
5464 TNode unaryExpr_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
5465
5466 try { // for error handling
5467 if (_t==null) _t=ASTNULL;
5468 switch ( _t.getType()) {
5469 case INC:
5470 {
5471 AST __t254 = _t;
5472 TNode tmp167_AST_in = (TNode)_t;
5473 match(_t,INC);
5474 _t = _t.getFirstChild();
5475 expr(_t);
5476 _t = _retTree;
5477 _t = __t254;
5478 _t = _t.getNextSibling();
5479 break;
5480 }
5481 case DEC:
5482 {
5483 AST __t255 = _t;
5484 TNode tmp168_AST_in = (TNode)_t;
5485 match(_t,DEC);
5486 _t = _t.getFirstChild();
5487 expr(_t);
5488 _t = _retTree;
5489 _t = __t255;
5490 _t = _t.getNextSibling();
5491 break;
5492 }
5493 case NUnaryExpr:
5494 {
5495 AST __t256 = _t;
5496 TNode tmp169_AST_in = (TNode)_t;
5497 match(_t,NUnaryExpr);
5498 _t = _t.getFirstChild();
5499 unaryOperator(_t);
5500 _t = _retTree;
5501 expr(_t);
5502 _t = _retTree;
5503 _t = __t256;
5504 _t = _t.getNextSibling();
5505 break;
5506 }
5507 case LITERAL_sizeof:
5508 {
5509 AST __t257 = _t;
5510 TNode tmp170_AST_in = (TNode)_t;
5511 match(_t,LITERAL_sizeof);
5512 _t = _t.getFirstChild();
5513 {
5514 boolean synPredMatched260 = false;
5515 if (_t==null) _t=ASTNULL;
5516 if (((_t.getType()==LPAREN))) {
5517 AST __t260 = _t;
5518 synPredMatched260 = true;
5519 inputState.guessing++;
5520 try {
5521 {
5522 TNode tmp171_AST_in = (TNode)_t;
5523 match(_t,LPAREN);
5524 _t = _t.getNextSibling();
5525 typeName(_t);
5526 _t = _retTree;
5527 }
5528 }
5529 catch (RecognitionException pe) {
5530 synPredMatched260 = false;
5531 }
5532 _t = __t260;
5533inputState.guessing--;
5534 }
5535 if ( synPredMatched260 ) {
5536 TNode tmp172_AST_in = (TNode)_t;
5537 match(_t,LPAREN);
5538 _t = _t.getNextSibling();
5539 typeName(_t);
5540 _t = _retTree;
5541 TNode tmp173_AST_in = (TNode)_t;
5542 match(_t,RPAREN);
5543 _t = _t.getNextSibling();
5544 }
5545 else if ((_tokenSet_4.member(_t.getType()))) {
5546 expr(_t);
5547 _t = _retTree;
5548 }
5549 else {
5550 throw new NoViableAltException(_t);
5551 }
5552
5553 }
5554 _t = __t257;
5555 _t = _t.getNextSibling();
5556 break;
5557 }
5558 case LITERAL___alignof:
5559 {
5560 AST __t261 = _t;
5561 TNode tmp174_AST_in = (TNode)_t;
5562 match(_t,LITERAL___alignof);
5563 _t = _t.getFirstChild();
5564 {
5565 boolean synPredMatched264 = false;
5566 if (_t==null) _t=ASTNULL;
5567 if (((_t.getType()==LPAREN))) {
5568 AST __t264 = _t;
5569 synPredMatched264 = true;
5570 inputState.guessing++;
5571 try {
5572 {
5573 TNode tmp175_AST_in = (TNode)_t;
5574 match(_t,LPAREN);
5575 _t = _t.getNextSibling();
5576 typeName(_t);
5577 _t = _retTree;
5578 }
5579 }
5580 catch (RecognitionException pe) {
5581 synPredMatched264 = false;
5582 }
5583 _t = __t264;
5584inputState.guessing--;
5585 }
5586 if ( synPredMatched264 ) {
5587 TNode tmp176_AST_in = (TNode)_t;
5588 match(_t,LPAREN);
5589 _t = _t.getNextSibling();
5590 typeName(_t);
5591 _t = _retTree;
5592 TNode tmp177_AST_in = (TNode)_t;
5593 match(_t,RPAREN);
5594 _t = _t.getNextSibling();
5595 }
5596 else if ((_tokenSet_4.member(_t.getType()))) {
5597 expr(_t);
5598 _t = _retTree;
5599 }
5600 else {
5601 throw new NoViableAltException(_t);
5602 }
5603
5604 }
5605 _t = __t261;
5606 _t = _t.getNextSibling();
5607 break;
5608 }
5609 default:
5610 {
5611 throw new NoViableAltException(_t);
5612 }
5613 }
5614 }
5615 catch (RecognitionException ex) {
5616 if (inputState.guessing==0) {
5617 reportError(ex);
5618 if (_t!=null) {_t = _t.getNextSibling();}
5619 } else {
5620 throw ex;
5621 }
5622 }
5623 _retTree = _t;
5624 }
5625
5626 public final void postfixExpr(AST _t) throws RecognitionException {
5627
5628 TNode postfixExpr_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
5629
5630 try { // for error handling
5631 AST __t267 = _t;
5632 TNode tmp178_AST_in = (TNode)_t;
5633 match(_t,NPostfixExpr);
5634 _t = _t.getFirstChild();
5635 primaryExpr(_t);
5636 _t = _retTree;
5637 {
5638 int _cnt271=0;
5639 _loop271:
5640 do {
5641 if (_t==null) _t=ASTNULL;
5642 switch ( _t.getType()) {
5643 case PTR:
5644 {
5645 TNode tmp179_AST_in = (TNode)_t;
5646 match(_t,PTR);
5647 _t = _t.getNextSibling();
5648 TNode tmp180_AST_in = (TNode)_t;
5649 match(_t,ID);
5650 _t = _t.getNextSibling();
5651 break;
5652 }
5653 case DOT:
5654 {
5655 TNode tmp181_AST_in = (TNode)_t;
5656 match(_t,DOT);
5657 _t = _t.getNextSibling();
5658 TNode tmp182_AST_in = (TNode)_t;
5659 match(_t,ID);
5660 _t = _t.getNextSibling();
5661 break;
5662 }
5663 case NFunctionCallArgs:
5664 {
5665 AST __t269 = _t;
5666 TNode tmp183_AST_in = (TNode)_t;
5667 match(_t,NFunctionCallArgs);
5668 _t = _t.getFirstChild();
5669 {
5670 if (_t==null) _t=ASTNULL;
5671 switch ( _t.getType()) {
5672 case ID:
5673 case ASSIGN:
5674 case STAR:
5675 case LPAREN:
5676 case DIV_ASSIGN:
5677 case PLUS_ASSIGN:
5678 case MINUS_ASSIGN:
5679 case STAR_ASSIGN:
5680 case MOD_ASSIGN:
5681 case RSHIFT_ASSIGN:
5682 case LSHIFT_ASSIGN:
5683 case BAND_ASSIGN:
5684 case BOR_ASSIGN:
5685 case BXOR_ASSIGN:
5686 case QUESTION:
5687 case LOR:
5688 case LAND:
5689 case BOR:
5690 case BXOR:
5691 case BAND:
5692 case EQUAL:
5693 case NOT_EQUAL:
5694 case LT:
5695 case LTE:
5696 case GT:
5697 case GTE:
5698 case LSHIFT:
5699 case RSHIFT:
5700 case PLUS:
5701 case MINUS:
5702 case DIV:
5703 case MOD:
5704 case INC:
5705 case DEC:
5706 case LITERAL_sizeof:
5707 case CharLiteral:
5708 case NCast:
5709 case NExpressionGroup:
5710 case NInitializer:
5711 case NEmptyExpression:
5712 case NCommaExpr:
5713 case NUnaryExpr:
5714 case NPostfixExpr:
5715 case NRangeExpr:
5716 case NStringSeq:
5717 case NLcurlyInitializer:
5718 case NGnuAsmExpr:
5719 case Number:
5720 case LITERAL___alignof:
5721 {
5722 argExprList(_t);
5723 _t = _retTree;
5724 break;
5725 }
5726 case RPAREN:
5727 {
5728 break;
5729 }
5730 default:
5731 {
5732 throw new NoViableAltException(_t);
5733 }
5734 }
5735 }
5736 TNode tmp184_AST_in = (TNode)_t;
5737 match(_t,RPAREN);
5738 _t = _t.getNextSibling();
5739 _t = __t269;
5740 _t = _t.getNextSibling();
5741 break;
5742 }
5743 case LBRACKET:
5744 {
5745 TNode tmp185_AST_in = (TNode)_t;
5746 match(_t,LBRACKET);
5747 _t = _t.getNextSibling();
5748 expr(_t);
5749 _t = _retTree;
5750 TNode tmp186_AST_in = (TNode)_t;
5751 match(_t,RBRACKET);
5752 _t = _t.getNextSibling();
5753 break;
5754 }
5755 case INC:
5756 {
5757 TNode tmp187_AST_in = (TNode)_t;
5758 match(_t,INC);
5759 _t = _t.getNextSibling();
5760 break;
5761 }
5762 case DEC:
5763 {
5764 TNode tmp188_AST_in = (TNode)_t;
5765 match(_t,DEC);
5766 _t = _t.getNextSibling();
5767 break;
5768 }
5769 default:
5770 {
5771 if ( _cnt271>=1 ) { break _loop271; } else {throw new NoViableAltException(_t);}
5772 }
5773 }
5774 _cnt271++;
5775 } while (true);
5776 }
5777 _t = __t267;
5778 _t = _t.getNextSibling();
5779 }
5780 catch (RecognitionException ex) {
5781 if (inputState.guessing==0) {
5782 reportError(ex);
5783 if (_t!=null) {_t = _t.getNextSibling();}
5784 } else {
5785 throw ex;
5786 }
5787 }
5788 _retTree = _t;
5789 }
5790
5791 public final void primaryExpr(AST _t) throws RecognitionException {
5792
5793 TNode primaryExpr_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
5794
5795 try { // for error handling
5796 if (_t==null) _t=ASTNULL;
5797 switch ( _t.getType()) {
5798 case ID:
5799 {
5800 TNode tmp189_AST_in = (TNode)_t;
5801 match(_t,ID);
5802 _t = _t.getNextSibling();
5803 break;
5804 }
5805 case Number:
5806 {
5807 TNode tmp190_AST_in = (TNode)_t;
5808 match(_t,Number);
5809 _t = _t.getNextSibling();
5810 break;
5811 }
5812 case CharLiteral:
5813 {
5814 charConst(_t);
5815 _t = _retTree;
5816 break;
5817 }
5818 case NStringSeq:
5819 {
5820 stringConst(_t);
5821 _t = _retTree;
5822 break;
5823 }
5824 case NExpressionGroup:
5825 {
5826 AST __t273 = _t;
5827 TNode tmp191_AST_in = (TNode)_t;
5828 match(_t,NExpressionGroup);
5829 _t = _t.getFirstChild();
5830 expr(_t);
5831 _t = _retTree;
5832 _t = __t273;
5833 _t = _t.getNextSibling();
5834 break;
5835 }
5836 default:
5837 {
5838 throw new NoViableAltException(_t);
5839 }
5840 }
5841 }
5842 catch (RecognitionException ex) {
5843 if (inputState.guessing==0) {
5844 reportError(ex);
5845 if (_t!=null) {_t = _t.getNextSibling();}
5846 } else {
5847 throw ex;
5848 }
5849 }
5850 _retTree = _t;
5851 }
5852
5853 public final void commaExpr(AST _t) throws RecognitionException {
5854
5855 TNode commaExpr_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
5856
5857 try { // for error handling
5858 AST __t186 = _t;
5859 TNode tmp192_AST_in = (TNode)_t;
5860 match(_t,NCommaExpr);
5861 _t = _t.getFirstChild();
5862 expr(_t);
5863 _t = _retTree;
5864 expr(_t);
5865 _t = _retTree;
5866 _t = __t186;
5867 _t = _t.getNextSibling();
5868 }
5869 catch (RecognitionException ex) {
5870 if (inputState.guessing==0) {
5871 reportError(ex);
5872 if (_t!=null) {_t = _t.getNextSibling();}
5873 } else {
5874 throw ex;
5875 }
5876 }
5877 _retTree = _t;
5878 }
5879
5880 public final void emptyExpr(AST _t) throws RecognitionException {
5881
5882 TNode emptyExpr_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
5883
5884 try { // for error handling
5885 TNode tmp193_AST_in = (TNode)_t;
5886 match(_t,NEmptyExpression);
5887 _t = _t.getNextSibling();
5888 }
5889 catch (RecognitionException ex) {
5890 if (inputState.guessing==0) {
5891 reportError(ex);
5892 if (_t!=null) {_t = _t.getNextSibling();}
5893 } else {
5894 throw ex;
5895 }
5896 }
5897 _retTree = _t;
5898 }
5899
5900 public final void compoundStatementExpr(AST _t) throws RecognitionException {
5901
5902 TNode compoundStatementExpr_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
5903
5904 try { // for error handling
5905 AST __t189 = _t;
5906 TNode tmp194_AST_in = (TNode)_t;
5907 match(_t,LPAREN);
5908 _t = _t.getFirstChild();
5910 _t = _retTree;
5911 TNode tmp195_AST_in = (TNode)_t;
5912 match(_t,RPAREN);
5913 _t = _t.getNextSibling();
5914 _t = __t189;
5915 _t = _t.getNextSibling();
5916 }
5917 catch (RecognitionException ex) {
5918 if (inputState.guessing==0) {
5919 reportError(ex);
5920 if (_t!=null) {_t = _t.getNextSibling();}
5921 } else {
5922 throw ex;
5923 }
5924 }
5925 _retTree = _t;
5926 }
5927
5928 public final void rangeExpr(AST _t) throws RecognitionException {
5929
5930 TNode rangeExpr_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
5931
5932 try { // for error handling
5933 AST __t191 = _t;
5934 TNode tmp196_AST_in = (TNode)_t;
5935 match(_t,NRangeExpr);
5936 _t = _t.getFirstChild();
5937 expr(_t);
5938 _t = _retTree;
5939 TNode tmp197_AST_in = (TNode)_t;
5940 match(_t,VARARGS);
5941 _t = _t.getNextSibling();
5942 expr(_t);
5943 _t = _retTree;
5944 _t = __t191;
5945 _t = _t.getNextSibling();
5946 }
5947 catch (RecognitionException ex) {
5948 if (inputState.guessing==0) {
5949 reportError(ex);
5950 if (_t!=null) {_t = _t.getNextSibling();}
5951 } else {
5952 throw ex;
5953 }
5954 }
5955 _retTree = _t;
5956 }
5957
5958 public final void gnuAsmExpr(AST _t) throws RecognitionException {
5959
5960 TNode gnuAsmExpr_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
5961
5962 try { // for error handling
5963 AST __t193 = _t;
5964 TNode tmp198_AST_in = (TNode)_t;
5965 match(_t,NGnuAsmExpr);
5966 _t = _t.getFirstChild();
5967 {
5968 if (_t==null) _t=ASTNULL;
5969 switch ( _t.getType()) {
5970 case LITERAL_volatile:
5971 {
5972 TNode tmp199_AST_in = (TNode)_t;
5973 match(_t,LITERAL_volatile);
5974 _t = _t.getNextSibling();
5975 break;
5976 }
5977 case LPAREN:
5978 {
5979 break;
5980 }
5981 default:
5982 {
5983 throw new NoViableAltException(_t);
5984 }
5985 }
5986 }
5987 TNode tmp200_AST_in = (TNode)_t;
5988 match(_t,LPAREN);
5989 _t = _t.getNextSibling();
5990 stringConst(_t);
5991 _t = _retTree;
5992 {
5993 if (_t==null) _t=ASTNULL;
5994 if ((_t.getType()==COLON)) {
5995 TNode tmp201_AST_in = (TNode)_t;
5996 match(_t,COLON);
5997 _t = _t.getNextSibling();
5998 {
5999 if (_t==null) _t=ASTNULL;
6000 switch ( _t.getType()) {
6001 case NStringSeq:
6002 {
6003 strOptExprPair(_t);
6004 _t = _retTree;
6005 {
6006 _loop198:
6007 do {
6008 if (_t==null) _t=ASTNULL;
6009 if ((_t.getType()==COMMA)) {
6010 TNode tmp202_AST_in = (TNode)_t;
6011 match(_t,COMMA);
6012 _t = _t.getNextSibling();
6013 strOptExprPair(_t);
6014 _t = _retTree;
6015 }
6016 else {
6017 break _loop198;
6018 }
6019
6020 } while (true);
6021 }
6022 break;
6023 }
6024 case COLON:
6025 case RPAREN:
6026 {
6027 break;
6028 }
6029 default:
6030 {
6031 throw new NoViableAltException(_t);
6032 }
6033 }
6034 }
6035 {
6036 if (_t==null) _t=ASTNULL;
6037 if ((_t.getType()==COLON)) {
6038 TNode tmp203_AST_in = (TNode)_t;
6039 match(_t,COLON);
6040 _t = _t.getNextSibling();
6041 {
6042 if (_t==null) _t=ASTNULL;
6043 switch ( _t.getType()) {
6044 case NStringSeq:
6045 {
6046 strOptExprPair(_t);
6047 _t = _retTree;
6048 {
6049 _loop202:
6050 do {
6051 if (_t==null) _t=ASTNULL;
6052 if ((_t.getType()==COMMA)) {
6053 TNode tmp204_AST_in = (TNode)_t;
6054 match(_t,COMMA);
6055 _t = _t.getNextSibling();
6056 strOptExprPair(_t);
6057 _t = _retTree;
6058 }
6059 else {
6060 break _loop202;
6061 }
6062
6063 } while (true);
6064 }
6065 break;
6066 }
6067 case COLON:
6068 case RPAREN:
6069 {
6070 break;
6071 }
6072 default:
6073 {
6074 throw new NoViableAltException(_t);
6075 }
6076 }
6077 }
6078 }
6079 else if ((_t.getType()==COLON||_t.getType()==RPAREN)) {
6080 }
6081 else {
6082 throw new NoViableAltException(_t);
6083 }
6084
6085 }
6086 }
6087 else if ((_t.getType()==COLON||_t.getType()==RPAREN)) {
6088 }
6089 else {
6090 throw new NoViableAltException(_t);
6091 }
6092
6093 }
6094 {
6095 if (_t==null) _t=ASTNULL;
6096 switch ( _t.getType()) {
6097 case COLON:
6098 {
6099 TNode tmp205_AST_in = (TNode)_t;
6100 match(_t,COLON);
6101 _t = _t.getNextSibling();
6102 stringConst(_t);
6103 _t = _retTree;
6104 {
6105 _loop205:
6106 do {
6107 if (_t==null) _t=ASTNULL;
6108 if ((_t.getType()==COMMA)) {
6109 TNode tmp206_AST_in = (TNode)_t;
6110 match(_t,COMMA);
6111 _t = _t.getNextSibling();
6112 stringConst(_t);
6113 _t = _retTree;
6114 }
6115 else {
6116 break _loop205;
6117 }
6118
6119 } while (true);
6120 }
6121 break;
6122 }
6123 case RPAREN:
6124 {
6125 break;
6126 }
6127 default:
6128 {
6129 throw new NoViableAltException(_t);
6130 }
6131 }
6132 }
6133 TNode tmp207_AST_in = (TNode)_t;
6134 match(_t,RPAREN);
6135 _t = _t.getNextSibling();
6136 _t = __t193;
6137 _t = _t.getNextSibling();
6138 }
6139 catch (RecognitionException ex) {
6140 if (inputState.guessing==0) {
6141 reportError(ex);
6142 if (_t!=null) {_t = _t.getNextSibling();}
6143 } else {
6144 throw ex;
6145 }
6146 }
6147 _retTree = _t;
6148 }
6149
6150 protected final void stringConst(AST _t) throws RecognitionException {
6151
6152 TNode stringConst_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
6153
6154 try { // for error handling
6155 AST __t279 = _t;
6156 TNode tmp208_AST_in = (TNode)_t;
6157 match(_t,NStringSeq);
6158 _t = _t.getFirstChild();
6159 {
6160 int _cnt281=0;
6161 _loop281:
6162 do {
6163 if (_t==null) _t=ASTNULL;
6164 if ((_t.getType()==StringLiteral)) {
6165 TNode tmp209_AST_in = (TNode)_t;
6166 match(_t,StringLiteral);
6167 _t = _t.getNextSibling();
6168 }
6169 else {
6170 if ( _cnt281>=1 ) { break _loop281; } else {throw new NoViableAltException(_t);}
6171 }
6172
6173 _cnt281++;
6174 } while (true);
6175 }
6176 _t = __t279;
6177 _t = _t.getNextSibling();
6178 }
6179 catch (RecognitionException ex) {
6180 if (inputState.guessing==0) {
6181 reportError(ex);
6182 if (_t!=null) {_t = _t.getNextSibling();}
6183 } else {
6184 throw ex;
6185 }
6186 }
6187 _retTree = _t;
6188 }
6189
6190 public final void strOptExprPair(AST _t) throws RecognitionException {
6191
6192 TNode strOptExprPair_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
6193
6194 try { // for error handling
6195 stringConst(_t);
6196 _t = _retTree;
6197 {
6198 if (_t==null) _t=ASTNULL;
6199 switch ( _t.getType()) {
6200 case LPAREN:
6201 {
6202 TNode tmp210_AST_in = (TNode)_t;
6203 match(_t,LPAREN);
6204 _t = _t.getNextSibling();
6205 expr(_t);
6206 _t = _retTree;
6207 TNode tmp211_AST_in = (TNode)_t;
6208 match(_t,RPAREN);
6209 _t = _t.getNextSibling();
6210 break;
6211 }
6212 case COMMA:
6213 case COLON:
6214 case RPAREN:
6215 {
6216 break;
6217 }
6218 default:
6219 {
6220 throw new NoViableAltException(_t);
6221 }
6222 }
6223 }
6224 }
6225 catch (RecognitionException ex) {
6226 if (inputState.guessing==0) {
6227 reportError(ex);
6228 if (_t!=null) {_t = _t.getNextSibling();}
6229 } else {
6230 throw ex;
6231 }
6232 }
6233 _retTree = _t;
6234 }
6235
6236 public final void unaryOperator(AST _t) throws RecognitionException {
6237
6238 TNode unaryOperator_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
6239
6240 try { // for error handling
6241 if (_t==null) _t=ASTNULL;
6242 switch ( _t.getType()) {
6243 case BAND:
6244 {
6245 TNode tmp212_AST_in = (TNode)_t;
6246 match(_t,BAND);
6247 _t = _t.getNextSibling();
6248 break;
6249 }
6250 case STAR:
6251 {
6252 TNode tmp213_AST_in = (TNode)_t;
6253 match(_t,STAR);
6254 _t = _t.getNextSibling();
6255 break;
6256 }
6257 case PLUS:
6258 {
6259 TNode tmp214_AST_in = (TNode)_t;
6260 match(_t,PLUS);
6261 _t = _t.getNextSibling();
6262 break;
6263 }
6264 case MINUS:
6265 {
6266 TNode tmp215_AST_in = (TNode)_t;
6267 match(_t,MINUS);
6268 _t = _t.getNextSibling();
6269 break;
6270 }
6271 case BNOT:
6272 {
6273 TNode tmp216_AST_in = (TNode)_t;
6274 match(_t,BNOT);
6275 _t = _t.getNextSibling();
6276 break;
6277 }
6278 case LNOT:
6279 {
6280 TNode tmp217_AST_in = (TNode)_t;
6281 match(_t,LNOT);
6282 _t = _t.getNextSibling();
6283 break;
6284 }
6285 case LAND:
6286 {
6287 TNode tmp218_AST_in = (TNode)_t;
6288 match(_t,LAND);
6289 _t = _t.getNextSibling();
6290 break;
6291 }
6292 case LITERAL___real:
6293 {
6294 TNode tmp219_AST_in = (TNode)_t;
6295 match(_t,LITERAL___real);
6296 _t = _t.getNextSibling();
6297 break;
6298 }
6299 case LITERAL___imag:
6300 {
6301 TNode tmp220_AST_in = (TNode)_t;
6302 match(_t,LITERAL___imag);
6303 _t = _t.getNextSibling();
6304 break;
6305 }
6306 default:
6307 {
6308 throw new NoViableAltException(_t);
6309 }
6310 }
6311 }
6312 catch (RecognitionException ex) {
6313 if (inputState.guessing==0) {
6314 reportError(ex);
6315 if (_t!=null) {_t = _t.getNextSibling();}
6316 } else {
6317 throw ex;
6318 }
6319 }
6320 _retTree = _t;
6321 }
6322
6323 public final void argExprList(AST _t) throws RecognitionException {
6324
6325 TNode argExprList_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
6326
6327 try { // for error handling
6328 {
6329 int _cnt276=0;
6330 _loop276:
6331 do {
6332 if (_t==null) _t=ASTNULL;
6333 if ((_tokenSet_4.member(_t.getType()))) {
6334 expr(_t);
6335 _t = _retTree;
6336 }
6337 else {
6338 if ( _cnt276>=1 ) { break _loop276; } else {throw new NoViableAltException(_t);}
6339 }
6340
6341 _cnt276++;
6342 } while (true);
6343 }
6344 }
6345 catch (RecognitionException ex) {
6346 if (inputState.guessing==0) {
6347 reportError(ex);
6348 if (_t!=null) {_t = _t.getNextSibling();}
6349 } else {
6350 throw ex;
6351 }
6352 }
6353 _retTree = _t;
6354 }
6355
6356 protected final void charConst(AST _t) throws RecognitionException {
6357
6358 TNode charConst_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
6359
6360 try { // for error handling
6361 TNode tmp221_AST_in = (TNode)_t;
6362 match(_t,CharLiteral);
6363 _t = _t.getNextSibling();
6364 }
6365 catch (RecognitionException ex) {
6366 if (inputState.guessing==0) {
6367 reportError(ex);
6368 if (_t!=null) {_t = _t.getNextSibling();}
6369 } else {
6370 throw ex;
6371 }
6372 }
6373 _retTree = _t;
6374 }
6375
6376 protected final void intConst(AST _t) throws RecognitionException {
6377
6378 TNode intConst_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
6379
6380 try { // for error handling
6381 if (_t==null) _t=ASTNULL;
6382 switch ( _t.getType()) {
6383 case IntOctalConst:
6384 {
6385 TNode tmp222_AST_in = (TNode)_t;
6386 match(_t,IntOctalConst);
6387 _t = _t.getNextSibling();
6388 break;
6389 }
6390 case LongOctalConst:
6391 {
6392 TNode tmp223_AST_in = (TNode)_t;
6393 match(_t,LongOctalConst);
6394 _t = _t.getNextSibling();
6395 break;
6396 }
6397 case UnsignedOctalConst:
6398 {
6399 TNode tmp224_AST_in = (TNode)_t;
6400 match(_t,UnsignedOctalConst);
6401 _t = _t.getNextSibling();
6402 break;
6403 }
6404 case IntIntConst:
6405 {
6406 TNode tmp225_AST_in = (TNode)_t;
6407 match(_t,IntIntConst);
6408 _t = _t.getNextSibling();
6409 break;
6410 }
6411 case LongIntConst:
6412 {
6413 TNode tmp226_AST_in = (TNode)_t;
6414 match(_t,LongIntConst);
6415 _t = _t.getNextSibling();
6416 break;
6417 }
6418 case UnsignedIntConst:
6419 {
6420 TNode tmp227_AST_in = (TNode)_t;
6421 match(_t,UnsignedIntConst);
6422 _t = _t.getNextSibling();
6423 break;
6424 }
6425 case IntHexConst:
6426 {
6427 TNode tmp228_AST_in = (TNode)_t;
6428 match(_t,IntHexConst);
6429 _t = _t.getNextSibling();
6430 break;
6431 }
6432 case LongHexConst:
6433 {
6434 TNode tmp229_AST_in = (TNode)_t;
6435 match(_t,LongHexConst);
6436 _t = _t.getNextSibling();
6437 break;
6438 }
6439 case UnsignedHexConst:
6440 {
6441 TNode tmp230_AST_in = (TNode)_t;
6442 match(_t,UnsignedHexConst);
6443 _t = _t.getNextSibling();
6444 break;
6445 }
6446 default:
6447 {
6448 throw new NoViableAltException(_t);
6449 }
6450 }
6451 }
6452 catch (RecognitionException ex) {
6453 if (inputState.guessing==0) {
6454 reportError(ex);
6455 if (_t!=null) {_t = _t.getNextSibling();}
6456 } else {
6457 throw ex;
6458 }
6459 }
6460 _retTree = _t;
6461 }
6462
6463 protected final void floatConst(AST _t) throws RecognitionException {
6464
6465 TNode floatConst_AST_in = (_t == ASTNULL) ? null : (TNode)_t;
6466
6467 try { // for error handling
6468 if (_t==null) _t=ASTNULL;
6469 switch ( _t.getType()) {
6470 case FloatDoubleConst:
6471 {
6472 TNode tmp231_AST_in = (TNode)_t;
6473 match(_t,FloatDoubleConst);
6474 _t = _t.getNextSibling();
6475 break;
6476 }
6477 case DoubleDoubleConst:
6478 {
6479 TNode tmp232_AST_in = (TNode)_t;
6480 match(_t,DoubleDoubleConst);
6481 _t = _t.getNextSibling();
6482 break;
6483 }
6484 case LongDoubleConst:
6485 {
6486 TNode tmp233_AST_in = (TNode)_t;
6487 match(_t,LongDoubleConst);
6488 _t = _t.getNextSibling();
6489 break;
6490 }
6491 default:
6492 {
6493 throw new NoViableAltException(_t);
6494 }
6495 }
6496 }
6497 catch (RecognitionException ex) {
6498 if (inputState.guessing==0) {
6499 reportError(ex);
6500 if (_t!=null) {_t = _t.getNextSibling();}
6501 } else {
6502 throw ex;
6503 }
6504 }
6505 _retTree = _t;
6506 }
6507
6508
6509 public static final String[] _tokenNames = {
6510 "<0>",
6511 "EOF",
6512 "<2>",
6513 "NULL_TREE_LOOKAHEAD",
6514 "\"typedef\"",
6515 "\"asm\"",
6516 "\"volatile\"",
6517 "LCURLY",
6518 "RCURLY",
6519 "SEMI",
6520 "\"struct\"",
6521 "\"union\"",
6522 "\"enum\"",
6523 "\"auto\"",
6524 "\"register\"",
6525 "\"extern\"",
6526 "\"static\"",
6527 "\"const\"",
6528 "\"void\"",
6529 "\"char\"",
6530 "\"short\"",
6531 "\"int\"",
6532 "\"long\"",
6533 "\"float\"",
6534 "\"double\"",
6535 "\"signed\"",
6536 "\"unsigned\"",
6537 "\"int8_t\"",
6538 "\"uint8_t\"",
6539 "\"int16_t\"",
6540 "\"uint16_t\"",
6541 "\"__int32\"",
6542 "\"int32_t\"",
6543 "\"wchar_t\"",
6544 "\"uint32_t\"",
6545 "\"__int64\"",
6546 "\"int64_t\"",
6547 "\"uint64_t\"",
6548 "\"ptrdiff_t\"",
6549 "\"intptr_t\"",
6550 "\"size_t\"",
6551 "\"uintptr_t\"",
6552 "ID",
6553 "COMMA",
6554 "COLON",
6555 "ASSIGN",
6556 "STAR",
6557 "LPAREN",
6558 "RPAREN",
6559 "LBRACKET",
6560 "RBRACKET",
6561 "VARARGS",
6562 "\"while\"",
6563 "\"do\"",
6564 "\"for\"",
6565 "\"goto\"",
6566 "\"continue\"",
6567 "\"break\"",
6568 "\"return\"",
6569 "\"case\"",
6570 "\"default\"",
6571 "\"if\"",
6572 "\"else\"",
6573 "\"switch\"",
6574 "DIV_ASSIGN",
6575 "PLUS_ASSIGN",
6576 "MINUS_ASSIGN",
6577 "STAR_ASSIGN",
6578 "MOD_ASSIGN",
6579 "RSHIFT_ASSIGN",
6580 "LSHIFT_ASSIGN",
6581 "BAND_ASSIGN",
6582 "BOR_ASSIGN",
6583 "BXOR_ASSIGN",
6584 "QUESTION",
6585 "LOR",
6586 "LAND",
6587 "BOR",
6588 "BXOR",
6589 "BAND",
6590 "EQUAL",
6591 "NOT_EQUAL",
6592 "LT",
6593 "LTE",
6594 "GT",
6595 "GTE",
6596 "LSHIFT",
6597 "RSHIFT",
6598 "PLUS",
6599 "MINUS",
6600 "DIV",
6601 "MOD",
6602 "INC",
6603 "DEC",
6604 "\"sizeof\"",
6605 "BNOT",
6606 "LNOT",
6607 "PTR",
6608 "DOT",
6609 "CharLiteral",
6610 "StringLiteral",
6611 "IntOctalConst",
6612 "LongOctalConst",
6613 "UnsignedOctalConst",
6614 "IntIntConst",
6615 "LongIntConst",
6616 "UnsignedIntConst",
6617 "IntHexConst",
6618 "LongHexConst",
6619 "UnsignedHexConst",
6620 "FloatDoubleConst",
6621 "DoubleDoubleConst",
6622 "LongDoubleConst",
6623 "NTypedefName",
6624 "NInitDecl",
6625 "NDeclarator",
6626 "NStructDeclarator",
6627 "NDeclaration",
6628 "NCast",
6629 "NPointerGroup",
6630 "NExpressionGroup",
6631 "NFunctionCallArgs",
6632 "NNonemptyAbstractDeclarator",
6633 "NInitializer",
6634 "NStatementExpr",
6635 "NEmptyExpression",
6636 "NParameterTypeList",
6637 "NFunctionDef",
6638 "NCompoundStatement",
6639 "NParameterDeclaration",
6640 "NCommaExpr",
6641 "NUnaryExpr",
6642 "NLabel",
6643 "NPostfixExpr",
6644 "NRangeExpr",
6645 "NStringSeq",
6646 "NInitializerElementLabel",
6647 "NLcurlyInitializer",
6648 "NAsmAttribute",
6649 "NGnuAsmExpr",
6650 "NTypeMissing",
6651 "Vocabulary",
6652 "Whitespace",
6653 "Comment",
6654 "CPPComment",
6655 "NonWhitespace",
6656 "a line directive",
6657 "DefineExpr",
6658 "DefineExpr2",
6659 "Space",
6660 "LineDirective",
6661 "BadStringLiteral",
6662 "Escape",
6663 "Digit",
6664 "LongSuffix",
6665 "UnsignedSuffix",
6666 "FloatSuffix",
6667 "Exponent",
6668 "Number",
6669 "\"__label__\"",
6670 "\"inline\"",
6671 "\"typeof\"",
6672 "\"__complex\"",
6673 "\"__attribute\"",
6674 "\"__alignof\"",
6675 "\"__real\"",
6676 "\"__imag\""
6677 };
6678
6679 private static final long[] mk_tokenSet_0() {
6680 long[] data = { 100794432L, 0L, 0L};
6681 return data;
6682 }
6683 public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
6684 private static final long[] mk_tokenSet_1() {
6685 long[] data = { 4398046387264L, 562949953421312L, 25769803776L, 0L, 0L, 0L};
6686 return data;
6687 }
6688 public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
6689 private static final long[] mk_tokenSet_2() {
6690 long[] data = { 544L, -9214364837600034816L, 4096L, 0L, 0L, 0L};
6691 return data;
6692 }
6693 public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
6694 private static final long[] mk_tokenSet_3() {
6695 long[] data = { -4616189618054757888L, 1152921504606846976L, 17L, 0L, 0L, 0L};
6696 return data;
6697 }
6698 public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3());
6699 private static final long[] mk_tokenSet_4() {
6700 long[] data = { 250688651132928L, 2972375790571749375L, 69793221356L, 0L, 0L, 0L};
6701 return data;
6702 }
6703 public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4());
6704 }
6705
A Number, either integer, optionally [long, unsigned], or floating point, optionally [double].
final boolean isInteger
true if number is integer and value stored in i, otherwise false for floating point and value stored ...
final boolean isUnsigned
true if number is an unsigned isInteger.
final boolean isLong
true if number is a long isInteger.
Represents a [native] constant expression, comprises the [native] expression, see getNativeExpr() and...
CNumber getNumber()
Returns the parsed CNumber of the native expression, or null if the latter does not comprise a single...
A generic exception for Jogamp errors used throughout the binding as a substitute for RuntimeExceptio...
Parses and provides access to the contents of .cfg files for the JavaEmitter.
TypeInfo addTypeInfo(final String alias, final Type superType)
TypeInfo typeInfo(Type type)
If this type should be considered opaque, returns the TypeInfo describing the replacement type.
final Type typedefName(AST _t, int cvAttrs)
TypeDictionary getTypedefDictionary()
Returns the typedef dictionary this HeaderParser uses.
static final String ANONYMOUS_ENUM_NAME
Name assigned to a anonymous EnumType (e.g., "enum { ... }").
final void nonemptyAbstractDeclarator(AST _t, TypeBox tb)
final Type structSpecifier(AST _t, int cvAttrs)
final void pointerGroup(AST _t, TypeBox tb)
final List< ParameterDeclaration > parameterTypeList(AST _t)
void clearParsedFunctions()
Clears the list of functions this HeaderParser has parsed.
final boolean structDeclaration(AST _t, CompoundType containingType)
final Type typeSpecifier(AST _t, int attributes)
void setStructDictionary(TypeDictionary dict)
Set the dictionary mapping struct names (i.e., the "foo" in "struct foo { ... };") to types for this ...
void setJavaConfiguration(JavaConfiguration cfg)
Set the configuration for this HeaderParser.
void setEnums(List< EnumType > enumTypes)
Pre-define the list of EnumTypes for this HeaderParser.
final ParameterDeclaration parameterDeclaration(AST _t)
final void enumList(AST _t, EnumType enumeration)
final boolean structDeclarator(AST _t, CompoundType containingType, Type t)
final ConstantDefinition enumerator(AST _t, EnumType enumeration, ConstantDefinition defaultValue)
List< FunctionSymbol > getParsedFunctions()
Returns the list of FunctionSymbols this HeaderParser has parsed.
void setTypedefDictionary(TypeDictionary dict)
Set the dictionary mapping typedef names to types for this HeaderParser.
final boolean structDeclaratorList(AST _t, CompoundType containingType, Type t)
List< EnumType > getEnums()
Returns the EnumTypes this HeaderParser processed.
Map getCanonMap()
Get the canonicalization map, which is a regular HashMap mapping Type to Type and which is used for l...
final Type enumSpecifier(AST _t, int cvAttrs)
final boolean structDeclarationList(AST _t, CompoundType t)
final void initDecl(AST _t, TypeBox tb)
final void initDeclList(AST _t, TypeBox tb)
TypeDictionary getStructDictionary()
Returns the struct name dictionary this HeaderParser uses.
final Type unionSpecifier(AST _t, int cvAttrs)
final String declarator(AST _t, TypeBox tb)
final CompoundType structOrUnionBody(AST _t, CompoundTypeKind kind, int cvAttrs)
Class TNode is an implementation of the AST interface and adds many useful features:
Definition: TNode.java:38
String getAllChildrenText(final String name)
Returns the text for this node, its children and siblings.
Definition: TNode.java:219
String getText()
Get the token text for this node.
Definition: TNode.java:175
Models all compound types, i.e., those containing fields: structs and unions.
void setBodyParsed()
Indicates to this CompoundType that its body has been parsed and that no more addField operations wil...
static CompoundType create(final String structName, final SizeThunk size, final CompoundTypeKind kind, final int cvAttributes, final ASTLocusTag astLocus)
abstract boolean isUnion()
Indicates whether this type was declared as a union.
Represents a double-word floating-point type (C type "double".)
Definition: DoubleType.java:45
Describes enumerated types.
Definition: EnumType.java:54
boolean removeEnumerate(final String name)
Remove the enumerate with the given name.
Definition: EnumType.java:224
Enumerator getEnum(final int i)
Fetch ith (0..getNumEnumerates() - 1) Enumerator.
Definition: EnumType.java:194
Represents a field in a struct or union.
Definition: Field.java:47
Represents a single-word floating-point type (C type "float".)
Definition: FloatType.java:47
Describes a function symbol, which includes the name and type.
void addArgument(final Type argumentType, final String argumentName)
Add an argument's name and type.
Describes a function type, used to model both function declarations and (via PointerType) function po...
void addArgument(final Type argumentType, final String argumentName)
Add an argument's name and type.
Provides a level of indirection between the definition of a type's size and the absolute value of thi...
Definition: SizeThunk.java:51
static SizeThunk constant(final int constant)
Definition: SizeThunk.java:390
static SizeThunk mul(final SizeThunk thunk1, final SizeThunk thunk2)
Definition: SizeThunk.java:289
Utility class for recording names of typedefs and structs.
Type get(final String name)
Get the type corresponding to the given name.
Type put(final String name, final Type type)
Create a mapping from a type to its name.
final String getCVAttributesString()
Returns a string indicating the const/volatile attributes of this type.
Definition: Type.java:554
Type clone(final ASTLocusTag newLoc)
Clones this instance using a new ASTLocusTag.
Definition: Type.java:109
final ASTLocusTag getASTLocusTag()
Returns this instance's ASTLocusTag, if available, otherwise returns null.
Definition: Type.java:125
final boolean equalSemantics(final SemanticEqualityOp arg)
Semantic equality test for Types exclusive its given name.
Definition: Type.java:514
final String getName()
Returns the name of this type.
Definition: Type.java:142
boolean setTypedefName(final String name)
Set the typedef name of this type and renders this type a typedef, if given name has a length.
Definition: Type.java:327
Type getTargetType()
Helper method to returns the target type of this type, in case another type is being referenced,...
Definition: Type.java:605
final boolean isEnum()
Indicates whether this is an EnumType.
Definition: Type.java:401
final Type newCVVariant(final int cvAttributes)
Return a variant of this type matching the given const/volatile attributes.
Definition: Type.java:98
final boolean isPointer()
Indicates whether this is a PointerType.
Definition: Type.java:407
CompoundType asCompound()
Casts this to a CompoundType or returns null if not a CompoundType.
Definition: Type.java:390
final boolean isCompound()
Indicates whether this is a CompoundType.
Definition: Type.java:411
Type-safe enum for discriminating between structs and unions represented as compound types.
String getName()
Return the current-name, which is the last renamed-name if issued, or the original-name.
Enumeration for const/volatile attributes.