]> andersk Git - splint.git/blob - src/cgrammar.y
0d0e558de1362e036ba836f64773fe8ea49fddbd
[splint.git] / src / cgrammar.y
1 /*;-*-C-*-;
2 ** Copyright (c) Massachusetts Institute of Technology 1994-1998.
3 **          All Rights Reserved.
4 **          Unpublished rights reserved under the copyright laws of
5 **          the United States.
6 **
7 ** THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
8 ** OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
9 **
10 ** This code is distributed freely and may be used freely under the 
11 ** following conditions:
12 **
13 **     1. This notice may not be removed or altered.
14 **
15 **     2. Works derived from this code are not distributed for
16 **        commercial gain without explicit permission from MIT 
17 **        (for permission contact lclint-request@sds.lcs.mit.edu).
18 */
19 %{
20 /*
21 **
22 ** cgrammar.y
23 **
24 ** Yacc/Bison grammar for extended ANSI C used by LCLint.
25 **
26 ** original grammar by Nate Osgood ---
27 **    hacrat@catfish.lcs.mit.edu Mon Jun 14 13:06:32 1993
28 **
29 ** changes for LCLint --- handle typedef names correctly
30 ** fix struct/union parsing bug (empty struct is accepted)
31 ** add productions to handle macros --- require
32 ** error correction --- main source of conflicts in grammar.
33 ** need to process initializations sequentially, L->R
34 **
35 ** production names are cryptic, so more productions fit on one line
36 **
37 ** conflicts:  87 shift/reduce, 18 reduce/reduce
38 ** most of these are due to handling macros
39 ** a few are due to handling type expressions
40 */
41
42 /*@=allmacros@*/
43
44 extern int yylex ();
45 extern void swallowMacro (void);
46
47 # include "lclintMacros.nf"
48 # include "basic.h"
49 # include "cgrammar.h"
50 # include "exprChecks.h"
51
52 /*@-allmacros@*/
53 /*@-matchfields@*/
54
55 # define SHOWCSYM FALSE
56 void yyerror (char *s);
57
58 /*
59 ** This is necessary, or else when the bison-generated code #include's malloc.h,
60 ** there will be a parse error.
61 **
62 ** Unfortunately, it means the error checking on malloc, etc. is lost for allocations
63 ** in bison-generated files under Win32.
64 */
65
66 # ifdef WIN32
67 # undef malloc
68 # undef calloc
69 # undef realloc
70 # endif
71
72 void checkandsetBufState(idDecl id, exprNode is);
73 %}
74
75 %union
76 {
77  lltok tok;
78  int count;
79  specialClauseKind sck;
80  qual typequal;
81  qualList tquallist;
82  ctype ctyp;
83  sRef sr;
84  /*@only@*/ qtype qtyp;
85  /*@only@*/ cstring cname;
86  /*@only@*/ idDecl ntyp;
87  /*@only@*/ idDeclList ntyplist;
88  /*@only@*/ uentryList flist;
89  /*@owned@*/ uentryList entrylist;
90  /*@observer@*/ /*@dependent@*/ uentry entry;
91  /*@only@*/ uentry oentry;
92  /*@only@*/ exprNode expr;
93  /*@only@*/ enumNameList enumnamelist;
94  /*@only@*/ exprNodeList alist;
95  /*@only@*/ sRefSet srset; 
96  /*@only@*/ cstringList cstringlist;
97 }
98
99 /* standard C tokens */
100
101 %token <tok> BADTOK SKIPTOK
102 %token <tok> CTOK_ELIPSIS CASE DEFAULT CIF CELSE SWITCH WHILE DO CFOR
103 %token <tok> GOTO CONTINUE BREAK RETURN
104 %token <tok> TSEMI TLBRACE TRBRACE TCOMMA TCOLON TASSIGN TLPAREN 
105 %token <tok> TRPAREN TLSQBR TRSQBR TDOT TAMPERSAND TEXCL TTILDE
106 %token <tok> TMINUS TPLUS TMULT TDIV TPERCENT TLT TGT TCIRC TBAR TQUEST
107 %token <tok> CSIZEOF CALIGNOF ARROW_OP CTYPEDEF COFFSETOF
108 %token <tok> INC_OP DEC_OP LEFT_OP RIGHT_OP
109 %token <tok> LE_OP GE_OP EQ_OP NE_OP AND_OP OR_OP
110 %token <tok> MUL_ASSIGN DIV_ASSIGN MOD_ASSIGN ADD_ASSIGN SUB_ASSIGN
111 %token <tok> LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN XOR_ASSIGN OR_ASSIGN
112 %token <tok> CSTRUCT CUNION CENUM
113 %token <tok> VA_ARG VA_DCL
114 %token <tok> QGLOBALS
115 %token <tok> QMODIFIES 
116 %token <tok> QNOMODS
117 %token <tok> QCONSTANT
118 %token <tok> QFUNCTION
119 %token <tok> QITER
120 %token <tok> QDEFINES 
121 %token <tok> QUSES
122 %token <tok> QALLOCATES
123 %token <tok> QSETS
124 %token <tok> QRELEASES 
125 %token <tok> QPRECLAUSE 
126 %token <tok> QPOSTCLAUSE 
127 %token <tok> QALT 
128 %token <tok> QUNDEF QKILLED
129 %token <tok> QENDMACRO
130
131 /* additional tokens introduced by lclint pre-processor. */
132 %token <tok> LLMACRO LLMACROITER LLMACROEND TENDMACRO
133
134 /* break comments: */
135 %token <tok> QSWITCHBREAK QLOOPBREAK QINNERBREAK QSAFEBREAK
136 %token <tok> QINNERCONTINUE
137
138 /* case fall-through marker: */
139 %token <tok> QFALLTHROUGH
140
141 /* used in scanner only */
142 %token <tok> QLINTNOTREACHED
143 %token <tok> QLINTFALLTHROUGH
144 %token <tok> QLINTFALLTHRU
145 %token <tok> QARGSUSED
146 %token <tok> QPRINTFLIKE QLINTPRINTFLIKE QSCANFLIKE QMESSAGELIKE
147
148 /* not-reached marker: (used like a label) */
149 %token <tok> QNOTREACHED
150
151 /* type qualifiers: */
152 %token <tok> QCONST QVOLATILE QINLINE QEXTENSION QEXTERN QSTATIC QAUTO QREGISTER
153 %token <tok> QOUT QIN QYIELD QONLY QTEMP QSHARED QREF QUNIQUE
154 %token <tok> QCHECKED QUNCHECKED QCHECKEDSTRICT QCHECKMOD
155 %token <tok> QKEEP QKEPT QPARTIAL QSPECIAL QOWNED QDEPENDENT
156 %token <tok> QRETURNED QEXPOSED QNULL QOBSERVER QISNULL 
157 %token <tok> QEXITS QMAYEXIT QNEVEREXIT QTRUEEXIT QFALSEEXIT
158 %token <tok> QLONG QSIGNED QUNSIGNED QSHORT QUNUSED QSEF QNOTNULL QRELNULL
159 %token <tok> QABSTRACT QCONCRETE QMUTABLE QIMMUTABLE
160 %token <tok> QTRUENULL QFALSENULL QEXTERNAL
161 %token <tok> QREFCOUNTED QREFS QNEWREF QTEMPREF QKILLREF QRELDEF
162 %token <ctyp> CGCHAR CBOOL CINT CGFLOAT CDOUBLE CVOID 
163 %token <tok> QANYTYPE QINTEGRALTYPE QUNSIGNEDINTEGRALTYPE QSIGNEDINTEGRALTYPE
164 %token <tok> QNULLTERMINATED
165
166 /* identifiers, literals */
167 %token <entry> IDENTIFIER
168 %token <cname> NEW_IDENTIFIER TYPE_NAME_OR_ID 
169 %token <expr>  CCONSTANT
170 %token <entry> ITER_NAME ITER_ENDNAME 
171 %type <entry> endIter 
172 %type <sr> globId
173 %token <ctyp>  TYPE_NAME 
174 %type <cname> enumerator newId  /*@-varuse@*/ /* yacc declares yytranslate here */
175 %type <count> pointers /*@=varuse@*/
176
177 %type <tok> doHeader specialTag endSpecialTag stateSpecialClause endStateTag 
178 %type <sck> specialClauseType
179
180 /* type construction */
181 %type <ctyp> abstractDecl abstractDeclBase optAbstractDeclBase
182 %type <ctyp> suSpc enumSpc typeName typeSpecifier
183
184 %type <ntyp> namedDecl namedDeclBase optNamedDecl
185 %type <ntyp> plainNamedDecl plainNamedDeclBase
186 %type <ntyp> structNamedDecl
187 %type <ntyp> fcnDefHdrAux plainFcn
188
189 %type <oentry> paramDecl 
190 %type <entry> id 
191
192 %type <ntyplist> structNamedDeclList
193
194 %type <entrylist> genericParamList paramTypeList paramList idList paramIdList
195 %type <alist> argumentExprList iterArgList
196 %type <alist> initList
197 %type <flist> structDeclList structDecl
198 %type <srset> locModifies locPlainModifies modList specClauseList
199 %type <sr>    mExpr modListExpr specClauseListExpr
200 %type <enumnamelist> enumeratorList 
201 %type <cstringlist> fieldDesignator
202
203 %type <expr> sizeofExpr sizeofExprAux offsetofExpr
204 %type <expr> openScope closeScope 
205 %type <expr> instanceDecl namedInitializer optDeclarators
206 %type <expr> primaryExpr postfixExpr primaryIterExpr postfixIterExpr
207 %type <expr> unaryExpr castExpr timesExpr plusExpr
208 %type <expr> unaryIterExpr castIterExpr timesIterExpr plusIterExpr
209 %type <expr> shiftExpr relationalExpr equalityExpr bitandExpr
210 %type <expr> xorExpr bitorExpr andExpr
211 %type <expr> orExpr conditionalExpr assignExpr 
212 %type <expr> shiftIterExpr relationalIterExpr equalityIterExpr bitandIterExpr
213 %type <expr> xorIterExpr bitorIterExpr andIterExpr
214 %type <expr> orIterExpr conditionalIterExpr assignIterExpr iterArgExpr
215 %type <expr> expr optExpr constantExpr
216 %type <expr> init macroBody iterBody endBody partialIterStmt iterSelectionStmt
217 %type <expr> stmt stmtList fcnBody iterStmt iterDefStmt iterDefStmtList
218 %type <expr> labeledStmt caseStmt defaultStmt 
219 %type <expr> compoundStmt compoundStmtAux compoundStmtRest compoundStmtAuxErr
220 %type <expr> expressionStmt selectionStmt iterationStmt jumpStmt iterDefIterationStmt 
221 %type <expr> stmtErr stmtListErr compoundStmtErr expressionStmtErr 
222 %type <expr> iterationStmtErr initializerList initializer ifPred whilePred forPred iterWhilePred
223
224 %type <typequal> storageSpecifier typeQualifier typeModifier globQual
225 %type <tquallist> optGlobQuals
226 %type <qtyp> completeType completeTypeSpecifier optCompleteType
227 %type <qtyp> completeTypeSpecifierAux altType typeExpression 
228
229 %start file
230
231 %%
232
233 file
234  :              
235  | externalDefs
236
237 externalDefs
238  : externalDef
239  | externalDefs externalDef 
240
241 externalDef
242  : fcnDef optSemi { uentry_clearDecl (); } 
243  | constantDecl   { uentry_clearDecl (); } 
244  | fcnDecl        { uentry_clearDecl (); }
245  | iterDecl       { uentry_clearDecl (); } 
246  | macroDef       { uentry_clearDecl (); } 
247  | initializer    { uentry_checkDecl (); exprNode_free ($1); }
248  | error          { uentry_clearDecl (); } 
249
250 constantDecl
251  : QCONSTANT completeTypeSpecifier NotType namedDecl NotType optSemi IsType QENDMACRO
252    { checkConstant ($2, $4); }
253  | QCONSTANT completeTypeSpecifier NotType namedDecl NotType TASSIGN IsType init optDeclarators optSemi QENDMACRO
254    { checkValueConstant ($2, $4, $8) ; }
255
256 fcnDecl
257  : QFUNCTION { context_enterFunctionDecl (); } plainFcn optSemi QENDMACRO 
258    { declareStaticFunction ($3); context_quietExitFunction (); 
259      context_exitFunctionDecl (); }
260
261 plainFcn
262  : plainNamedDecl
263    { 
264      qtype qint = qtype_create (ctype_int);
265      $$ = idDecl_fixBase ($1, qint);
266      qtype_free (qint);
267    }
268  | completeTypeSpecifier NotType plainNamedDecl
269    { $$ = idDecl_fixBase ($3, $1); }
270
271 plainNamedDecl
272  : plainNamedDeclBase
273  | pointers plainNamedDeclBase 
274    { $$ = $2; qtype_adjustPointers ($1, idDecl_getTyp ($$)); }
275
276 namedDeclBase
277  : newId { $$ = idDecl_create ($1, qtype_unknown ()); }
278  | IsType TLPAREN NotType namedDecl IsType TRPAREN
279    { $$ = idDecl_expectFunction ($4); }
280  | namedDeclBase TLSQBR TRSQBR 
281    { $$ = idDecl_replaceCtype ($1, ctype_makeArray (idDecl_getCtype ($1))); }
282  | namedDeclBase TLSQBR IsType constantExpr TRSQBR NotType
283    { 
284      int value;
285
286      if (exprNode_hasValue ($4) 
287          && multiVal_isInt (exprNode_getValue ($4)))
288        {
289          value = (int) multiVal_forceInt (exprNode_getValue ($4));
290        }
291      else
292        {
293          value = 0;
294        }
295
296      $$ = idDecl_replaceCtype ($1, ctype_makeFixedArray (idDecl_getCtype ($1), value));
297    }
298  | namedDeclBase PushType TLPAREN TRPAREN 
299    { setCurrentParams (uentryList_missingParams); 
300         }
301    optGlobMods 
302    { /* need to support globals and modifies here! */
303      ctype ct = ctype_makeFunction (idDecl_getCtype ($1), 
304                                     uentryList_makeMissingParams ());
305
306      $$ = idDecl_replaceCtype ($1, ct);
307      context_popLoc (); 
308    }
309  | namedDeclBase PushType TLPAREN genericParamList TRPAREN 
310    { setCurrentParams ($4); 
311         } 
312    optGlobMods
313    { clearCurrentParams ();
314      $$ = idDecl_replaceCtype ($1, ctype_makeFunction (idDecl_getCtype ($1), $4));
315      context_popLoc (); 
316    }
317
318 plainNamedDeclBase
319  : newId { $$ = idDecl_create ($1, qtype_unknown ()); }
320  | IsType TLPAREN NotType plainNamedDecl IsType TRPAREN
321    { $$ = idDecl_expectFunction ($4); }
322  | plainNamedDeclBase TLSQBR TRSQBR 
323    { $$ = idDecl_replaceCtype ($1, ctype_makeArray (idDecl_getCtype ($1))); }
324  | plainNamedDeclBase TLSQBR IsType constantExpr TRSQBR NotType
325    { 
326      int value;
327
328      if (exprNode_hasValue ($4) 
329          && multiVal_isInt (exprNode_getValue ($4)))
330        {
331          value = (int) multiVal_forceInt (exprNode_getValue ($4));
332        }
333      else
334        {
335          value = 0;
336        }
337
338      $$ = idDecl_replaceCtype ($1, ctype_makeFixedArray (idDecl_getCtype ($1), value));
339    }
340  | plainNamedDeclBase PushType TLPAREN TRPAREN 
341    { setCurrentParams (uentryList_missingParams); 
342         }
343    optPlainGlobMods 
344    { /* need to support globals and modifies here! */
345      ctype ct = ctype_makeFunction (idDecl_getCtype ($1), 
346                                     uentryList_makeMissingParams ());
347
348      $$ = idDecl_replaceCtype ($1, ct);
349      context_popLoc (); 
350    }
351  | plainNamedDeclBase PushType TLPAREN genericParamList TRPAREN 
352    { setCurrentParams ($4); 
353         } 
354    optPlainGlobMods
355    { clearCurrentParams ();
356      $$ = idDecl_replaceCtype ($1, ctype_makeFunction (idDecl_getCtype ($1), $4));
357      context_popLoc (); 
358    }
359
360 iterDecl
361  : QITER newId TLPAREN genericParamList TRPAREN 
362    { setCurrentParams ($4); } optPlainGlobMods 
363    { clearCurrentParams (); } optSemi QENDMACRO
364    { declareCIter ($2, $4); }
365
366 macroDef
367  : LLMACRO macroBody TENDMACRO     { exprNode_checkMacroBody ($2); }
368  | LLMACROITER iterBody TENDMACRO  { exprNode_checkIterBody ($2); }
369  | LLMACROEND endBody TENDMACRO    { exprNode_checkIterEnd ($2); }
370  | LLMACRO TENDMACRO /* no stmt */ { exprChecks_checkEmptyMacroBody (); } 
371
372 fcnDefHdr
373   : fcnDefHdrAux { declareFunction ($1); }
374
375 optGlobMods
376  : { setProcessingGlobMods (); } optGlobModsRest
377    { clearProcessingGlobMods (); }
378
379 optPlainGlobMods
380  : { setProcessingGlobMods (); } optPlainGlobModsRest
381    { clearProcessingGlobMods (); }
382
383 optGlobModsRest
384  : optGlobModsAux 
385  | specialClauses optGlobModsAux
386
387 optPlainGlobModsRest
388  : optPlainGlobModsAux 
389  | specialClauses optPlainGlobModsAux
390
391 specialClauses
392  : specialClause
393  | specialClause specialClauses
394  
395 globIdList
396  : globIdListExpr                     { ; }
397  | globIdList TCOMMA globIdListExpr   { ; }
398  
399 globIdListExpr 
400  : optGlobQuals globId { globListAdd ($2, $1); }
401
402 globId
403  : id             { $$ = uentry_getSref ($1); }
404  | NEW_IDENTIFIER { $$ = globListUnrecognized ($1); }
405
406 globQual
407  : QUNDEF   { $$ = qual_createUndef (); }
408  | QKILLED  { $$ = qual_createKilled (); }
409  | QOUT     { $$ = qual_createOut (); }
410  | QIN      { $$ = qual_createIn (); }
411  | QPARTIAL { $$ = qual_createPartial (); }
412
413 optGlobQuals
414  : /* empty */         { $$ = qualList_undefined; }
415  | globQual optGlobQuals { $$ = qualList_add ($2, $1); }
416
417 optGlobModsAux  
418  : QGLOBALS { setProcessingGlobalsList (); } initializerList optSemi 
419    QENDMACRO optMods
420    { unsetProcessingGlobals (); }
421  | QGLOBALS { setProcessingGlobalsList (); } globIdList optSemi 
422    QENDMACRO optMods
423    { unsetProcessingGlobals (); }
424  | QNOMODS 
425    { setFunctionNoGlobals ();
426      setFunctionModifies (sRefSet_single (sRef_makeNothing ())); 
427    }
428  | fcnMods
429  | /* empty */
430
431 optPlainGlobModsAux
432  : QGLOBALS { setProcessingGlobalsList (); } initializerList optSemi 
433    optMods
434    { unsetProcessingGlobals (); }
435  | QGLOBALS { setProcessingGlobalsList (); } globIdList optSemi 
436    optMods
437    { unsetProcessingGlobals (); }
438  | QNOMODS 
439    { setFunctionNoGlobals ();
440      setFunctionModifies (sRefSet_single (sRef_makeNothing ())); 
441    }
442  | fcnPlainMods
443  | /* empty */
444
445 optMods
446  : fcnMods
447  | /* empty */
448
449 fcnMods
450  : QMODIFIES 
451    {
452      context_setProtectVars (); enterParamsTemp (); 
453      sRef_setGlobalScopeSafe (); 
454    }
455    locModifies
456    { 
457      setFunctionModifies ($3); exitParamsTemp ();
458      sRef_clearGlobalScopeSafe (); 
459      context_releaseVars ();
460    }
461
462 fcnPlainMods
463  : QMODIFIES 
464    {
465      context_setProtectVars (); enterParamsTemp (); 
466      sRef_setGlobalScopeSafe (); 
467    }
468    locPlainModifies
469    { 
470      setFunctionModifies ($3); exitParamsTemp ();
471      sRef_clearGlobalScopeSafe (); 
472      context_releaseVars ();
473    }
474
475 specialTag
476  : QDEFINES
477  | QUSES
478  | QALLOCATES
479  | QSETS
480  | QRELEASES
481
482 endStateTag
483  : QENDMACRO
484
485 endSpecialTag
486  : QENDMACRO
487
488 stateSpecialClause
489  : QPRECLAUSE
490  | QPOSTCLAUSE
491
492 specialClauseType
493  : QONLY       { $$ = SP_ISONLY; }
494  | QOBSERVER   { $$ = SP_ISOBSERVER; }
495  | QEXPOSED    { $$ = SP_ISEXPOSED; }
496  | QDEPENDENT  { $$ = SP_ISDEPENDENT; }
497  | QOWNED      { $$ = SP_ISOWNED; }
498  | QSHARED     { $$ = SP_ISSHARED; }
499  | QISNULL     { $$ = SP_ISNULL; }
500  | QNOTNULL    { $$ = SP_ISNOTNULL; }
501  
502 specialClause
503  : specialTag NotType
504    {
505      context_setProtectVars (); 
506      enterParamsTemp (); 
507      sRef_setGlobalScopeSafe (); 
508    }
509    specClauseList optSemi endSpecialTag IsType
510    { 
511      setFunctionSpecialClause ($1, $4, $6); 
512      exitParamsTemp ();
513      sRef_clearGlobalScopeSafe (); 
514      context_releaseVars ();
515    }
516   | stateSpecialClause NotType specialClauseType 
517     {
518       context_setProtectVars (); 
519       enterParamsTemp (); 
520       sRef_setGlobalScopeSafe (); 
521     }
522     specClauseList optSemi endStateTag IsType
523     { 
524       setFunctionStateSpecialClause ($1, $3, $5, $7); 
525       exitParamsTemp ();
526       sRef_clearGlobalScopeSafe (); 
527       context_releaseVars ();
528     }
529
530 fcnDefHdrAux
531  : namedDecl                               
532    { 
533      qtype qint = qtype_create (ctype_int);
534      $$ = idDecl_fixBase ($1, qint);
535      qtype_free (qint);
536    }
537  | completeTypeSpecifier NotType namedDecl 
538    { $$ = idDecl_fixBase ($3, $1); }
539  
540 fcnBody
541  : TLBRACE { checkDoneParams (); context_enterInnerContext (); } 
542    compoundStmtRest 
543    {  
544      exprNode_checkFunctionBody ($3); $$ = $3; 
545      context_exitInner ($3); 
546    }
547  | initializerList 
548    { doneParams (); context_enterInnerContext (); }
549    compoundStmt 
550    {
551      context_exitInner ($3);
552      exprNode_checkFunctionBody ($3); 
553      $$ = $3; /* old style */ 
554    } 
555  
556 fcnDef
557  : fcnDefHdr fcnBody 
558    { 
559      context_setFunctionDefined (exprNode_loc ($2)); 
560      exprNode_checkFunction (context_getHeader (), $2); 
561      context_exitFunction ();
562    }
563
564 locModifies
565  : modList optSemi QENDMACRO { $$ = $1; }
566  | optSemi QENDMACRO         { $$ = sRefSet_new (); }
567
568 locPlainModifies
569  : modList optSemi           { $$ = $1; }
570  | optSemi                   { $$ = sRefSet_new (); }
571  
572 modListExpr
573  : id                              { $$ = uentry_getSref ($1); checkModifiesId ($1); }
574  | NEW_IDENTIFIER                  { $$ = fixModifiesId ($1); }
575  | modListExpr TLSQBR TRSQBR       { $$ = modListArrayFetch ($1, sRef_undefined); }
576  | modListExpr TLSQBR mExpr TRSQBR { $$ = modListArrayFetch ($1, $3); }
577  | TMULT modListExpr               { $$ = modListPointer ($2); }
578  | TLPAREN modListExpr TRPAREN     { $$ = $2; }  
579  | modListExpr TDOT newId          { $$ = modListFieldAccess ($1, $3); }
580  | modListExpr ARROW_OP newId      { $$ = modListArrowAccess ($1, $3); }
581
582
583 mExpr
584   : modListExpr { $$ = $1; }
585   | CCONSTANT   { $$ = sRef_makeUnknown (); /* sRef_makeConstant ($1); ? */ }
586     /* arithmetic? */
587
588 modList
589   : modListExpr                { $$ = sRefSet_single ($1); }
590   | modList TCOMMA modListExpr { $$ = sRefSet_insert ($1, $3); }
591
592 specClauseListExpr
593  : id                                     
594    { $$ = checkSpecClausesId ($1); }
595  | NEW_IDENTIFIER                         
596    { $$ = fixSpecClausesId ($1); }
597  | specClauseListExpr TLSQBR TRSQBR       { $$ = sRef_makeAnyArrayFetch ($1); }
598  | specClauseListExpr TLSQBR mExpr TRSQBR { $$ = sRef_makeAnyArrayFetch ($1); }
599  | TMULT specClauseListExpr               { $$ = sRef_constructPointer ($2); }
600  | TLPAREN specClauseListExpr TRPAREN     { $$ = $2; }  
601  | specClauseListExpr TDOT newId          { cstring_markOwned ($3);
602                                             $$ = sRef_buildField ($1, $3); }
603  | specClauseListExpr ARROW_OP newId      { cstring_markOwned ($3);
604                                             $$ = sRef_makeArrow ($1, $3); }
605
606 specClauseList
607   : specClauseListExpr                       
608     { if (sRef_isValid ($1)) { $$ = sRefSet_single ($1); } 
609       else { $$ = sRefSet_undefined; } 
610     }
611   | specClauseList TCOMMA specClauseListExpr 
612     { if (sRef_isValid ($3))
613         {
614           $$ = sRefSet_insert ($1, $3); 
615         }
616       else
617         {
618           $$ = $1;
619         }
620     }
621
622 primaryExpr
623  : id { $$ = exprNode_fromIdentifier ($1); }
624  | NEW_IDENTIFIER { $$ = exprNode_fromUIO ($1); } 
625  | CCONSTANT      { $$ = $1; }
626  | TLPAREN expr TRPAREN { $$ = exprNode_addParens ($1, $2); }
627  | TYPE_NAME_OR_ID { $$ = exprNode_fromIdentifier (coerceId ($1)); } 
628  | QEXTENSION { $$ = exprNode_makeError (); }
629  
630 postfixExpr
631  : primaryExpr 
632  | postfixExpr TLSQBR expr TRSQBR { $$ = exprNode_arrayFetch ($1, $3); }
633  | postfixExpr TLPAREN TRPAREN { $$ = exprNode_functionCall ($1, exprNodeList_new ()); }
634  | postfixExpr TLPAREN argumentExprList TRPAREN { $$ = exprNode_functionCall ($1, $3); }
635  | VA_ARG TLPAREN assignExpr TCOMMA typeExpression TRPAREN { $$ = exprNode_vaArg ($1, $3, $5); }
636  | postfixExpr NotType TDOT newId IsType { $$ = exprNode_fieldAccess ($1, $4); }
637  | postfixExpr NotType ARROW_OP newId IsType { $$ = exprNode_arrowAccess ($1, $4); }
638  | postfixExpr INC_OP { $$ = exprNode_postOp ($1, $2); }
639  | postfixExpr DEC_OP { $$ = exprNode_postOp ($1, $2); }
640  
641 argumentExprList
642  : assignExpr { $$ = exprNodeList_singleton ($1); }
643  | argumentExprList TCOMMA assignExpr { $$ = exprNodeList_push ($1, $3); }
644  
645 unaryExpr
646  : postfixExpr 
647  | INC_OP unaryExpr { $$ = exprNode_preOp ($2, $1); }
648  | DEC_OP unaryExpr { $$ = exprNode_preOp ($2, $1); }
649  | TAMPERSAND castExpr { $$ = exprNode_preOp ($2, $1); }
650  | TMULT castExpr  { $$ = exprNode_preOp ($2, $1); }
651  | TPLUS castExpr  { $$ = exprNode_preOp ($2, $1); }
652  | TMINUS castExpr { $$ = exprNode_preOp ($2, $1); }
653  | TTILDE castExpr { $$ = exprNode_preOp ($2, $1); }
654  | TEXCL castExpr  { $$ = exprNode_preOp ($2, $1); }
655  | sizeofExpr      { $$ = $1; }
656  | offsetofExpr    { $$ = $1; }
657
658 fieldDesignator
659  : fieldDesignator TDOT newId { $$ = cstringList_add ($1, $3); }
660  | newId                      { $$ = cstringList_single ($1); }
661
662 offsetofExpr
663  : COFFSETOF IsType TLPAREN typeExpression NotType TCOMMA fieldDesignator TRPAREN IsType
664    { $$ = exprNode_offsetof ($4, $7); }
665
666 sizeofExpr
667  : IsType { context_setProtectVars (); } 
668    sizeofExprAux { context_sizeofReleaseVars (); $$ = $3; }
669
670 sizeofExprAux 
671  : CSIZEOF TLPAREN typeExpression TRPAREN { $$ = exprNode_sizeofType ($3); } 
672  | CSIZEOF unaryExpr                      { $$ = exprNode_sizeofExpr ($2); }
673  | CALIGNOF TLPAREN typeExpression TRPAREN { $$ = exprNode_alignofType ($3); } 
674  | CALIGNOF unaryExpr                      { $$ = exprNode_alignofExpr ($2); }
675  
676 castExpr
677  : unaryExpr 
678  | TLPAREN typeExpression TRPAREN castExpr 
679    { $$ = exprNode_cast ($1, $4, $2); } 
680  
681 timesExpr
682  : castExpr 
683  | timesExpr TMULT castExpr { $$ = exprNode_op ($1, $3, $2); }
684  | timesExpr TDIV castExpr { $$ = exprNode_op ($1, $3, $2); }
685  | timesExpr TPERCENT castExpr { $$ = exprNode_op ($1, $3, $2); }
686
687 plusExpr
688  : timesExpr 
689  | plusExpr TPLUS timesExpr { $$ = exprNode_op ($1, $3, $2); }
690  | plusExpr TMINUS timesExpr { $$ = exprNode_op ($1, $3, $2); }
691
692 shiftExpr
693  : plusExpr 
694  | shiftExpr LEFT_OP plusExpr { $$ = exprNode_op ($1, $3, $2); }
695  | shiftExpr RIGHT_OP plusExpr { $$ = exprNode_op ($1, $3, $2); }
696
697 relationalExpr
698  : shiftExpr 
699  | relationalExpr TLT shiftExpr { $$ = exprNode_op ($1, $3, $2); }
700  | relationalExpr TGT shiftExpr { $$ = exprNode_op ($1, $3, $2); }
701  | relationalExpr LE_OP shiftExpr { $$ = exprNode_op ($1, $3, $2); }
702  | relationalExpr GE_OP shiftExpr { $$ = exprNode_op ($1, $3, $2); }
703  
704 equalityExpr 
705  : relationalExpr 
706  | equalityExpr EQ_OP relationalExpr { $$ = exprNode_op ($1, $3, $2); }
707  | equalityExpr NE_OP relationalExpr { $$ = exprNode_op ($1, $3, $2); }
708
709 bitandExpr
710  : equalityExpr 
711  | bitandExpr TAMPERSAND equalityExpr { $$ = exprNode_op ($1, $3, $2); }
712
713 xorExpr
714  : bitandExpr 
715  | xorExpr TCIRC bitandExpr { $$ = exprNode_op ($1, $3, $2); }
716
717
718 bitorExpr
719  : xorExpr 
720  | bitorExpr TBAR xorExpr { $$ = exprNode_op ($1, $3, $2); }
721
722 andExpr 
723  : bitorExpr 
724  | andExpr AND_OP 
725    { exprNode_produceGuards ($1); 
726      context_enterAndClause ($1); 
727    } 
728    bitorExpr 
729    { 
730      $$ = exprNode_op ($1, $4, $2); 
731      context_exitAndClause ($$, $4);
732    }
733
734 orExpr
735  : andExpr 
736  | orExpr OR_OP 
737    { 
738      exprNode_produceGuards ($1);
739      context_enterOrClause ($1); 
740    } 
741    andExpr 
742    { 
743      $$ = exprNode_op ($1, $4, $2); 
744      context_exitOrClause ($$, $4);
745    }
746
747 conditionalExpr 
748  : orExpr 
749  | orExpr TQUEST { exprNode_produceGuards ($1); context_enterTrueClause ($1); } expr TCOLON 
750    { context_enterFalseClause ($1); } conditionalExpr
751    { $$ = exprNode_cond ($1, $4, $7); context_exitClause ($1, $4, $7); }
752
753 assignExpr
754  : conditionalExpr 
755  | unaryExpr TASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } 
756  | unaryExpr MUL_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } 
757  | unaryExpr DIV_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } 
758  | unaryExpr MOD_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } 
759  | unaryExpr ADD_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } 
760  | unaryExpr SUB_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } 
761  | unaryExpr LEFT_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } 
762  | unaryExpr RIGHT_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } 
763  | unaryExpr AND_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } 
764  | unaryExpr XOR_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } 
765  | unaryExpr OR_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } 
766
767 expr
768  : assignExpr 
769  | expr TCOMMA assignExpr { $$ = exprNode_comma ($1, $3); } 
770
771 optExpr
772  : /* empty */ { $$ = exprNode_undefined; }
773  | expr 
774
775 constantExpr
776  : conditionalExpr 
777
778 /* instance_orTypeDecl_and_possible_initialization */
779
780 initializer
781  : instanceDecl { $$ = $1; }
782  | VA_DCL       { doVaDcl (); $$ = exprNode_makeError (); } 
783  | typeDecl     { $$ = exprNode_makeError (); }
784
785 instanceDecl
786  : completeTypeSpecifier IsType TSEMI { $$ = exprNode_makeError (); }
787     /*
788      ** This causes r/r conflicts with function definitions.
789      ** Instead we need to snarf one first. (gack)
790      **
791      ** | completeTypeSpecifier { setProcessingVars ($1); } 
792      ** NotType 
793      ** namedInitializerList IsType TSEMI 
794      ** { unsetProcessingVars (); }
795      **;
796      **
797      ** the solution is pretty ugly:
798      */
799  | completeTypeSpecifier NotType namedDecl NotType 
800    {
801                setProcessingVars ($1); 
802      processNamedDecl ($3); }
803    IsType optDeclarators TSEMI IsType { unsetProcessingVars (); $$ = $7; }
804  | completeTypeSpecifier NotType namedDecl NotType TASSIGN 
805    { setProcessingVars ($1); processNamedDecl ($3); 
806         }
807    IsType init optDeclarators TSEMI IsType 
808    { $$ = exprNode_concat ($9, exprNode_makeInitialization ($3, $8)); 
809      unsetProcessingVars ();
810    }
811 namedInitializer
812  : namedDecl NotType { processNamedDecl ($1); $$ = exprNode_makeError (); }
813  | namedDecl NotType TASSIGN { processNamedDecl ($1); } IsType init
814    { $$ = exprNode_makeInitialization ($1, $6); }
815
816
817 typeDecl
818  : CTYPEDEF completeTypeSpecifier { setProcessingTypedef ($2); } 
819    NotType namedInitializerList IsType TSEMI { unsetProcessingTypedef (); } 
820  | CTYPEDEF completeTypeSpecifier IsType TSEMI { /* in the ANSI grammar, semantics unclear */ }
821  | CTYPEDEF namedInitializerList IsType TSEMI { /* in the ANSI grammar, semantics unclear */ } 
822
823 IsType
824  : { g_expectingTypeName = TRUE; }
825
826 PushType
827  : { g_expectingTypeName = TRUE; context_pushLoc (); }
828
829 namedInitializerList
830  :  namedInitializerListAux IsType { ; }
831
832 namedInitializerListAux
833  : namedInitializer { ; }
834  | namedInitializerList TCOMMA NotType namedInitializer { ; }
835
836 optDeclarators
837  : /* empty */      { $$ = exprNode_makeError (); }
838  | optDeclarators TCOMMA NotType namedInitializer { $$ = exprNode_concat ($1, $4); }
839
840 init
841  : assignExpr                      { $$ = $1; }
842  | TLBRACE initList TRBRACE        { $$ = exprNode_makeInitBlock ($1, $2); }
843  | TLBRACE initList TCOMMA TRBRACE { $$ = exprNode_makeInitBlock ($1, $2); }
844
845
846 initList
847  : init 
848    { $$ = exprNodeList_singleton ($1); }
849  | initList TCOMMA init 
850    { $$ = exprNodeList_push ($1, $3); }
851
852 /*
853 ** need to do the storage class global hack so tags are
854 ** declared with the right storage class.
855 */
856
857 storageSpecifier
858  : QEXTERN   { setStorageClass (SCEXTERN); $$ = qual_createExtern (); }
859  | QINLINE   { $$ = qual_createInline (); }
860  | QSTATIC   { setStorageClass (SCSTATIC); $$ = qual_createStatic (); }
861  | QAUTO     { $$ = qual_createAuto (); }
862  | QREGISTER { $$ = qual_createRegister (); }
863
864 typeQualifier
865  : QCONST IsType       { $$ = qual_createConst (); }
866  | QVOLATILE IsType    { $$ = qual_createVolatile (); }
867  | QOUT IsType         { $$ = qual_createOut (); }
868  | QIN IsType          { $$ = qual_createIn (); }
869  | QPARTIAL IsType     { $$ = qual_createPartial (); }
870  | QSPECIAL IsType     { $$ = qual_createSpecial (); }
871  | QOWNED IsType       { $$ = qual_createOwned (); }
872  | QDEPENDENT IsType   { $$ = qual_createDependent (); }
873  | QYIELD IsType       { $$ = qual_createYield (); }
874  | QTEMP IsType        { $$ = qual_createTemp (); }
875  | QONLY IsType        { $$ = qual_createOnly (); }
876  | QKEEP IsType        { $$ = qual_createKeep (); }
877  | QKEPT IsType        { $$ = qual_createKept (); }
878  | QSHARED IsType      { $$ = qual_createShared (); }
879  | QUNIQUE IsType      { $$ = qual_createUnique (); }
880  | QEXITS IsType       { $$ = qual_createExits (); }
881  | QMAYEXIT IsType     { $$ = qual_createMayExit (); }
882  | QTRUEEXIT IsType    { $$ = qual_createTrueExit (); }
883  | QFALSEEXIT IsType   { $$ = qual_createFalseExit (); }
884  | QNEVEREXIT IsType   { $$ = qual_createNeverExit (); }
885  | QNULL IsType        { $$ = qual_createNull (); }
886  | QRELNULL IsType     { $$ = qual_createRelNull (); }
887  | QRETURNED IsType    { $$ = qual_createReturned (); }
888  | QEXPOSED IsType     { $$ = qual_createExposed (); }
889  | QOBSERVER IsType    { $$ = qual_createObserver (); }
890  | QCHECKED IsType     { $$ = qual_createChecked (); }
891  | QCHECKMOD IsType    { $$ = qual_createCheckMod (); }
892  | QUNCHECKED IsType   { $$ = qual_createUnchecked (); }
893  | QCHECKEDSTRICT IsType  { $$ = qual_createCheckedStrict (); }
894  | QTRUENULL IsType    { $$ = qual_createTrueNull (); }
895  | QFALSENULL IsType   { $$ = qual_createFalseNull (); }
896  | QUNUSED IsType      { $$ = qual_createUnused (); }
897  | QEXTERNAL IsType    { $$ = qual_createExternal (); }
898  | QSEF IsType         { $$ = qual_createSef (); }
899  | QABSTRACT IsType    { $$ = qual_createAbstract (); }
900  | QCONCRETE IsType    { $$ = qual_createConcrete (); }
901  | QMUTABLE IsType     { $$ = qual_createMutable (); }
902  | QIMMUTABLE IsType   { $$ = qual_createImmutable (); }
903  | QNOTNULL IsType     { $$ = qual_createNotNull (); }
904  | QREFCOUNTED IsType  { $$ = qual_createRefCounted (); }
905  | QREFS IsType        { $$ = qual_createRefs (); }
906  | QKILLREF IsType     { $$ = qual_createKillRef (); }
907  | QRELDEF IsType      { $$ = qual_createRelDef (); }
908  | QNEWREF IsType      { $$ = qual_createNewRef (); }
909  | QTEMPREF IsType     { $$ = qual_createTempRef (); }
910  | QNULLTERMINATED IsType { $$ = qual_createNullTerminated (); }
911
912 typeModifier
913  : QSHORT            { $$ = qual_createShort (); }
914  | QLONG             { $$ = qual_createLong (); }
915  | QSIGNED           { $$ = qual_createSigned (); }
916  | QUNSIGNED         { $$ = qual_createUnsigned (); }
917
918 typeSpecifier
919  : CGCHAR NotType 
920  | CINT NotType 
921  | CBOOL NotType
922  | CGFLOAT NotType
923  | CDOUBLE NotType
924  | CVOID NotType 
925  | QANYTYPE NotType              { $$ = ctype_unknown; }
926  | QINTEGRALTYPE NotType         { $$ = ctype_anyintegral; }
927  | QUNSIGNEDINTEGRALTYPE NotType { $$ = ctype_unsignedintegral; }
928  | QSIGNEDINTEGRALTYPE NotType   { $$ = ctype_signedintegral; }
929  | typeName NotType     
930  | suSpc NotType 
931  | enumSpc NotType
932  | typeModifier NotType { $$ = ctype_fromQual ($1); }
933
934 completeType
935  : IsType completeTypeSpecifier IsType
936    { $$ = qtype_resolve ($2); }
937
938 completeTypeSpecifier
939  : completeTypeSpecifierAux { $$ = $1; }
940  | completeTypeSpecifierAux QALT altType QENDMACRO  
941    { $$ = qtype_mergeAlt ($1, $3); }
942
943 altType
944  : typeExpression
945  | typeExpression TCOMMA altType
946    { $$ = qtype_mergeAlt ($1, $3); } 
947
948 completeTypeSpecifierAux
949  : storageSpecifier optCompleteType        { $$ = qtype_addQual ($2, $1); }
950  | typeQualifier optCompleteType           { $$ = qtype_addQual ($2, $1); } 
951  | typeSpecifier optCompleteType           { $$ = qtype_combine ($2, $1); }
952
953 optCompleteType
954  : /* empty */                             { $$ = qtype_unknown (); }
955  | completeTypeSpecifier                   { $$ = $1; }
956
957 suSpc
958  : NotType CSTRUCT newId IsType TLBRACE { sRef_setGlobalScopeSafe (); } 
959    CreateStructInnerScope 
960    structDeclList DeleteStructInnerScope { sRef_clearGlobalScopeSafe (); }
961    TRBRACE 
962    { $$ = declareStruct ($3, $8); }
963  | NotType CUNION  newId IsType TLBRACE { sRef_setGlobalScopeSafe (); } 
964    CreateStructInnerScope 
965    structDeclList DeleteStructInnerScope { sRef_clearGlobalScopeSafe (); } 
966    TRBRACE
967    { $$ = declareUnion ($3, $8); } 
968  | NotType CSTRUCT newId IsType TLBRACE TRBRACE 
969    { $$ = declareStruct ($3, uentryList_new ()); }
970  | NotType CUNION  newId IsType TLBRACE TRBRACE 
971    { $$ = declareUnion ($3, uentryList_new ()); }
972  | NotType CSTRUCT IsType TLBRACE { sRef_setGlobalScopeSafe (); } 
973    CreateStructInnerScope 
974    structDeclList DeleteStructInnerScope { sRef_clearGlobalScopeSafe (); }
975    TRBRACE 
976    { $$ = declareUnnamedStruct ($7); }
977  | NotType CUNION  IsType TLBRACE { sRef_setGlobalScopeSafe (); } 
978    CreateStructInnerScope 
979    structDeclList DeleteStructInnerScope { sRef_clearGlobalScopeSafe (); }
980    TRBRACE 
981    { $$ = declareUnnamedUnion ($7); } 
982  | NotType CSTRUCT IsType TLBRACE TRBRACE
983    { $$ = ctype_createUnnamedStruct (uentryList_new ()); }
984  | NotType CUNION  IsType TLBRACE TRBRACE 
985    { $$ = ctype_createUnnamedUnion (uentryList_new ()); } 
986  | NotType CSTRUCT newId NotType { $$ = handleStruct ($3); } 
987  | NotType CUNION  newId NotType { $$ = handleUnion ($3); }
988
989 NotType
990  : { g_expectingTypeName = FALSE; }
991
992 structDeclList
993  : structDecl 
994  | macroDef { $$ = uentryList_undefined; /* bogus! */ }
995  | structDeclList structDecl { $$ = uentryList_mergeFields ($1, $2); }
996
997 structDecl
998  : completeTypeSpecifier NotType structNamedDeclList IsType TSEMI 
999    { $$ = fixUentryList ($3, $1); }
1000  | completeTypeSpecifier IsType TSEMI 
1001    { $$ = fixUnnamedDecl ($1); }
1002
1003 structNamedDeclList 
1004  : structNamedDecl NotType                            
1005    { $$ = idDeclList_singleton ($1); }
1006  | structNamedDeclList TCOMMA structNamedDecl NotType
1007    { $$ = idDeclList_add ($1, $3); }
1008
1009 structNamedDecl  /* hack to get around namespace problems */ 
1010  : namedDecl                            { $$ = $1; }
1011  | TCOLON IsType constantExpr           { $$ = idDecl_undefined; }
1012  | namedDecl TCOLON IsType constantExpr { $$ = $1; }
1013    /* Need the IsType in case there is a cast in the constant expression. */
1014
1015 enumSpc
1016  : NotType CENUM TLBRACE enumeratorList TRBRACE IsType 
1017    { $$ = declareUnnamedEnum ($4); }
1018  | NotType CENUM newId TLBRACE { context_pushLoc (); } enumeratorList TRBRACE IsType
1019    { context_popLoc (); $$ = declareEnum ($3, $6); }
1020  | NotType CENUM newId IsType { $$ = handleEnum ($3); }
1021
1022 enumeratorList
1023  : enumerator 
1024    { $$ = enumNameList_single ($1); }
1025  | enumeratorList TCOMMA enumerator 
1026    { $$ = enumNameList_push ($1, $3); }
1027  | enumeratorList TCOMMA
1028
1029 enumerator
1030  : newId 
1031    { uentry ue = uentry_makeEnumConstant ($1, ctype_unknown);
1032      usymtab_supGlobalEntry (ue);
1033      $$ = $1;
1034    }
1035  | newId TASSIGN IsType constantExpr 
1036    { uentry ue = uentry_makeEnumInitializedConstant ($1, ctype_unknown, $4);
1037      usymtab_supGlobalEntry (ue);
1038      $$ = $1; 
1039    }
1040
1041 optNamedDecl
1042  : namedDeclBase
1043  | optAbstractDeclBase   { $$ = idDecl_create (cstring_undefined, qtype_create ($1)); }
1044  | pointers TYPE_NAME    
1045    { 
1046      qtype qt = qtype_unknown ();
1047
1048      qtype_adjustPointers ($1, qt);
1049      $$ = idDecl_create (cstring_copy (LastIdentifier ()), qt);
1050    }
1051  | pointers optNamedDecl 
1052    { $$ = $2; qtype_adjustPointers ($1, idDecl_getTyp ($$)); }
1053
1054 namedDecl
1055  : namedDeclBase
1056  | pointers namedDeclBase 
1057    { $$ = $2; qtype_adjustPointers ($1, idDecl_getTyp ($$)); }
1058
1059 genericParamList
1060  : paramTypeList       { $$ = handleParamTypeList ($1); }
1061  | NotType paramIdList { $$ = handleParamIdList ($2); }  
1062
1063 innerMods
1064  : QCONST    { /* ignored for now */; }
1065  | QVOLATILE { ; }
1066
1067 innerModsList
1068  : innerMods { ; }
1069  | innerModsList innerMods { ; }
1070
1071 pointers
1072  : TMULT { $$ = 1; }
1073  | TMULT innerModsList { $$ = 1; }
1074  | TMULT pointers { $$ = 1 + $2; }
1075  | TMULT innerModsList pointers { $$ = 1 + $3; }
1076
1077 paramIdList
1078  : idList 
1079  | idList TCOMMA CTOK_ELIPSIS { $$ = uentryList_add ($1, uentry_makeElipsisMarker ()); }
1080
1081 idList
1082  : newId { $$ = uentryList_single (uentry_makeVariableLoc ($1, ctype_int)); }
1083  | idList TCOMMA newId { $$ = uentryList_add ($1, uentry_makeVariableLoc ($3, ctype_int)); }
1084
1085 paramTypeList
1086  : CTOK_ELIPSIS { $$ = uentryList_single (uentry_makeElipsisMarker ()); }
1087  | paramList 
1088  | paramList TCOMMA CTOK_ELIPSIS { $$ = uentryList_add ($1, uentry_makeElipsisMarker ()); }
1089
1090 paramList
1091  : { storeLoc (); } paramDecl { $$ = uentryList_single ($2); }
1092  | paramList TCOMMA { storeLoc (); } paramDecl 
1093    { $$ = uentryList_add ($1, $4); }
1094
1095 paramDecl
1096  : IsType completeTypeSpecifier optNamedDecl IsType
1097    { 
1098      if (isFlipOldStyle ()) 
1099        { 
1100          llparseerror (cstring_makeLiteral ("Inconsistent function parameter syntax (mixing old and new style declaration)")); 
1101        }
1102      else 
1103        { 
1104          setNewStyle (); 
1105        }
1106      $$ = makeCurrentParam (idDecl_fixParamBase ($3, $2)); 
1107    }
1108  | newId /* its an old-style declaration */
1109    { 
1110      idDecl tparam = idDecl_create ($1, qtype_unknown ());
1111
1112      if (isNewStyle ()) 
1113        {
1114          llparseerror (message ("Inconsistent function parameter syntax: %q",
1115                                 idDecl_unparse (tparam))); 
1116        }
1117
1118      setFlipOldStyle ();
1119      $$ = makeCurrentParam (tparam);
1120      idDecl_free (tparam);
1121    } 
1122
1123 typeExpression
1124  : completeType
1125  | completeType abstractDecl  { $$ = qtype_newBase ($1, $2); }
1126
1127 abstractDecl
1128  : pointers { $$ = ctype_adjustPointers ($1, ctype_unknown); }
1129  | abstractDeclBase
1130  | pointers abstractDeclBase { $$ = ctype_adjustPointers ($1, $2); }
1131
1132 optAbstractDeclBase
1133  : /* empty */ { $$ = ctype_unknown; }
1134  | abstractDeclBase 
1135
1136 abstractDeclBase
1137  : IsType TLPAREN NotType abstractDecl TRPAREN 
1138    { $$ = ctype_expectFunction ($4); }
1139  | TLSQBR TRSQBR { $$ = ctype_makeArray (ctype_unknown); }
1140  | TLSQBR constantExpr TRSQBR { $$ = ctype_makeArray (ctype_unknown); }
1141  | abstractDeclBase TLSQBR TRSQBR { $$ = ctype_makeArray ($1); }
1142  | abstractDeclBase TLSQBR constantExpr TRSQBR { $$ = ctype_makeArray ($1); }
1143  | IsType TLPAREN TRPAREN 
1144    { $$ = ctype_makeFunction (ctype_unknown, uentryList_makeMissingParams ()); }
1145  | IsType TLPAREN paramTypeList TRPAREN 
1146    { $$ = ctype_makeParamsFunction (ctype_unknown, $3); }
1147  | abstractDeclBase IsType TLPAREN TRPAREN 
1148    { $$ = ctype_makeFunction ($1, uentryList_makeMissingParams ()); }  
1149  | abstractDeclBase IsType TLPAREN paramTypeList TRPAREN 
1150    { $$ = ctype_makeParamsFunction ($1, $4); }  
1151
1152 /* statement */
1153
1154 stmt
1155  : labeledStmt 
1156  | caseStmt 
1157  | defaultStmt
1158  | compoundStmt 
1159  | expressionStmt
1160  | selectionStmt 
1161  | iterationStmt 
1162  | iterStmt
1163  | jumpStmt 
1164
1165 iterBody
1166  : iterDefStmtList { $$ = $1; }
1167
1168 endBody
1169  : iterBody
1170
1171 iterDefStmtList
1172  : iterDefStmt                 
1173  | iterDefStmtList iterDefStmt 
1174    { $$ = exprNode_concat ($1, $2); }
1175
1176 iterDefIterationStmt
1177  : iterWhilePred iterDefStmtList         
1178    { $$ = exprNode_while ($1, $2); }
1179  | doHeader stmtErr WHILE TLPAREN expr TRPAREN TSEMI 
1180    { $$ = exprNode_doWhile ($2, $5); }
1181  | doHeader stmtErr WHILE TLPAREN expr TRPAREN
1182    { $$ = exprNode_doWhile ($2, $5); }
1183  | forPred iterDefStmt
1184    { $$ = exprNode_for ($1, $2); } 
1185
1186 forPred
1187  : CFOR TLPAREN optExpr TSEMI optExpr TSEMI 
1188    { context_setProtectVars (); } optExpr { context_sizeofReleaseVars (); }
1189    TRPAREN 
1190    { $$ = exprNode_forPred ($3, $5, $8); 
1191      context_enterForClause ($5); }
1192
1193 partialIterStmt
1194  : ITER_NAME CreateInnerScope TLPAREN 
1195    { setProcessingIterVars ($1); } 
1196    iterArgList TRPAREN 
1197    { $$ = exprNode_iterStart ($1, $5); }
1198  | ITER_ENDNAME { $$ = exprNode_createId ($1); }
1199
1200 iterDefStmt
1201  : labeledStmt 
1202  | caseStmt 
1203  | defaultStmt
1204  | openScope initializerList { $$ = $2; }
1205  | openScope
1206  | closeScope
1207  | expressionStmt
1208  | iterSelectionStmt 
1209  | iterDefIterationStmt 
1210  | partialIterStmt
1211  | jumpStmt 
1212  | TLPAREN iterDefStmt TRPAREN { $$ = $2; }
1213  | error { $$ = exprNode_makeError (); }
1214
1215 iterSelectionStmt
1216  : ifPred iterDefStmt 
1217    { /* don't: context_exitTrueClause ($1, $2); */
1218      $$ = exprNode_if ($1, $2); 
1219    }
1220
1221 openScope
1222  : CreateInnerScope TLBRACE { $$ = exprNode_createTok ($2); }
1223
1224 closeScope
1225  : DeleteInnerScopeSafe TRBRACE { $$ = exprNode_createTok ($2); }
1226
1227 macroBody
1228  : stmtErr    
1229  | stmtListErr
1230  
1231 stmtErr
1232  : labeledStmt
1233  | caseStmt 
1234  | defaultStmt 
1235  | compoundStmtErr
1236  | expressionStmtErr
1237  | selectionStmt 
1238  | iterStmt
1239  | iterationStmtErr
1240  | TLPAREN stmtErr TRPAREN { $$ = exprNode_addParens ($1, $2); }
1241  | jumpStmt 
1242  | error { $$ = exprNode_makeError (); }
1243
1244 labeledStmt
1245  : newId TCOLON      { $$ = exprNode_labelMarker ($1); }
1246  | QNOTREACHED stmt  { $$ = exprNode_notReached ($2); }
1247
1248 /* Note that we can semantically check that the object to the case is
1249  indeed constant. In this case, we may not want to go through this effort */
1250
1251 caseStmt
1252  : CASE constantExpr { context_enterCaseClause ($2); } 
1253    TCOLON            { $$ = exprNode_caseMarker ($2, FALSE); }
1254  | QFALLTHROUGH CASE constantExpr { context_enterCaseClause ($3); } 
1255    TCOLON            { $$ = exprNode_caseMarker ($3, TRUE); }
1256
1257 defaultStmt
1258  : DEFAULT { context_enterCaseClause (exprNode_undefined); } 
1259    TCOLON { $$ = exprNode_defaultMarker ($1, FALSE); }
1260  | QFALLTHROUGH DEFAULT { context_enterCaseClause (exprNode_undefined); } 
1261    TCOLON { $$ = exprNode_defaultMarker ($2, TRUE); }
1262
1263 compoundStmt
1264  : TLPAREN compoundStmt TRPAREN { $$ = $2; }
1265  | CreateInnerScope compoundStmtAux 
1266    { $$ = $2; context_exitInner ($2); }
1267
1268 compoundStmtErr
1269  : CreateInnerScope compoundStmtAuxErr DeleteInnerScope { $$ = $2; }
1270
1271 CreateInnerScope
1272  : { context_enterInnerContext (); }
1273
1274 DeleteInnerScope
1275  : { context_exitInnerPlain (); }
1276
1277 CreateStructInnerScope
1278  : { context_enterStructInnerContext (); }
1279
1280 DeleteStructInnerScope
1281  : { context_exitStructInnerContext (); }
1282
1283 DeleteInnerScopeSafe
1284  : { context_exitInnerSafe (); }
1285
1286 compoundStmtRest
1287  : TRBRACE { $$ = exprNode_createTok ($1); }
1288  | QNOTREACHED TRBRACE { $$ = exprNode_notReached (exprNode_createTok ($2)); }
1289  | stmtList TRBRACE { $$ = exprNode_updateLocation ($1, lltok_getLoc ($2)); }
1290  | stmtList QNOTREACHED TRBRACE 
1291    { $$ = exprNode_notReached (exprNode_updateLocation ($1, lltok_getLoc ($3))); }
1292  | initializerList TRBRACE { $$ = exprNode_updateLocation ($1, lltok_getLoc ($2)); }
1293  | initializerList QNOTREACHED TRBRACE 
1294    { $$ = exprNode_notReached (exprNode_updateLocation ($1, lltok_getLoc ($3))); }
1295  | initializerList stmtList TRBRACE
1296    { $$ = exprNode_updateLocation (exprNode_concat ($1, $2), lltok_getLoc ($3)); }
1297  | initializerList stmtList QNOTREACHED TRBRACE
1298    { $$ = exprNode_notReached (exprNode_updateLocation (exprNode_concat ($1, $2), 
1299                                                         lltok_getLoc ($3))); 
1300    }
1301
1302
1303 compoundStmtAux
1304  : TLBRACE compoundStmtRest 
1305    { $$ = exprNode_makeBlock ($2); }
1306
1307 compoundStmtAuxErr
1308  : TLBRACE TRBRACE 
1309    { $$ = exprNode_createTok ($2); }
1310  | TLBRACE stmtListErr TRBRACE 
1311    { $$ = exprNode_updateLocation ($2, lltok_getLoc ($3)); }
1312  | TLBRACE initializerList TRBRACE 
1313    { $$ = exprNode_updateLocation ($2, lltok_getLoc ($3)); }
1314  | TLBRACE initializerList stmtList TRBRACE 
1315    { $$ = exprNode_updateLocation (exprNode_concat ($2, $3), lltok_getLoc ($4)); }
1316
1317 stmtListErr
1318  : stmtErr 
1319  | stmtListErr stmtErr { $$ = exprNode_concat ($1, $2); }
1320
1321 initializerList
1322  : initializer { $$ = $1; }
1323  | initializerList initializer { $$ = exprNode_concat ($1, $2); }
1324
1325 stmtList
1326  : stmt { $$ = $1; }
1327  | stmtList stmt { $$ = exprNode_concat ($1, $2); }
1328  
1329 expressionStmt 
1330  : TSEMI { $$ = exprNode_createTok ($1); }
1331  | expr TSEMI { $$ = exprNode_statement ($1); }
1332
1333 expressionStmtErr
1334  : TSEMI { $$ = exprNode_createTok ($1); }
1335  | expr TSEMI { $$ = exprNode_statement ($1); }
1336  | expr { $$ = exprNode_checkExpr ($1); } 
1337
1338 ifPred
1339  : CIF TLPAREN expr TRPAREN 
1340    { $$ = $3; exprNode_produceGuards ($3); context_enterTrueClause ($3); }
1341  /*
1342  ** not ANSI: | CIF TLPAREN compoundStmt TRPAREN 
1343  **             { $$ = $3; context_enterTrueClause (); } 
1344  */
1345
1346 selectionStmt
1347  : ifPred stmt 
1348    { 
1349      context_exitTrueClause ($1, $2);
1350      $$ = exprNode_if ($1, $2); 
1351    }
1352  | ifPred stmt CELSE { context_enterFalseClause ($1); } stmt 
1353    {
1354      context_exitClause ($1, $2, $5);
1355      $$ = exprNode_ifelse ($1, $2, $5); 
1356    }
1357  | SWITCH TLPAREN expr { context_enterSwitch ($3); } 
1358    TRPAREN stmt        { $$ = exprNode_switch ($3, $6); }
1359  
1360 whilePred
1361  : WHILE TLPAREN expr TRPAREN 
1362    { $$ = exprNode_whilePred ($3); context_enterWhileClause ($3); }
1363    /* not ANSI: | WHILE TLPAREN compoundStmt TRPAREN stmt { $$ = exprNode_while ($3, $5); } */
1364
1365 iterWhilePred
1366  : WHILE TLPAREN expr TRPAREN { $$ = exprNode_whilePred($3); }
1367
1368 iterStmt
1369  : ITER_NAME { context_enterIterClause (); } 
1370    CreateInnerScope TLPAREN { setProcessingIterVars ($1); } 
1371    iterArgList TRPAREN 
1372    compoundStmt endIter DeleteInnerScope
1373    { 
1374      $$ = exprNode_iter ($1, $6, $8, $9); 
1375
1376    } 
1377  
1378 iterArgList 
1379  : iterArgExpr { $$ = exprNodeList_singleton ($1); }
1380  | iterArgList { nextIterParam (); } TCOMMA iterArgExpr 
1381    { $$ = exprNodeList_push ($1, $4); }
1382
1383 iterArgExpr
1384   : assignIterExpr  { $$ = exprNode_iterExpr ($1); }
1385   | id              { $$ = exprNode_iterId ($1); }
1386   | TYPE_NAME_OR_ID { uentry ue = coerceIterId ($1);
1387
1388                       if (uentry_isValid (ue)) 
1389                         {
1390                           $$ = exprNode_iterId (ue);
1391                         }
1392                       else
1393                         {
1394                           $$ = exprNode_iterNewId (cstring_copy (LastIdentifier ()));
1395                         }
1396                     }
1397   | NEW_IDENTIFIER  { $$ = exprNode_iterNewId ($1); }
1398
1399 /*
1400 ** everything is the same, EXCEPT it cannot be a NEW_IDENTIFIER 
1401 */
1402
1403 primaryIterExpr
1404  : CCONSTANT 
1405  | TLPAREN expr TRPAREN { $$ = exprNode_addParens ($1, $2); }
1406  
1407 postfixIterExpr
1408  : primaryIterExpr 
1409  | postfixExpr TLSQBR expr TRSQBR { $$ = exprNode_arrayFetch ($1, $3); }
1410  | postfixExpr TLPAREN TRPAREN { $$ = exprNode_functionCall ($1, exprNodeList_new ()); }
1411  | postfixExpr TLPAREN argumentExprList TRPAREN { $$ = exprNode_functionCall ($1, $3); }
1412  | VA_ARG TLPAREN assignExpr TCOMMA typeExpression TRPAREN
1413        { $$ = exprNode_vaArg ($1, $3, $5); }
1414  | postfixExpr NotType TDOT newId IsType { $$ = exprNode_fieldAccess ($1, $4); }
1415  | postfixExpr NotType ARROW_OP newId IsType { $$ = exprNode_arrowAccess ($1, $4); }
1416  | postfixExpr INC_OP { $$ = exprNode_postOp ($1, $2); }
1417  | postfixExpr DEC_OP { $$ = exprNode_postOp ($1, $2); }
1418  
1419 unaryIterExpr
1420  : postfixIterExpr 
1421  | INC_OP unaryExpr    { $$ = exprNode_preOp ($2, $1); }
1422  | DEC_OP unaryExpr    { $$ = exprNode_preOp ($2, $1); }
1423  | TAMPERSAND castExpr { $$ = exprNode_preOp ($2, $1); }
1424  | TMULT castExpr      { $$ = exprNode_preOp ($2, $1); }
1425  | TPLUS castExpr      { $$ = exprNode_preOp ($2, $1); }
1426  | TMINUS castExpr     { $$ = exprNode_preOp ($2, $1); }
1427  | TTILDE castExpr     { $$ = exprNode_preOp ($2, $1); }
1428  | TEXCL castExpr      { $$ = exprNode_preOp ($2, $1); }
1429  | sizeofExpr          { $$ = $1; }
1430
1431 castIterExpr
1432  : unaryIterExpr 
1433  | TLPAREN typeExpression TRPAREN castExpr { $$ = exprNode_cast ($1, $4, $2); } 
1434  
1435 timesIterExpr
1436  : castIterExpr 
1437  | timesExpr TMULT castExpr { $$ = exprNode_op ($1, $3, $2); }
1438  | timesExpr TDIV castExpr { $$ = exprNode_op ($1, $3, $2); }
1439  | timesExpr TPERCENT castExpr { $$ = exprNode_op ($1, $3, $2); }
1440
1441 plusIterExpr
1442  : timesIterExpr 
1443  | plusExpr TPLUS timesExpr { $$ = exprNode_op ($1, $3, $2); }
1444  | plusExpr TMINUS timesExpr { $$ = exprNode_op ($1, $3, $2); }
1445
1446 shiftIterExpr
1447  : plusIterExpr 
1448  | shiftExpr LEFT_OP plusExpr { $$ = exprNode_op ($1, $3, $2); }
1449  | shiftExpr RIGHT_OP plusExpr { $$ = exprNode_op ($1, $3, $2); }
1450
1451 relationalIterExpr
1452  : shiftIterExpr 
1453  | relationalExpr TLT shiftExpr { $$ = exprNode_op ($1, $3, $2); }
1454  | relationalExpr TGT shiftExpr { $$ = exprNode_op ($1, $3, $2); }
1455  | relationalExpr LE_OP shiftExpr { $$ = exprNode_op ($1, $3, $2); }
1456  | relationalExpr GE_OP shiftExpr { $$ = exprNode_op ($1, $3, $2); }
1457  
1458 equalityIterExpr 
1459  : relationalIterExpr 
1460  | equalityExpr EQ_OP relationalExpr { $$ = exprNode_op ($1, $3, $2); }
1461  | equalityExpr NE_OP relationalExpr { $$ = exprNode_op ($1, $3, $2); }
1462
1463 bitandIterExpr
1464  : equalityIterExpr 
1465  | bitandExpr TAMPERSAND equalityExpr { $$ = exprNode_op ($1, $3, $2); }
1466
1467 xorIterExpr
1468  : bitandIterExpr 
1469  | xorExpr TCIRC bitandExpr { $$ = exprNode_op ($1, $3, $2); }
1470
1471
1472 bitorIterExpr
1473  : xorIterExpr 
1474  | bitorExpr TBAR xorExpr { $$ = exprNode_op ($1, $3, $2); }
1475
1476 andIterExpr 
1477  : bitorIterExpr 
1478  | andExpr AND_OP bitorExpr { $$ = exprNode_op ($1, $3, $2); }
1479
1480 orIterExpr
1481  : andIterExpr 
1482  | orExpr OR_OP andExpr { $$ = exprNode_op ($1, $3, $2); }
1483
1484 conditionalIterExpr 
1485  : orIterExpr 
1486  | orExpr TQUEST { context_enterTrueClause ($1); } 
1487    expr TCOLON { context_enterFalseClause ($1); } conditionalExpr
1488    { $$ = exprNode_cond ($1, $4, $7); }
1489
1490 assignIterExpr
1491  : conditionalIterExpr 
1492  | unaryExpr TASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } 
1493  | unaryExpr MUL_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } 
1494  | unaryExpr DIV_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } 
1495  | unaryExpr MOD_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } 
1496  | unaryExpr ADD_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } 
1497  | unaryExpr SUB_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } 
1498  | unaryExpr LEFT_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } 
1499  | unaryExpr RIGHT_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } 
1500  | unaryExpr AND_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } 
1501  | unaryExpr XOR_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } 
1502  | unaryExpr OR_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } 
1503
1504 endIter
1505  : ITER_ENDNAME { $$ = $1; }
1506  | /* empty */  { $$ = uentry_undefined; } 
1507
1508 doHeader
1509  : DO { context_enterDoWhileClause (); $$ = $1; }
1510   
1511 iterationStmt 
1512  : whilePred stmt 
1513    { $$ = exprNode_while ($1, $2); context_exitWhileClause ($1, $2); }
1514  | doHeader stmt WHILE TLPAREN expr TRPAREN TSEMI 
1515    { $$ = exprNode_statement (exprNode_doWhile ($2, $5)); }
1516  | forPred stmt 
1517    { $$ = exprNode_for ($1, $2); context_exitForClause ($1, $2); }
1518
1519 iterationStmtErr 
1520  : whilePred stmtErr { $$ = exprNode_while ($1, $2); context_exitWhileClause ($1, $2); }
1521  | doHeader stmtErr WHILE TLPAREN expr TRPAREN TSEMI
1522    { $$ = exprNode_statement (exprNode_doWhile ($2, $5)); }
1523  | doHeader stmtErr WHILE TLPAREN expr TRPAREN 
1524    { $$ = exprNode_doWhile ($2, $5); }
1525  | forPred stmtErr { $$ = exprNode_for ($1, $2); context_exitForClause ($1, $2); }
1526  
1527 jumpStmt
1528  : GOTO newId TSEMI         { $$ = exprNode_goto ($2); }
1529  | CONTINUE TSEMI           { $$ = exprNode_continue ($1, BADTOK); }
1530  | QINNERCONTINUE CONTINUE TSEMI    
1531                             { $$ = exprNode_continue ($1, QINNERCONTINUE); }
1532  | BREAK TSEMI              { $$ = exprNode_break ($1, BADTOK); }
1533  | QSWITCHBREAK BREAK TSEMI { $$ = exprNode_break ($2, QSWITCHBREAK); }
1534  | QLOOPBREAK BREAK TSEMI   { $$ = exprNode_break ($2, QLOOPBREAK); }
1535  | QINNERBREAK BREAK TSEMI  { $$ = exprNode_break ($2, QINNERBREAK); }
1536  | QSAFEBREAK BREAK TSEMI   { $$ = exprNode_break ($2, QSAFEBREAK); }
1537  | RETURN TSEMI             { $$ = exprNode_nullReturn ($1); }
1538  | RETURN expr TSEMI        { $$ = exprNode_return ($2); }
1539  
1540 optSemi
1541  : 
1542  | TSEMI { ; } 
1543
1544 id
1545  : IDENTIFIER 
1546
1547 newId
1548  : NEW_IDENTIFIER 
1549  | ITER_NAME       { $$ = uentry_getName ($1); }
1550  | ITER_ENDNAME    { $$ = uentry_getName ($1); }
1551  | id              { $$ = uentry_getName ($1); }
1552  | TYPE_NAME_OR_ID { $$ = $1; } 
1553
1554 typeName
1555  : TYPE_NAME
1556  | TYPE_NAME_OR_ID { $$ = ctype_unknown; }
1557
1558 %%
1559
1560 /*@-redecl@*/
1561 extern char *yytext;
1562 /*@=redecl@*/
1563
1564 # include "bison.reset"
1565
1566 void yyerror (/*@unused@*/ char *s) 
1567 {
1568   static bool givehint = FALSE;
1569
1570   if (context_inIterDef ())
1571     {
1572       llerror (FLG_SYNTAX, message ("Iter syntax not parseable: %s", 
1573                                     context_inFunctionName ()));
1574     }
1575   else if (context_inIterEnd ())
1576     {
1577       llerror (FLG_SYNTAX, message ("Iter finalizer syntax not parseable: %s", 
1578                                     context_inFunctionName ()));
1579     }
1580   else if (context_inMacro ())
1581     {
1582       llerror (FLG_SYNTAX, message ("Macro syntax not parseable: %s", 
1583                                     context_inFunctionName ()));
1584       
1585       if (context_inMacroUnknown ())
1586         {
1587           if (!givehint)
1588             {
1589               llhint (cstring_makeLiteral 
1590                      ("Precede macro definition with /*@notfunction@*/ "
1591                       "to suppress checking and force expansion"));
1592               givehint = TRUE;
1593             }
1594         }
1595
1596       swallowMacro ();
1597     }
1598   else
1599     {
1600       llparseerror (cstring_undefined);
1601     }
1602 }
1603
1604 void printState (idDecl t) {
1605  cstring id = idDecl_getName (t);
1606  uentry ue = usymtab_lookupSafe (id);
1607
1608  sRef s = uentry_getSref (ue);
1609  
1610  printf("State = %d\n", s->bufinfo.bufstate);
1611 }
This page took 0.150389 seconds and 3 git commands to generate.