2 ** Splint - annotation-assisted static program checker
3 ** Copyright (C) 1994-2003 University of Virginia,
4 ** Massachusetts Institute of Technology
6 ** This program is free software; you can redistribute it and/or modify it
7 ** under the terms of the GNU General Public License as published by the
8 ** Free Software Foundation; either version 2 of the License, or (at your
9 ** option) any later version.
11 ** This program is distributed in the hope that it will be useful, but
12 ** WITHOUT ANY WARRANTY; without even the implied warranty of
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 ** General Public License for more details.
16 ** The GNU General Public License is available from http://www.gnu.org/ or
17 ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
18 ** MA 02111-1307, USA.
20 ** For information on splint: info@splint.org
21 ** To report a bug: splint-bug@splint.org
22 ** For more information: http://www.splint.org
29 ** Yacc/Bison grammar for extended ANSI C used by Splint.
31 ** original grammar by Nate Osgood ---
32 ** hacrat@catfish.lcs.mit.edu Mon Jun 14 13:06:32 1993
34 ** changes for Splint --- handle typedef names correctly
35 ** fix struct/union parsing bug (empty struct is accepted)
36 ** add productions to handle macros --- require
37 ** error correction --- main source of conflicts in grammar.
38 ** need to process initializations sequentially, L->R
40 ** production names are cryptic, so more productions fit on one line
42 ** conflicts: 87 shift/reduce, 18 reduce/reduce
43 ** most of these are due to handling macros
44 ** a few are due to handling type expressions
50 extern void yyerror (char *);
52 # include "splintMacros.nf"
54 # include "cscanner.h"
55 # include "cscannerHelp.h"
56 # include "cgrammar.h"
57 # include "exprChecks.h"
62 # define SHOWCSYM FALSE
65 ** This is necessary, or else when the bison-generated code #include's malloc.h,
66 ** there will be a parse error.
68 ** Unfortunately, it means the error checking on malloc, etc. is lost for allocations
69 ** in bison-generated files under Win32.
87 /*@dependent@*/ sRef sr;
90 /*@only@*/ functionClauseList funcclauselist;
91 /*@only@*/ functionClause funcclause;
92 /*@only@*/ flagSpec flagspec;
93 /*@only@*/ globalsClause globsclause;
94 /*@only@*/ modifiesClause modsclause;
95 /*@only@*/ warnClause warnclause;
96 /*@only@*/ stateClause stateclause;
97 /*@only@*/ pointers pointers;
98 /*@only@*/ functionConstraint fcnconstraint;
100 /*@only@*/ metaStateConstraint msconstraint;
101 /*@only@*/ metaStateSpecifier msspec;
102 /*@only@*/ metaStateExpression msexpr;
103 /*@observer@*/ metaStateInfo msinfo;
105 /*@only@*/ sRefList srlist;
106 /*@only@*/ globSet globset;
107 /*@only@*/ qtype qtyp;
108 /*@only@*/ cstring cname;
109 /*@observer@*/ annotationInfo annotation;
110 /*@only@*/ idDecl ntyp;
111 /*@only@*/ idDeclList ntyplist;
112 /*@only@*/ uentryList flist;
113 /*@owned@*/ uentryList entrylist;
114 /*@observer@*/ /*@dependent@*/ uentry entry;
115 /*@only@*/ uentry oentry;
116 /*@only@*/ exprNode expr;
117 /*@only@*/ enumNameList enumnamelist;
118 /*@only@*/ exprNodeList exprlist;
119 /*@only@*/ sRefSet srset;
120 /*@only@*/ cstringList cstringlist;
131 /* standard C tokens */
133 %token <tok> BADTOK SKIPTOK
134 %token <tok> CTOK_ELIPSIS CASE DEFAULT CIF CELSE SWITCH WHILE DO CFOR
135 %token <tok> GOTO CONTINUE BREAK RETURN
136 %token <tok> TSEMI TLBRACE TRBRACE TCOMMA TCOLON TASSIGN TLPAREN
137 %token <tok> TRPAREN TLSQBR TRSQBR TDOT TAMPERSAND TEXCL TTILDE
138 %token <tok> TMINUS TPLUS TMULT TDIV TPERCENT TLT TGT TCIRC TBAR TQUEST
139 %token <tok> CSIZEOF CALIGNOF CTYPEOF ARROW_OP CTYPEDEF COFFSETOF
140 %token <tok> INC_OP DEC_OP LEFT_OP RIGHT_OP
141 %token <tok> LE_OP GE_OP EQ_OP NE_OP AND_OP OR_OP
142 %token <tok> MUL_ASSIGN DIV_ASSIGN MOD_ASSIGN ADD_ASSIGN SUB_ASSIGN
143 %token <tok> LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN XOR_ASSIGN OR_ASSIGN
144 %token <tok> CSTRUCT CUNION CENUM
145 %token <tok> VA_ARG VA_DCL
147 %token <tok> QGLOBALS
148 %token <tok> QMODIFIES
150 %token <tok> QCONSTANT
151 %token <tok> QFUNCTION
153 %token <tok> QDEFINES
155 %token <tok> QALLOCATES
157 %token <tok> QRELEASES
158 %token <tok> QPRECLAUSE
159 %token <tok> QPOSTCLAUSE
160 %token <tok> QINVARIANT
162 %token <tok> QUNDEF QKILLED
163 %token <tok> QENDMACRO
165 /* additional tokens introduced by splint pre-processor. */
166 %token <tok> LLMACRO LLMACROITER LLMACROEND TENDMACRO
168 /* For debugging purposes */
169 %token <tok> QDREVEALSTATE
171 /* break comments: */
172 %token <tok> QSWITCHBREAK QLOOPBREAK QINNERBREAK QSAFEBREAK
173 %token <tok> QINNERCONTINUE
175 /* case fall-through marker: */
176 %token <tok> QFALLTHROUGH
178 /* used in scanner only */
179 %token <tok> QLINTNOTREACHED
180 %token <tok> QLINTFALLTHROUGH
181 %token <tok> QLINTFALLTHRU
182 %token <tok> QARGSUSED
183 %token <tok> QPRINTFLIKE QLINTPRINTFLIKE QSCANFLIKE QMESSAGELIKE
185 /* not-reached marker: (used like a label) */
186 %token <tok> QNOTREACHED
188 /* type qualifiers: */
189 %token <tok> QCONST QRESTRICT QVOLATILE QINLINE QEXTENSION QEXTERN QSTATIC QAUTO QREGISTER
190 %token <tok> QOUT QIN QYIELD QONLY QTEMP QSHARED QREF QUNIQUE
191 %token <tok> QCHECKED QUNCHECKED QCHECKEDSTRICT QCHECKMOD
192 %token <tok> QKEEP QKEPT QPARTIAL QSPECIAL QOWNED QDEPENDENT
193 %token <tok> QRETURNED QEXPOSED QNULL QOBSERVER QISNULL
194 %token <tok> QEXITS QMAYEXIT QNEVEREXIT QTRUEEXIT QFALSEEXIT
195 %token <tok> QLONG QSIGNED QUNSIGNED QSHORT QUNUSED QSEF QNOTNULL QRELNULL
196 %token <tok> QABSTRACT QNUMABSTRACT QCONCRETE QMUTABLE QIMMUTABLE
197 %token <tok> QTRUENULL QFALSENULL QEXTERNAL
198 %token <tok> QREFCOUNTED QREFS QNEWREF QTEMPREF QKILLREF QRELDEF
199 %token <ctyp> CGCHAR CBOOL CINT CGFLOAT CDOUBLE CVOID
200 %token <tok> QANYTYPE QINTEGRALTYPE QUNSIGNEDINTEGRALTYPE QSIGNEDINTEGRALTYPE
202 %token <tok> QNULLTERMINATED
203 %token <tok> QSETBUFFERSIZE
204 %token <tok> QSETSTRINGLENGTH
206 %token <tok> QMAXREAD
207 %token <tok> QTESTINRANGE
212 /* identifiers, literals */
213 %token <entry> IDENTIFIER
214 %token <cname> NEW_IDENTIFIER TYPE_NAME_OR_ID
215 %token <annotation> CANNOTATION
216 %token <expr> CCONSTANT
218 %type <flagspec> flagSpec
219 %type <expr> cconstantExpr
220 %token <entry> ITER_NAME ITER_ENDNAME
221 %type <entry> endIter
223 %type <funcclauselist> functionClauses functionClausesPlain
224 %type <funcclause> functionClause functionClause functionClausePlain
226 %type <globsclause> globalsClause globalsClausePlain
227 %type <modsclause> modifiesClause modifiesClausePlain nomodsClause
228 %type <warnclause> warnClause warnClausePlain optWarnClause
229 %type <funcclause> conditionClause conditionClausePlain
230 %type <stateclause> stateClause stateClausePlain
231 %type <msconstraint> metaStateConstraint
232 %type <fcnconstraint> functionConstraint
233 %type <msspec> metaStateSpecifier
234 %type <msexpr> metaStateExpression
236 %type <sr> globId globIdListExpr
237 %type <globset> globIdList
239 %token <ctyp> TYPE_NAME
240 %token <msinfo> METASTATE_NAME
241 %type <msinfo> metaStateName
242 %type <cname> enumerator newId /*@-varuse@*/ /* yacc declares yytranslate here */
243 %type <pointers> pointers /*@=varuse@*/
245 %type <tok> doHeader stateTag conditionTag startConditionClause
246 %type <typequal> exitsQualifier checkQualifier stateQualifier
247 paramQualifier returnQualifier visibilityQualifier
248 typedefQualifier refcountQualifier definedQualifier
250 /* type construction */
251 %type <ctyp> abstractDecl abstractDeclBase optAbstractDeclBase
252 %type <ctyp> suSpc enumSpc typeName typeSpecifier
254 %type <ntyp> namedDecl namedDeclBase optNamedDecl
255 %type <ntyp> plainNamedDecl plainNamedDeclBase
256 %type <ntyp> structNamedDecl
257 %type <ntyp> fcnDefHdrAux plainFcn
259 %type <oentry> paramDecl
262 %type <ntyplist> structNamedDeclList
264 %type <entrylist> genericParamList paramTypeList paramList idList paramIdList
265 %type <exprlist> argumentExprList iterArgList
266 %type <exprlist> initList namedInitializerList namedInitializerListAux namedInitializerTypeList namedInitializerTypeListAux
267 %type <flist> structDeclList structDecl
268 %type <srset> locModifies modList specClauseList optSpecClauseList
269 %type <sr> mExpr modListExpr specClauseListExpr
272 %type <con> BufConstraint
273 %type <tok> relationalOp
274 %type <tok> BufBinaryOp
275 %type <tok> bufferModifier
277 %type <conE> BufConstraintExpr
279 %type <conE> BufConstraintTerm
280 %type <sr> BufConstraintSrefExpr
282 %type <conL> BufConstraintList
284 %type <conL> optStructInvariant
286 %type <tok> BufUnaryOp
288 /*drl 1/6/2002 either /\ or && */
289 %type <tok> constraintSeperator
291 %type <enumnamelist> enumeratorList
292 %type <cstringlist> fieldDesignator
294 %type <expr> sizeofExpr sizeofExprAux offsetofExpr
295 %type <expr> openScope closeScope
296 %type <expr> instanceDecl namedInitializer optDeclarators namedInitializerType
297 %type <expr> primaryExpr postfixExpr primaryIterExpr postfixIterExpr
298 %type <expr> unaryExpr castExpr timesExpr plusExpr
299 %type <expr> unaryIterExpr castIterExpr timesIterExpr plusIterExpr
300 %type <expr> shiftExpr relationalExpr equalityExpr bitandExpr
301 %type <expr> xorExpr bitorExpr andExpr
302 %type <expr> orExpr conditionalExpr assignExpr
303 %type <expr> shiftIterExpr relationalIterExpr equalityIterExpr bitandIterExpr
304 %type <expr> xorIterExpr bitorIterExpr andIterExpr
305 %type <expr> orIterExpr conditionalIterExpr assignIterExpr iterArgExpr
306 %type <expr> expr optExpr constantExpr
307 %type <expr> init macroBody iterBody endBody partialIterStmt iterSelectionStmt
308 %type <expr> stmt stmtList fcnBody iterStmt iterDefStmt iterDefStmtList debugStmt
309 %type <expr> labeledStmt caseStmt defaultStmt
310 %type <expr> compoundStmt compoundStmtAux compoundStmtRest compoundStmtAuxErr
311 %type <expr> expressionStmt selectionStmt iterationStmt jumpStmt iterDefIterationStmt
312 %type <expr> stmtErr stmtListErr compoundStmtErr expressionStmtErr
313 %type <expr> iterationStmtErr initializerList typeInitializerList initializer
314 %type <expr> ifPred whilePred forPred iterWhilePred typeInitializer
316 %type <expr> designator designatorList designation
318 %type <typequal> storageSpecifier typeQualifier typeModifier globQual innerMods
319 %type <tquallist> optGlobQuals innerModsList
320 %type <qtyp> completeType completeTypeSpecifier optCompleteType
321 %type <qtyp> completeTypeSpecifierAux altType typeExpression
333 : externalDef { context_checkGlobalScope (); }
334 | externalDefs externalDef { context_checkGlobalScope (); }
338 : fcnDef optSemi { uentry_clearDecl (); }
339 | constantDecl { uentry_clearDecl (); }
340 | fcnDecl { uentry_clearDecl (); }
341 | iterDecl { uentry_clearDecl (); }
342 | macroDef { uentry_clearDecl (); }
343 | initializer { uentry_checkDecl (); exprNode_free ($1); }
344 | TSEMI { uentry_clearDecl (); lltok_free ($1); /* evans 2002-02-08: okay to have a null statement */ }
345 | error { uentry_clearDecl (); }
349 : QCONSTANT completeTypeSpecifier NotType namedDecl NotType optSemi IsType QENDMACRO
350 { checkConstant ($2, $4); lltok_free2 ($1, $8); }
351 | QCONSTANT completeTypeSpecifier NotType namedDecl NotType TASSIGN IsType init optDeclarators optSemi QENDMACRO
352 { checkValueConstant ($2, $4, $8); lltok_free3 ($1, $6, $11); }
356 : QFUNCTION { context_enterFunctionHeader (); } plainFcn optSemi QENDMACRO
358 declareStaticFunction ($3); context_quietExitFunction ();
359 context_exitFunctionHeader ();
360 lltok_free2 ($1, $5); /*!*/
367 qtype qint = qtype_create (ctype_int);
368 $$ = idDecl_fixBase ($1, qint);
371 | completeTypeSpecifier NotType plainNamedDecl
372 { $$ = idDecl_fixBase ($3, $1); }
377 | pointers plainNamedDeclBase
378 { $$ = $2; qtype_adjustPointers ($1, idDecl_getTyp ($$)); }
382 : newId { $$ = idDecl_create ($1, qtype_unknown ()); }
383 | IsType TLPAREN NotType namedDecl IsType TRPAREN
384 { $$ = idDecl_expectFunction ($4); lltok_free2 ($2, $6); }
385 | namedDeclBase TLSQBR TRSQBR
386 { $$ = idDecl_replaceCtype ($1, ctype_makeInnerArray (idDecl_getCtype ($1))); lltok_free2 ($2, $3); }
387 | namedDeclBase TLSQBR IsType constantExpr TRSQBR NotType
389 exprNode_findValue ($4);
390 idDecl_notExpectingFunction ($1);
392 if (exprNode_hasValue ($4))
394 $$ = idDecl_replaceCtype ($1, ctype_makeInnerFixedArray (idDecl_getCtype ($1),
395 exprNode_getLongValue ($4)));
399 $$ = idDecl_replaceCtype ($1, ctype_makeInnerArray (idDecl_getCtype ($1)));
402 lltok_free2 ($2, $5);
404 | namedDeclBase PushType TLPAREN TRPAREN
405 { setCurrentParams (uentryList_missingParams); }
407 { /* need to support globals and modifies here! */
408 functionClauseList fcl;
409 ctype ct = ctype_makeFunction (idDecl_getCtype ($1),
410 uentryList_makeMissingParams ());
412 $$ = idDecl_replaceCtype ($1, ct);
414 /*drl 7/25/01 added*/
415 setImplicitfcnConstraints();
417 DPRINTF((message("namedDeclBase PushType TLPAREN TRPAREN...:\n adding implict constraints to functionClause List: %s",
418 functionClauseList_unparse($6)
422 fcl = functionClauseList_setImplicitConstraints($6);
424 idDecl_addClauses ($$, fcl);
426 DPRINTF((message("1 added fuctionClause List: %s to the Id",
427 functionClauseList_unparse(fcl)
433 lltok_free2 ($3, $4);
435 | namedDeclBase PushType TLPAREN genericParamList TRPAREN
436 { setCurrentParams ($4); }
439 functionClauseList fcl;
440 setImplicitfcnConstraints ();
441 clearCurrentParams ();
442 $$ = idDecl_replaceCtype ($1, ctype_makeFunction (idDecl_getCtype ($1), $4));
444 DPRINTF((message("namedDeclBase PushType TLPAREN genericParamList TRPAREN...:\n adding implict constraints to functionClause List: %s",
445 functionClauseList_unparse($7)
449 fcl = functionClauseList_setImplicitConstraints($7);
451 idDecl_addClauses ($$, fcl);
453 DPRINTF((message("added fuctionClause List: %s to the Id",
454 functionClauseList_unparse(fcl)
460 lltok_free2 ($3, $5);
465 : newId { $$ = idDecl_create ($1, qtype_unknown ()); }
466 | IsType TLPAREN NotType plainNamedDecl IsType TRPAREN
467 { $$ = idDecl_expectFunction ($4); lltok_free2 ($2, $6); }
468 | plainNamedDeclBase TLSQBR TRSQBR
469 { $$ = idDecl_replaceCtype ($1, ctype_makeInnerArray (idDecl_getCtype ($1)));
470 lltok_free2 ($2, $3);
472 | plainNamedDeclBase TLSQBR IsType constantExpr TRSQBR NotType
476 if (exprNode_hasValue ($4)
477 && multiVal_isInt (exprNode_getValue ($4)))
479 value = (int) multiVal_forceInt (exprNode_getValue ($4));
486 $$ = idDecl_replaceCtype ($1, ctype_makeInnerFixedArray (idDecl_getCtype ($1), value));
487 lltok_free2 ($2, $5);
489 | plainNamedDeclBase PushType TLPAREN TRPAREN
490 { setCurrentParams (uentryList_missingParams); }
493 ctype ct = ctype_makeFunction (idDecl_getCtype ($1),
494 uentryList_makeMissingParams ());
496 $$ = idDecl_replaceCtype ($1, ct);
497 idDecl_addClauses ($$, $6);
499 lltok_free2 ($3, $4);
501 | plainNamedDeclBase PushType TLPAREN genericParamList TRPAREN
502 { setCurrentParams ($4); }
505 clearCurrentParams ();
506 $$ = idDecl_replaceCtype ($1, ctype_makeFunction (idDecl_getCtype ($1), $4));
507 idDecl_addClauses ($$, $7);
510 /*!! lltok_free2 ($3, $5); */
515 : QITER newId TLPAREN genericParamList TRPAREN
516 { setCurrentParams ($4); } functionClausesPlain
517 { clearCurrentParams (); } optSemi QENDMACRO
518 { declareCIter ($2, $4);
519 lltok_free3 ($1, $3, $5);
524 : LLMACRO macroBody TENDMACRO { exprNode_checkMacroBody ($2); lltok_free2 ($1, $3); }
525 | LLMACROITER iterBody TENDMACRO { exprNode_checkIterBody ($2); lltok_free2 ($1, $3); }
526 | LLMACROEND endBody TENDMACRO { exprNode_checkIterEnd ($2); lltok_free2 ($1, $3);}
527 | LLMACRO TENDMACRO /* no stmt */ { exprChecks_checkEmptyMacroBody (); lltok_free2 ($1, $2); }
531 : fcnDefHdrAux { clabstract_declareFunction ($1); }
535 : metaStateSpecifier TASSIGN metaStateExpression
536 { $$ = metaStateConstraint_create ($1, $3); lltok_free ($2); }
540 : BufConstraintSrefExpr { cscannerHelp_expectingMetaStateName (); } TCOLON metaStateName
541 { cscannerHelp_clearExpectingMetaStateName ();
542 $$ = metaStateSpecifier_create ($1, $4);
545 | CTOK_ELIPSIS { cscannerHelp_expectingMetaStateName (); } TCOLON metaStateName
546 { cscannerHelp_clearExpectingMetaStateName ();
547 $$ = metaStateSpecifier_createElipsis ($4);
548 lltok_free2 ($1, $3);
553 : metaStateSpecifier { $$ = metaStateExpression_create ($1); }
554 | metaStateSpecifier TBAR metaStateExpression { $$ = metaStateExpression_createMerge ($1, $3); lltok_free ($2); }
569 : BufConstraint constraintSeperator BufConstraintList { $$ = constraintList_add ($3, $1); }
570 | BufConstraint { $$ = constraintList_single ($1); }
574 : BufConstraintExpr relationalOp BufConstraintExpr {
575 $$ = makeConstraintParse3 ($1, $2, $3);
576 DPRINTF(("Done BufConstraint1\n")); }
592 | BufUnaryOp TLPAREN BufConstraintExpr TRPAREN {$$ = constraintExpr_parseMakeUnaryOp ($1, $3); DPRINTF( ("Got BufConstraintExpr UNary Op ") ); }
593 | TLPAREN BufConstraintExpr BufBinaryOp BufConstraintExpr TRPAREN {
594 DPRINTF( ("Got BufConstraintExpr BINary Op ") );
595 $$ = constraintExpr_parseMakeBinaryOp ($2, $3, $4); }
599 : BufConstraintSrefExpr { $$ = constraintExpr_makeTermsRef ($1);}
600 | CCONSTANT { $$ = constraintExpr_makeIntLiteral (exprNode_getLongValue ($1)); }
603 BufConstraintSrefExpr
605 { /*@-onlytrans@*/ $$ = checkbufferConstraintClausesId ($1); /*@=onlytrans@*/ /*@i523@*/ }
607 { $$ = fixStateClausesId ($1); }
608 | BufConstraintSrefExpr TLSQBR TRSQBR
609 { $$ = sRef_makeAnyArrayFetch ($1); }
610 | BufConstraintSrefExpr TLSQBR CCONSTANT TRSQBR
614 t = cstring_toCharsSafe (exprNode_unparse($3));
617 $$ = sRef_makeArrayFetchKnown ($1, exprNode_getLongValue ($3));
619 | TMULT BufConstraintSrefExpr
620 { $$ = sRef_constructPointer ($2); }
621 | TLPAREN BufConstraintSrefExpr TRPAREN
623 | BufConstraintSrefExpr TDOT newId
624 { cstring_markOwned ($3); $$ = sRef_buildField ($1, $3); }
625 | BufConstraintSrefExpr ARROW_OP newId
626 { cstring_markOwned ($3); $$ = sRef_makeArrow ($1, $3); }
629 | BufConstraintTerm TLSQBR TRSQBR { $$ = sRef_makeAnyArrayFetch ($1); }
630 | specClauseListExpr TLSQBR mExpr TRSQBR { $$ = sRef_makeAnyArrayFetch ($1); }
631 | TLPAREN specClauseListExpr TRPAREN { $$ = $2; }
632 | specClauseListExpr TDOT newId { cstring_markOwned ($3);
633 $$ = sRef_buildField ($1, $3); }
650 ** Function clauses can appear in any order.
654 : { $$ = functionClauseList_new (); }
655 | functionClause functionClauses
656 { $$ = functionClauseList_prepend ($2, $1); }
660 ** Inside macro definitions, there are no end macros.
665 { $$ = functionClauseList_new (); }
666 | functionClausePlain functionClausesPlain
667 { $$ = functionClauseList_prepend ($2, $1); }
671 : globalsClause { $$ = functionClause_createGlobals ($1); }
672 | modifiesClause { $$ = functionClause_createModifies ($1); }
673 | nomodsClause { $$ = functionClause_createModifies ($1); }
674 | stateClause { $$ = functionClause_createState ($1); }
675 | conditionClause { $$ = $1; }
676 | warnClause { $$ = functionClause_createWarn ($1); }
680 : globalsClausePlain { $$ = functionClause_createGlobals ($1); }
681 | modifiesClausePlain { $$ = functionClause_createModifies ($1); }
682 | nomodsClause { $$ = functionClause_createModifies ($1); }
683 | stateClausePlain { $$ = functionClause_createState ($1); }
684 | conditionClausePlain { $$ = $1; }
685 | warnClausePlain { $$ = functionClause_createWarn ($1); }
689 : globalsClausePlain QENDMACRO { $$ = $1; }
693 : QGLOBALS { setProcessingGlobalsList (); }
696 unsetProcessingGlobals ();
697 $$ = globalsClause_create ($1, $3);
702 : QNOMODS { $$ = modifiesClause_createNoMods ($1); }
706 : modifiesClausePlain QENDMACRO { $$ = $1; }
712 context_setProtectVars (); enterParamsTemp ();
713 sRef_setGlobalScopeSafe ();
718 sRef_clearGlobalScopeSafe ();
719 context_releaseVars ();
720 $$ = modifiesClause_create ($1, $3);
726 { $$ = flagSpec_createPlain ($1); }
727 | flagId TBAR flagSpec
728 { $$ = flagSpec_createOr ($1, $3); }
737 | /* empty */ { $$ = warnClause_undefined; }
741 : warnClausePlain QENDMACRO { $$ = $1; }
745 : QWARN flagSpec cconstantExpr
747 llassert (exprNode_knownStringValue ($3));
748 $$ = warnClause_create ($1, $2, cstring_copy (multiVal_forceString (exprNode_getValue ($3))));
752 { $$ = warnClause_create ($1, $2, cstring_undefined); }
756 : globIdListExpr { $$ = globSet_single ($1); }
757 | globIdList TCOMMA globIdListExpr { $$ = globSet_insert ($1, $3); }
761 : optGlobQuals globId { $$ = clabstract_createGlobal ($2, $1); }
765 : /* empty */ { $$ = qualList_undefined; }
766 | globQual optGlobQuals { $$ = qualList_add ($2, $1); }
770 : id { $$ = uentry_getSref ($1); }
771 | NEW_IDENTIFIER { $$ = clabstract_unrecognizedGlobal ($1); }
772 | initializer { $$ = clabstract_checkGlobal ($1); }
776 : QUNDEF { $$ = qual_createUndef (); }
777 | QKILLED { $$ = qual_createKilled (); }
778 | QOUT { $$ = qual_createOut (); }
779 | QIN { $$ = qual_createIn (); }
780 | QPARTIAL { $$ = qual_createPartial (); }
799 /**!!! deal with fred; fred (int); declarations! **/
800 qtype qint = qtype_create (ctype_int);
801 $$ = idDecl_fixBase ($1, qint);
804 | completeTypeSpecifier NotType namedDecl
805 { $$ = idDecl_fixBase ($3, $1); }
809 : TLBRACE { checkDoneParams (); context_enterInnerContext (); }
812 exprNode_checkFunctionBody ($3); $$ = $3;
813 context_exitInner ($3);
815 | { context_enterOldStyleScope (); } initializerList
816 { oldStyleDoneParams (); context_enterInnerContext (); }
819 exprNode_checkFunctionBody ($4);
820 $$ = $4; /* oldstyle */
821 context_exitInner ($4);
828 context_setFunctionDefined (exprNode_loc ($2));
829 exprNode_checkFunction (context_getHeader (), $2);
832 context_exitFunction ();
837 : modList optSemi { $$ = $1; }
838 | optSemi { $$ = sRefSet_new (); }
842 : id { $$ = uentry_getSref ($1); checkModifiesId ($1); }
843 | NEW_IDENTIFIER { $$ = fixModifiesId ($1); }
844 | TYPE_NAME_OR_ID { $$ = fixModifiesId ($1); }
845 | modListExpr TLSQBR TRSQBR { $$ = modListArrayFetch ($1, sRef_undefined); }
846 | modListExpr TLSQBR mExpr TRSQBR { $$ = modListArrayFetch ($1, $3); }
847 | TMULT modListExpr { $$ = modListPointer ($2); }
848 | TLPAREN modListExpr TRPAREN { $$ = $2; }
849 | modListExpr TDOT newId { $$ = modListFieldAccess ($1, $3); }
850 | modListExpr ARROW_OP newId { $$ = modListArrowAccess ($1, $3); }
854 : modListExpr { $$ = $1; }
855 | cconstantExpr { $$ = sRef_makeUnknown (); /* sRef_makeConstant ($1); ? */ }
860 : modListExpr { $$ = sRefSet_single ($1); }
861 | modList TCOMMA modListExpr { $$ = sRefSet_insert ($1, $3); }
866 { $$ = checkStateClausesId ($1); }
868 { $$ = fixStateClausesId ($1); }
869 | specClauseListExpr TLSQBR TRSQBR { $$ = sRef_makeAnyArrayFetch ($1); }
870 | specClauseListExpr TLSQBR mExpr TRSQBR { $$ = sRef_makeAnyArrayFetch ($1); }
871 | TMULT specClauseListExpr { $$ = sRef_constructPointer ($2); }
872 | TLPAREN specClauseListExpr TRPAREN { $$ = $2; }
873 | specClauseListExpr TDOT newId { cstring_markOwned ($3);
874 $$ = sRef_buildField ($1, $3); }
875 | specClauseListExpr ARROW_OP newId { cstring_markOwned ($3);
876 $$ = sRef_makeArrow ($1, $3); }
880 : /* empty */ { DPRINTF ((message("Empty optSpecClauseList") )); $$ = sRefSet_undefined }
886 { if (sRef_isValid ($1)) { $$ = sRefSet_single ($1); }
888 DPRINTF((message("returning sRefSEt_undefined ") ));
889 $$ = sRefSet_undefined; }
891 | specClauseList TCOMMA specClauseListExpr
892 { if (sRef_isValid ($3))
894 $$ = sRefSet_insert ($1, $3);
904 : id { $$ = exprNode_fromIdentifier ($1); }
905 | NEW_IDENTIFIER { $$ = exprNode_fromUIO ($1); }
907 | TLPAREN expr TRPAREN { $$ = exprNode_addParens ($1, $2); }
908 | TYPE_NAME_OR_ID { $$ = exprNode_fromIdentifier (cscannerHelp_coerceId ($1)); }
909 | QEXTENSION { $$ = exprNode_makeError (); }
910 | TLPAREN { exprChecks_inCompoundStatementExpression (); }
912 { exprChecks_leaveCompoundStatementExpression (); $$ = exprNode_compoundStatementExpression ($1, $3); }
917 | postfixExpr TLSQBR expr TRSQBR { $$ = exprNode_arrayFetch ($1, $3); }
918 | postfixExpr TLPAREN TRPAREN { $$ = exprNode_functionCall ($1, exprNodeList_new ()); }
919 | postfixExpr TLPAREN argumentExprList TRPAREN { $$ = exprNode_functionCall ($1, $3); }
920 | VA_ARG TLPAREN assignExpr TCOMMA typeExpression TRPAREN { $$ = exprNode_vaArg ($1, $3, $5); }
921 | postfixExpr NotType TDOT newId IsType { $$ = exprNode_fieldAccess ($1, $3, $4); }
922 | postfixExpr NotType ARROW_OP newId IsType { $$ = exprNode_arrowAccess ($1, $3, $4); }
923 | postfixExpr INC_OP { $$ = exprNode_postOp ($1, $2); }
924 | postfixExpr DEC_OP { $$ = exprNode_postOp ($1, $2); }
925 | TLPAREN typeExpression TRPAREN TLBRACE typeInitializerList optComma TRBRACE
926 { /* added for C99 */ $$ = exprNode_undefined; /*@i87 no checking */ }
930 : assignExpr { $$ = exprNodeList_singleton ($1); }
931 | argumentExprList TCOMMA assignExpr { $$ = exprNodeList_push ($1, $3); }
936 | INC_OP unaryExpr { $$ = exprNode_preOp ($2, $1); }
937 | DEC_OP unaryExpr { $$ = exprNode_preOp ($2, $1); }
938 | TAMPERSAND castExpr { $$ = exprNode_preOp ($2, $1); }
939 | TMULT castExpr { $$ = exprNode_preOp ($2, $1); }
940 | TPLUS castExpr { $$ = exprNode_preOp ($2, $1); }
941 | TMINUS castExpr { $$ = exprNode_preOp ($2, $1); }
942 | TTILDE castExpr { $$ = exprNode_preOp ($2, $1); }
943 | TEXCL castExpr { $$ = exprNode_preOp ($2, $1); }
944 | processSizeof sizeofExpr endprocessSizeof { $$ = $2; }
945 | offsetofExpr { $$ = $1; }
949 : fieldDesignator TDOT newId { $$ = cstringList_add ($1, $3); lltok_free ($2); }
950 | fieldDesignator TLSQBR expr TRSQBR { $$ = $1; lltok_free2 ($2, $4); }
951 /* evans 2002-07-02: offsetof designators can use array indexes */
952 | newId { $$ = cstringList_single ($1); }
956 : COFFSETOF IsType TLPAREN typeExpression NotType TCOMMA fieldDesignator TRPAREN IsType
957 { $$ = exprNode_offsetof ($4, $7);
958 lltok_free3 ($1, $3, $6); lltok_free ($8); }
962 : IsType { context_setProtectVars (); }
963 sizeofExprAux { context_sizeofReleaseVars (); $$ = $3; }
966 processSizeof: {context_enterSizeof()};
969 endprocessSizeof: {context_leaveSizeof()};
973 : CSIZEOF TLPAREN typeExpression TRPAREN { $$ = exprNode_sizeofType ($3); lltok_free3 ($1, $2, $4); }
974 | CSIZEOF unaryExpr { $$ = exprNode_sizeofExpr ($2); lltok_free ($1); }
975 | CALIGNOF TLPAREN typeExpression TRPAREN { $$ = exprNode_alignofType ($3); lltok_free3 ($1, $2, $4); }
976 | CALIGNOF unaryExpr { $$ = exprNode_alignofExpr ($2); lltok_free ($1); }
983 | TLPAREN typeExpression TRPAREN castExpr
984 { $$ = exprNode_cast ($1, $4, $2); lltok_free ($3); }
989 | timesExpr TMULT castExpr { $$ = exprNode_op ($1, $3, $2); }
990 | timesExpr TDIV castExpr { $$ = exprNode_op ($1, $3, $2); }
991 | timesExpr TPERCENT castExpr { $$ = exprNode_op ($1, $3, $2); }
996 | plusExpr TPLUS timesExpr { $$ = exprNode_op ($1, $3, $2); }
997 | plusExpr TMINUS timesExpr { $$ = exprNode_op ($1, $3, $2); }
1002 | shiftExpr LEFT_OP plusExpr { $$ = exprNode_op ($1, $3, $2); }
1003 | shiftExpr RIGHT_OP plusExpr { $$ = exprNode_op ($1, $3, $2); }
1008 | relationalExpr TLT shiftExpr { $$ = exprNode_op ($1, $3, $2); }
1009 | relationalExpr TGT shiftExpr { $$ = exprNode_op ($1, $3, $2); }
1010 | relationalExpr LE_OP shiftExpr { $$ = exprNode_op ($1, $3, $2); }
1011 | relationalExpr GE_OP shiftExpr { $$ = exprNode_op ($1, $3, $2); }
1016 | equalityExpr EQ_OP relationalExpr { $$ = exprNode_op ($1, $3, $2); }
1017 | equalityExpr NE_OP relationalExpr { $$ = exprNode_op ($1, $3, $2); }
1022 | bitandExpr TAMPERSAND equalityExpr { $$ = exprNode_op ($1, $3, $2); }
1027 | xorExpr TCIRC bitandExpr { $$ = exprNode_op ($1, $3, $2); }
1032 | bitorExpr TBAR xorExpr { $$ = exprNode_op ($1, $3, $2); }
1038 { exprNode_produceGuards ($1);
1039 context_enterAndClause ($1);
1043 $$ = exprNode_op ($1, $4, $2);
1044 context_exitAndClause ($$, $4);
1052 exprNode_produceGuards ($1);
1053 context_enterOrClause ($1);
1057 $$ = exprNode_op ($1, $4, $2);
1058 context_exitOrClause ($$, $4);
1064 | orExpr TQUEST { exprNode_produceGuards ($1); context_enterTrueClause ($1); } expr TCOLON
1065 { context_enterFalseClause ($1); } conditionalExpr
1066 { $$ = exprNode_cond ($1, $4, $7); context_exitClause ($1, $4, $7); }
1071 | unaryExpr TASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); }
1072 | unaryExpr MUL_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); }
1073 | unaryExpr DIV_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); }
1074 | unaryExpr MOD_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); }
1075 | unaryExpr ADD_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); }
1076 | unaryExpr SUB_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); }
1077 | unaryExpr LEFT_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); }
1078 | unaryExpr RIGHT_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); }
1079 | unaryExpr AND_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); }
1080 | unaryExpr XOR_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); }
1081 | unaryExpr OR_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); }
1086 | expr TCOMMA assignExpr { $$ = exprNode_comma ($1, $3); }
1090 : /* empty */ { $$ = exprNode_undefined; }
1098 /* instance_orTypeDecl_and_possible_initialization */
1101 : instanceDecl { $$ = $1; }
1102 | VA_DCL { doVaDcl (); $$ = exprNode_makeError (); }
1103 | typeDecl { $$ = exprNode_makeError (); }
1107 : completeTypeSpecifier IsType TSEMI
1108 { $$ = exprNode_makeError (); }
1110 ** This causes r/r conflicts with function definitions.
1111 ** Instead we need to snarf one first. (gack)
1113 ** | completeTypeSpecifier { setProcessingVars ($1); }
1115 ** namedInitializerList IsType TSEMI
1116 ** { unsetProcessingVars (); }
1119 ** the solution is pretty ugly:
1121 | completeTypeSpecifier NotType namedDecl NotType
1123 setProcessingVars ($1);
1124 processNamedDecl ($3);
1126 IsType optDeclarators TSEMI IsType
1128 unsetProcessingVars ();
1129 $$ = exprNode_makeEmptyInitialization ($3);
1130 DPRINTF (("Empty initialization: %s", exprNode_unparse ($$)));
1132 | completeTypeSpecifier NotType namedDecl NotType TASSIGN
1133 { setProcessingVars ($1); processNamedDecl ($3); }
1134 IsType init optDeclarators TSEMI IsType
1135 { $$ = exprNode_concat ($9, exprNode_makeInitialization ($3, $8));
1136 unsetProcessingVars ();
1140 namedInitializerType
1141 : namedInitializer { $$ = $1; }
1142 | TYPE_NAME { $$ = exprNode_fromIdentifier (usymtab_getTypeEntry (ctype_typeId ($1))); }
1148 processNamedDecl ($1);
1149 $$ = exprNode_makeEmptyInitialization ($1);
1151 | namedDecl NotType TASSIGN { processNamedDecl ($1); } IsType init
1152 { $$ = exprNode_makeInitialization ($1, $6); }
1156 : CTYPEDEF completeTypeSpecifier { setProcessingTypedef ($2); }
1157 NotType namedInitializerTypeList IsType optWarnClause TSEMI
1158 { clabstract_declareType ($5, $7); }
1159 | CTYPEDEF completeTypeSpecifier IsType TSEMI { /* in the ANSI grammar, semantics unclear */ }
1160 | CTYPEDEF namedInitializerList IsType TSEMI { /* in the ANSI grammar, semantics unclear */ }
1164 : { cscannerHelp_setExpectingTypeName (); }
1168 : { cscannerHelp_setExpectingTypeName (); context_pushLoc (); }
1171 namedInitializerList
1172 : namedInitializerListAux IsType { $$ = $1; }
1175 namedInitializerListAux
1176 : namedInitializer { $$ = exprNodeList_singleton ($1); }
1177 | namedInitializerList TCOMMA NotType namedInitializer { $$ = exprNodeList_push ($1, $4); }
1180 namedInitializerTypeList
1181 : namedInitializerTypeListAux IsType { $$ = $1; }
1184 namedInitializerTypeListAux
1185 : namedInitializerType { $$ = exprNodeList_singleton ($1); }
1186 | namedInitializerTypeList TCOMMA NotType namedInitializerType { $$ = exprNodeList_push ($1, $4); }
1190 : /* empty */ { $$ = exprNode_makeError (); }
1191 | optDeclarators TCOMMA NotType namedInitializer { $$ = exprNode_concat ($1, $4); }
1196 | TLBRACE initList TRBRACE { $$ = exprNode_makeInitBlock ($1, $2); lltok_free ($3); }
1197 | TLBRACE initList TCOMMA TRBRACE { $$ = exprNode_makeInitBlock ($1, $2); lltok_free2 ($3, $4); }
1198 | designation init { $$ = exprNode_undefined; }
1202 ** Splint parses these (added in ISO C99), but no checking yet...
1206 : designatorList TASSIGN { $$ = $1; }
1207 | newId TCOLON { $$ = exprNode_undefined;
1208 /* gcc extension, obsolete since 2.5 */ }
1212 : designator { $$ = exprNode_undefined; }
1213 | designatorList designator { $$ = exprNode_undefined; }
1217 : TLSQBR constantExpr TRSQBR { $$ = exprNode_undefined; }
1218 | TDOT newId { $$ = exprNode_undefined; }
1223 { $$ = exprNodeList_singleton ($1); }
1224 | initList TCOMMA init
1225 { $$ = exprNodeList_push ($1, $3); }
1229 ** need to do the storage class global hack so tags are
1230 ** declared with the right storage class.
1234 : QEXTERN { setStorageClass (SCEXTERN); $$ = qual_createExtern (); }
1235 | QINLINE { $$ = qual_createInline (); }
1236 | QSTATIC { setStorageClass (SCSTATIC); $$ = qual_createStatic (); }
1237 | QAUTO { $$ = qual_createAuto (); }
1238 | QREGISTER { $$ = qual_createRegister (); }
1242 : stateClausePlain QENDMACRO { $$ = $1; }
1248 context_setProtectVars ();
1250 sRef_setGlobalScopeSafe ();
1252 specClauseList optSemi IsType
1255 sRef_clearGlobalScopeSafe ();
1256 context_releaseVars ();
1257 $$ = stateClause_createPlain ($1, $4);
1262 : conditionClausePlain QENDMACRO { $$ = $1; }
1265 startConditionClause
1266 : conditionTag NotType { $$ = $1; context_enterFunctionHeader (); }
1269 conditionClausePlain
1270 : startConditionClause stateQualifier
1272 context_exitFunctionHeader ();
1273 context_setProtectVars ();
1275 sRef_setGlobalScopeSafe ();
1277 optSpecClauseList optSemi IsType
1280 sRef_clearGlobalScopeSafe ();
1281 context_releaseVars ();
1282 $$ = functionClause_createState (stateClause_create ($1, $2, $4));
1284 | startConditionClause
1286 context_setProtectVars ();
1288 sRef_setGlobalScopeSafe ();
1290 functionConstraint optSemi IsType
1292 context_exitFunctionHeader ();
1294 sRef_clearGlobalScopeSafe ();
1295 context_releaseVars ();
1296 DPRINTF (("done optGlobBufConstraintsAux\n"));
1298 if (lltok_isEnsures ($1))
1300 $$ = functionClause_createEnsures ($3);
1302 else if (lltok_isRequires ($1))
1304 $$ = functionClause_createRequires ($3);
1311 DPRINTF (("FunctionclauseS: %s", functionClause_unparse ($$)));
1316 : BufConstraintList { $$ = functionConstraint_createBufferConstraint ($1); }
1317 | metaStateConstraint { $$ = functionConstraint_createMetaStateConstraint ($1); DPRINTF (("Made constraint: %s", functionConstraint_unparse ($$))); }
1321 : QEXITS { $$ = qual_createExits (); }
1322 | QMAYEXIT { $$ = qual_createMayExit (); }
1323 | QTRUEEXIT { $$ = qual_createTrueExit (); }
1324 | QFALSEEXIT { $$ = qual_createFalseExit (); }
1325 | QNEVEREXIT { $$ = qual_createNeverExit (); }
1329 : QCHECKED { $$ = qual_createChecked (); }
1330 | QCHECKMOD { $$ = qual_createCheckMod (); }
1331 | QUNCHECKED { $$ = qual_createUnchecked (); }
1332 | QCHECKEDSTRICT { $$ = qual_createCheckedStrict (); }
1336 : QOWNED { $$ = qual_createOwned (); }
1337 | QDEPENDENT { $$ = qual_createDependent (); }
1338 | QYIELD { $$ = qual_createYield (); }
1339 | QTEMP { $$ = qual_createTemp (); }
1340 | QONLY { $$ = qual_createOnly (); }
1341 | QKEEP { $$ = qual_createKeep (); }
1342 | QKEPT { $$ = qual_createKept (); }
1343 | QSHARED { $$ = qual_createShared (); }
1344 | QUNIQUE { $$ = qual_createUnique (); }
1345 | QNULL { $$ = qual_createNull (); }
1346 | QISNULL { $$ = qual_createIsNull (); }
1347 | QRELNULL { $$ = qual_createRelNull (); }
1348 | QNOTNULL { $$ = qual_createNotNull (); }
1349 | QEXPOSED { $$ = qual_createExposed (); }
1350 | QOBSERVER { $$ = qual_createObserver (); }
1351 | QNULLTERMINATED { $$ = qual_createNullTerminated (); }
1352 | CANNOTATION { $$ = qual_createMetaState ($1); }
1356 : QRETURNED { $$ = qual_createReturned (); }
1357 | QSEF { $$ = qual_createSef (); }
1361 : QUNUSED { $$ = qual_createUnused (); }
1362 | QEXTERNAL { $$ = qual_createExternal (); }
1366 : QTRUENULL { $$ = qual_createTrueNull (); }
1367 | QFALSENULL { $$ = qual_createFalseNull (); }
1371 : QABSTRACT { $$ = qual_createAbstract (); }
1372 | QNUMABSTRACT { $$ = qual_createNumAbstract (); }
1373 | QCONCRETE { $$ = qual_createConcrete (); }
1374 | QMUTABLE { $$ = qual_createMutable (); }
1375 | QIMMUTABLE { $$ = qual_createImmutable (); }
1379 : QREFCOUNTED { $$ = qual_createRefCounted (); }
1380 | QREFS { $$ = qual_createRefs (); }
1381 | QKILLREF { $$ = qual_createKillRef (); }
1382 | QRELDEF { $$ = qual_createRelDef (); }
1383 | QNEWREF { $$ = qual_createNewRef (); }
1384 | QTEMPREF { $$ = qual_createTempRef (); }
1388 : QSHORT { $$ = qual_createShort (); }
1389 | QLONG { $$ = qual_createLong (); }
1390 | QSIGNED { $$ = qual_createSigned (); }
1391 | QUNSIGNED { $$ = qual_createUnsigned (); }
1395 : QOUT { $$ = qual_createOut (); }
1396 | QIN { $$ = qual_createIn (); }
1397 | QPARTIAL { $$ = qual_createPartial (); }
1398 | QSPECIAL { $$ = qual_createSpecial (); }
1402 : QCONST IsType { $$ = qual_createConst (); }
1403 | QVOLATILE IsType { $$ = qual_createVolatile (); }
1404 | QRESTRICT IsType { $$ = qual_createRestrict (); }
1405 | definedQualifier IsType { $$ = $1; }
1406 | stateQualifier IsType { $$ = $1; }
1407 | exitsQualifier IsType { $$ = $1; }
1408 | paramQualifier IsType { $$ = $1; }
1409 | checkQualifier IsType { $$ = $1; }
1410 | returnQualifier IsType { $$ = $1; }
1411 | visibilityQualifier IsType { $$ = $1; }
1412 | typedefQualifier IsType { $$ = $1; }
1413 | refcountQualifier IsType { $$ = $1; }
1417 ** This is copied into the mtgrammar!
1427 | QANYTYPE NotType { $$ = ctype_makeAnytype (); }
1428 | QINTEGRALTYPE NotType { $$ = ctype_anyintegral; }
1429 | QUNSIGNEDINTEGRALTYPE NotType { $$ = ctype_unsignedintegral; }
1430 | QSIGNEDINTEGRALTYPE NotType { $$ = ctype_signedintegral; }
1434 | typeModifier NotType { $$ = ctype_fromQual ($1); }
1438 : IsType completeTypeSpecifier IsType
1439 { $$ = qtype_resolve ($2); }
1442 completeTypeSpecifier
1443 : completeTypeSpecifierAux { $$ = $1; }
1444 | completeTypeSpecifierAux QALT altType QENDMACRO
1445 { $$ = qtype_mergeAlt ($1, $3); }
1450 | typeExpression TCOMMA altType
1451 { $$ = qtype_mergeAlt ($1, $3); }
1454 completeTypeSpecifierAux
1455 : storageSpecifier optCompleteType { $$ = qtype_addQual ($2, $1); }
1456 | typeQualifier optCompleteType { $$ = qtype_addQual ($2, $1); }
1457 | typeSpecifier optCompleteType { $$ = qtype_combine ($2, $1); }
1461 : /* empty */ { $$ = qtype_unknown (); }
1462 | completeTypeSpecifier { $$ = $1; }
1466 : /* empty */ { $$ = constraintList_undefined; }
1467 /* drl commenting before a CVS commit
1468 | QINVARIANT BufConstraintList QENDMACRO { $$ = $2 }
1473 : NotType CSTRUCT newId IsType TLBRACE { sRef_setGlobalScopeSafe (); }
1474 CreateStructInnerScope
1475 structDeclList DeleteStructInnerScope { sRef_clearGlobalScopeSafe (); }
1478 { ctype ct; ct = declareStruct ($3, $8); /* context_setGlobalStructInfo(ct, $12); */ $$ = ct; }
1479 | NotType CUNION newId IsType TLBRACE { sRef_setGlobalScopeSafe (); }
1480 CreateStructInnerScope
1481 structDeclList DeleteStructInnerScope { sRef_clearGlobalScopeSafe (); }
1483 { $$ = declareUnion ($3, $8); }
1484 | NotType CSTRUCT newId IsType TLBRACE TRBRACE
1485 { $$ = declareStruct ($3, uentryList_new ()); }
1486 | NotType CUNION newId IsType TLBRACE TRBRACE
1487 { $$ = declareUnion ($3, uentryList_new ()); }
1488 | NotType CSTRUCT IsType TLBRACE { sRef_setGlobalScopeSafe (); }
1489 CreateStructInnerScope
1490 structDeclList DeleteStructInnerScope { sRef_clearGlobalScopeSafe (); }
1492 { $$ = declareUnnamedStruct ($7); }
1493 | NotType CUNION IsType TLBRACE { sRef_setGlobalScopeSafe (); }
1494 CreateStructInnerScope structDeclList DeleteStructInnerScope
1495 { sRef_clearGlobalScopeSafe (); }
1497 { $$ = declareUnnamedUnion ($7); }
1498 | NotType CSTRUCT IsType TLBRACE TRBRACE
1499 { $$ = ctype_createUnnamedStruct (uentryList_new ()); }
1500 | NotType CUNION IsType TLBRACE TRBRACE
1501 { $$ = ctype_createUnnamedUnion (uentryList_new ()); }
1502 | NotType CSTRUCT newId NotType { $$ = handleStruct ($3); }
1503 | NotType CUNION newId NotType { $$ = handleUnion ($3); }
1507 : { cscannerHelp_clearExpectingTypeName (); }
1512 | macroDef { $$ = uentryList_undefined; /* bogus! */ }
1513 | structDeclList structDecl { $$ = uentryList_mergeFields ($1, $2); }
1517 : completeTypeSpecifier NotType structNamedDeclList IsType TSEMI
1518 { $$ = fixUentryList ($3, $1); }
1519 | completeTypeSpecifier IsType TSEMI
1520 { $$ = fixUnnamedDecl ($1); }
1524 : structNamedDecl NotType
1525 { $$ = idDeclList_singleton ($1); }
1526 | structNamedDeclList TCOMMA structNamedDecl NotType
1527 { $$ = idDeclList_add ($1, $3); }
1530 structNamedDecl /* hack to get around namespace problems */
1531 : namedDecl { $$ = $1; }
1532 | TCOLON IsType constantExpr { $$ = idDecl_undefined; }
1533 | namedDecl TCOLON IsType constantExpr { $$ = $1; }
1534 /* Need the IsType in case there is a cast in the constant expression. */
1538 : NotType CENUM TLBRACE enumeratorList TRBRACE IsType
1539 { $$ = declareUnnamedEnum ($4); }
1540 | NotType CENUM newId TLBRACE { context_pushLoc (); } enumeratorList TRBRACE IsType
1541 { context_popLoc (); $$ = declareEnum ($3, $6); }
1542 | NotType CENUM newId IsType { $$ = handleEnum ($3); }
1547 { $$ = enumNameList_single ($1); }
1548 | enumeratorList TCOMMA enumerator
1549 { $$ = enumNameList_push ($1, $3); }
1550 | enumeratorList TCOMMA
1555 { uentry ue = uentry_makeEnumConstant ($1, ctype_unknown);
1556 usymtab_supGlobalEntry (ue);
1559 | newId TASSIGN IsType constantExpr
1560 { uentry ue = uentry_makeEnumInitializedConstant ($1, ctype_unknown, $4);
1561 usymtab_supGlobalEntry (ue);
1568 | optAbstractDeclBase { $$ = idDecl_create (cstring_undefined, qtype_create ($1)); }
1569 | pointers TYPE_NAME
1571 qtype qt = qtype_unknown ();
1572 qtype_adjustPointers ($1, qt);
1573 $$ = idDecl_create (cstring_copy (cscannerHelp_observeLastIdentifier ()), qt);
1575 | pointers optNamedDecl
1576 { $$ = $2; qtype_adjustPointers ($1, idDecl_getTyp ($$)); }
1581 | pointers namedDeclBase
1582 { $$ = $2; qtype_adjustPointers ($1, idDecl_getTyp ($$)); }
1586 : paramTypeList { $$ = handleParamTypeList ($1); }
1587 | NotType paramIdList { $$ = handleParamIdList ($2); }
1591 : QCONST { $$ = qual_createConst (); }
1592 | QRESTRICT { $$ = qual_createRestrict (); }
1593 | QVOLATILE { $$ = qual_createVolatile (); }
1597 : innerMods { $$ = qualList_single ($1); }
1598 | innerModsList innerMods { $$ = qualList_add ($1, $2); }
1602 : TMULT { $$ = pointers_create ($1); }
1603 | TMULT innerModsList { $$ = pointers_createMods ($1, $2); }
1604 | TMULT pointers { $$ = pointers_extend (pointers_create ($1), $2); }
1605 | TMULT innerModsList pointers { $$ = pointers_extend (pointers_createMods ($1, $2), $3); }
1610 | idList TCOMMA CTOK_ELIPSIS { $$ = uentryList_add ($1, uentry_makeElipsisMarker ()); }
1614 : newId { $$ = uentryList_single (uentry_makeVariableLoc ($1, ctype_int)); }
1615 | idList TCOMMA newId { $$ = uentryList_add ($1, uentry_makeVariableLoc ($3, ctype_int)); }
1619 : CTOK_ELIPSIS { $$ = uentryList_single (uentry_makeElipsisMarker ()); }
1621 | paramList TCOMMA CTOK_ELIPSIS { $$ = uentryList_add ($1, uentry_makeElipsisMarker ()); }
1625 : { storeLoc (); } paramDecl { $$ = uentryList_single ($2); }
1626 | paramList TCOMMA { storeLoc (); } paramDecl
1627 { $$ = uentryList_add ($1, $4); }
1631 : IsType completeTypeSpecifier optNamedDecl IsType
1633 if (isFlipOldStyle ())
1635 llparseerror (cstring_makeLiteral ("Inconsistent function parameter syntax (mixing old and new style declaration)"));
1641 $$ = makeCurrentParam (idDecl_fixParamBase ($3, $2));
1643 | newId /* its an old-style declaration */
1645 idDecl tparam = idDecl_create ($1, qtype_unknown ());
1649 llparseerror (message ("Inconsistent function parameter syntax: %q",
1650 idDecl_unparse (tparam)));
1654 $$ = makeCurrentParam (tparam);
1655 idDecl_free (tparam);
1661 | completeType abstractDecl { $$ = qtype_newBase ($1, $2); }
1665 : pointers { $$ = ctype_adjustPointers ($1, ctype_unknown); }
1667 | pointers abstractDeclBase { $$ = ctype_adjustPointers ($1, $2); }
1671 : /* empty */ { $$ = ctype_unknown; }
1676 : IsType TLPAREN NotType abstractDecl TRPAREN
1677 { $$ = ctype_expectFunction ($4); }
1678 | TLSQBR TRSQBR { $$ = ctype_makeArray (ctype_unknown); }
1679 | TLSQBR constantExpr TRSQBR
1680 { $$ = ctype_makeFixedArray (ctype_unknown, exprNode_getLongValue ($2)); }
1681 | abstractDeclBase TLSQBR TRSQBR { $$ = ctype_makeInnerArray ($1); }
1682 | abstractDeclBase TLSQBR constantExpr TRSQBR
1683 { $$ = ctype_makeInnerFixedArray ($1, exprNode_getLongValue ($3)); }
1684 | IsType TLPAREN TRPAREN
1685 { $$ = ctype_makeFunction (ctype_unknown, uentryList_makeMissingParams ()); }
1686 | IsType TLPAREN paramTypeList TRPAREN
1687 { $$ = ctype_makeParamsFunction (ctype_unknown, $3); }
1688 | abstractDeclBase IsType TLPAREN TRPAREN
1689 { $$ = ctype_makeFunction ($1, uentryList_makeMissingParams ()); }
1690 | abstractDeclBase IsType TLPAREN paramTypeList TRPAREN
1691 { $$ = ctype_makeParamsFunction ($1, $4); }
1710 : QDREVEALSTATE TLPAREN expr TRPAREN { exprNode_revealState ($3); $$ = exprNode_undefined; }
1714 : iterDefStmtList { $$ = $1; }
1723 | iterDefStmtList iterDefStmt
1724 { $$ = exprNode_concat ($1, $2); }
1727 iterDefIterationStmt
1728 : iterWhilePred iterDefStmtList
1729 { $$ = exprNode_while ($1, $2); }
1730 | doHeader stmtErr WHILE TLPAREN expr TRPAREN TSEMI
1731 { $$ = exprNode_doWhile ($2, $5); }
1732 | doHeader stmtErr WHILE TLPAREN expr TRPAREN
1733 { $$ = exprNode_doWhile ($2, $5); }
1734 | forPred iterDefStmt
1735 { $$ = exprNode_for ($1, $2); }
1739 : CFOR TLPAREN optExpr TSEMI optExpr TSEMI
1740 { context_setProtectVars (); } optExpr { context_sizeofReleaseVars (); }
1742 { $$ = exprNode_forPred ($3, $5, $8);
1743 context_enterForClause ($5); }
1747 : ITER_NAME CreateInnerScope TLPAREN
1748 { setProcessingIterVars ($1); }
1750 { $$ = exprNode_iterStart ($1, $5); }
1751 | ITER_ENDNAME { $$ = exprNode_createId ($1); }
1758 | openScope initializerList { $$ = $1; DPRINTF (("def stmt: %s", exprNode_unparse ($$))); }
1763 | iterDefIterationStmt
1766 | TLPAREN iterDefStmt TRPAREN { $$ = $2; }
1767 | error { $$ = exprNode_makeError (); }
1771 : ifPred { exprNode_checkIfPred ($1); } iterDefStmt
1772 { /* don't: context_exitTrueClause ($1, $2); */
1773 $$ = exprNode_if ($1, $3);
1778 : CreateInnerScope TLBRACE { $$ = exprNode_createTok ($2); }
1782 : DeleteInnerScopeSafe TRBRACE { $$ = exprNode_createTok ($2); }
1799 | TLPAREN stmtErr TRPAREN { $$ = exprNode_addParens ($1, $2); }
1802 | error { $$ = exprNode_makeError (); }
1806 : newId TCOLON { $$ = exprNode_labelMarker ($1); }
1807 | QNOTREACHED stmt { $$ = exprNode_notReached ($2); }
1811 ** We allow more than one QFALLTHROUGH token to support mixed lint/splint markers.
1814 optExtraFallThroughs
1816 | QFALLTHROUGH optExtraFallThroughs { ; }
1819 /* Note that we can semantically check that the object to the case is
1820 indeed constant. In this case, we may not want to go through this effort */
1823 : CASE constantExpr { context_enterCaseClause ($2); }
1824 TCOLON { $$ = exprNode_caseMarker ($2, FALSE); }
1825 | QFALLTHROUGH optExtraFallThroughs CASE constantExpr { context_enterCaseClause ($4); }
1826 TCOLON { $$ = exprNode_caseMarker ($4, TRUE); }
1830 : DEFAULT { context_enterCaseClause (exprNode_undefined); }
1831 TCOLON { $$ = exprNode_defaultMarker ($1, FALSE); }
1832 | QFALLTHROUGH optExtraFallThroughs DEFAULT { context_enterCaseClause (exprNode_undefined); }
1833 TCOLON { $$ = exprNode_defaultMarker ($3, TRUE); }
1837 : TLPAREN compoundStmt TRPAREN { $$ = $2; }
1838 | CreateInnerScope compoundStmtAux
1839 { $$ = $2; context_exitInner ($2); }
1843 : CreateInnerScope compoundStmtAuxErr DeleteInnerScope { $$ = $2; }
1847 : { context_enterInnerContext (); }
1851 : { context_exitInnerPlain (); }
1854 CreateStructInnerScope
1855 : { context_enterStructInnerContext (); }
1858 DeleteStructInnerScope
1859 : { context_exitStructInnerContext (); }
1862 DeleteInnerScopeSafe
1863 : { context_exitInnerSafe (); }
1867 : TRBRACE { $$ = exprNode_createTok ($1); }
1868 | QNOTREACHED TRBRACE { $$ = exprNode_notReached (exprNode_createTok ($2)); }
1869 | stmtList TRBRACE { $$ = exprNode_updateLocation ($1, lltok_getLoc ($2)); }
1870 | stmtList QNOTREACHED TRBRACE
1871 { $$ = exprNode_notReached (exprNode_updateLocation ($1, lltok_getLoc ($3))); }
1872 | initializerList TRBRACE { $$ = exprNode_updateLocation ($1, lltok_getLoc ($2)); }
1873 | initializerList QNOTREACHED TRBRACE
1874 { $$ = exprNode_notReached (exprNode_updateLocation ($1, lltok_getLoc ($3))); }
1875 | initializerList stmtList TRBRACE
1876 { $$ = exprNode_updateLocation (exprNode_concat ($1, $2), lltok_getLoc ($3)); }
1877 | initializerList stmtList QNOTREACHED TRBRACE
1878 { $$ = exprNode_notReached (exprNode_updateLocation (exprNode_concat ($1, $2),
1879 lltok_getLoc ($3)));
1884 : TLBRACE compoundStmtRest
1885 { $$ = exprNode_makeBlock ($2); }
1890 { $$ = exprNode_createTok ($2); }
1891 | TLBRACE stmtListErr TRBRACE
1892 { $$ = exprNode_updateLocation ($2, lltok_getLoc ($3)); }
1893 | TLBRACE initializerList TRBRACE
1894 { $$ = exprNode_updateLocation ($2, lltok_getLoc ($3)); }
1895 | TLBRACE initializerList stmtList TRBRACE
1896 { $$ = exprNode_updateLocation (exprNode_concat ($2, $3), lltok_getLoc ($4)); }
1901 | stmtListErr stmtErr { $$ = exprNode_concat ($1, $2); }
1905 : initializer { $$ = $1; }
1906 | initializerList initializer { $$ = exprNode_concat ($1, $2); }
1910 : typeInitializer { $$ = $1; }
1911 | typeInitializerList TCOMMA typeInitializer { $$ = exprNode_concat ($1, $3); }
1915 : assignExpr { $$ = $1; }
1916 | TLBRACE typeInitializerList optComma TRBRACE { $$ = $2; }
1921 | stmtList stmt { $$ = exprNode_concat ($1, $2); }
1925 : TSEMI { $$ = exprNode_createTok ($1); }
1926 | expr TSEMI { $$ = exprNode_statement ($1, $2); }
1930 : TSEMI { $$ = exprNode_createTok ($1); }
1931 | expr TSEMI { $$ = exprNode_statement ($1, $2); }
1932 | expr { $$ = exprNode_checkExpr ($1); }
1936 : CIF TLPAREN expr TRPAREN
1938 exprNode_produceGuards ($3); context_enterTrueClause ($3);
1939 exprNode_checkIfPred ($3);
1944 ** not ANSI: | CIF TLPAREN compoundStmt TRPAREN
1945 ** { $$ = $3; context_enterTrueClause (); }
1952 context_exitTrueClause ($1, $2);
1953 $$ = exprNode_if ($1, $2);
1955 | ifPred stmt CELSE { context_enterFalseClause ($1); } stmt
1957 context_exitClause ($1, $2, $5);
1958 $$ = exprNode_ifelse ($1, $2, $5);
1960 | SWITCH TLPAREN expr { context_enterSwitch ($3); }
1961 TRPAREN stmt { $$ = exprNode_switch ($3, $6); }
1965 : WHILE TLPAREN expr TRPAREN
1966 { $$ = exprNode_whilePred ($3); context_enterWhileClause ($3); }
1967 /* not ANSI: | WHILE TLPAREN compoundStmt TRPAREN stmt { $$ = exprNode_while ($3, $5); } */
1971 : WHILE TLPAREN expr TRPAREN { $$ = exprNode_whilePred($3); }
1975 : ITER_NAME { context_enterIterClause (); }
1976 CreateInnerScope TLPAREN { setProcessingIterVars ($1); }
1978 compoundStmt endIter DeleteInnerScope
1980 $$ = exprNode_iter ($1, $6, $8, $9);
1986 : iterArgExpr { $$ = exprNodeList_singleton ($1); }
1987 | iterArgList { nextIterParam (); } TCOMMA iterArgExpr
1988 { $$ = exprNodeList_push ($1, $4); }
1992 : assignIterExpr { $$ = exprNode_iterExpr ($1); }
1993 | id { $$ = exprNode_iterId ($1); }
1994 | TYPE_NAME_OR_ID { uentry ue = cscannerHelp_coerceIterId ($1);
1996 if (uentry_isValid (ue))
1998 $$ = exprNode_iterId (ue);
2002 $$ = exprNode_iterNewId (cstring_copy (cscannerHelp_observeLastIdentifier ()));
2005 | NEW_IDENTIFIER { $$ = exprNode_iterNewId ($1); }
2009 ** everything is the same, EXCEPT it cannot be a NEW_IDENTIFIER
2014 | cconstantExpr CCONSTANT { $$ = exprNode_combineLiterals ($1, $2); }
2019 | TLPAREN expr TRPAREN { $$ = exprNode_addParens ($1, $2); }
2024 | postfixExpr TLSQBR expr TRSQBR { $$ = exprNode_arrayFetch ($1, $3); }
2025 | postfixExpr TLPAREN TRPAREN { $$ = exprNode_functionCall ($1, exprNodeList_new ()); }
2026 | postfixExpr TLPAREN argumentExprList TRPAREN { $$ = exprNode_functionCall ($1, $3); }
2027 | VA_ARG TLPAREN assignExpr TCOMMA typeExpression TRPAREN
2028 { $$ = exprNode_vaArg ($1, $3, $5); }
2029 | postfixExpr NotType TDOT newId IsType { $$ = exprNode_fieldAccess ($1, $3, $4); }
2030 | postfixExpr NotType ARROW_OP newId IsType { $$ = exprNode_arrowAccess ($1, $3, $4); }
2031 | postfixExpr INC_OP { $$ = exprNode_postOp ($1, $2); }
2032 | postfixExpr DEC_OP { $$ = exprNode_postOp ($1, $2); }
2037 | INC_OP unaryExpr { $$ = exprNode_preOp ($2, $1); }
2038 | DEC_OP unaryExpr { $$ = exprNode_preOp ($2, $1); }
2039 | TAMPERSAND castExpr { $$ = exprNode_preOp ($2, $1); }
2040 | TMULT castExpr { $$ = exprNode_preOp ($2, $1); }
2041 | TPLUS castExpr { $$ = exprNode_preOp ($2, $1); }
2042 | TMINUS castExpr { $$ = exprNode_preOp ($2, $1); }
2043 | TTILDE castExpr { $$ = exprNode_preOp ($2, $1); }
2044 | TEXCL castExpr { $$ = exprNode_preOp ($2, $1); }
2045 | sizeofExpr { $$ = $1; }
2050 | TLPAREN typeExpression TRPAREN castExpr { $$ = exprNode_cast ($1, $4, $2); }
2055 | timesExpr TMULT castExpr { $$ = exprNode_op ($1, $3, $2); }
2056 | timesExpr TDIV castExpr { $$ = exprNode_op ($1, $3, $2); }
2057 | timesExpr TPERCENT castExpr { $$ = exprNode_op ($1, $3, $2); }
2062 | plusExpr TPLUS timesExpr { $$ = exprNode_op ($1, $3, $2); }
2063 | plusExpr TMINUS timesExpr { $$ = exprNode_op ($1, $3, $2); }
2068 | shiftExpr LEFT_OP plusExpr { $$ = exprNode_op ($1, $3, $2); }
2069 | shiftExpr RIGHT_OP plusExpr { $$ = exprNode_op ($1, $3, $2); }
2074 | relationalExpr TLT shiftExpr { $$ = exprNode_op ($1, $3, $2); }
2075 | relationalExpr TGT shiftExpr { $$ = exprNode_op ($1, $3, $2); }
2076 | relationalExpr LE_OP shiftExpr { $$ = exprNode_op ($1, $3, $2); }
2077 | relationalExpr GE_OP shiftExpr { $$ = exprNode_op ($1, $3, $2); }
2081 : relationalIterExpr
2082 | equalityExpr EQ_OP relationalExpr { $$ = exprNode_op ($1, $3, $2); }
2083 | equalityExpr NE_OP relationalExpr { $$ = exprNode_op ($1, $3, $2); }
2088 | bitandExpr TAMPERSAND equalityExpr { $$ = exprNode_op ($1, $3, $2); }
2093 | xorExpr TCIRC bitandExpr { $$ = exprNode_op ($1, $3, $2); }
2098 | bitorExpr TBAR xorExpr { $$ = exprNode_op ($1, $3, $2); }
2103 | andExpr AND_OP bitorExpr { $$ = exprNode_op ($1, $3, $2); }
2108 | orExpr OR_OP andExpr { $$ = exprNode_op ($1, $3, $2); }
2113 | orExpr TQUEST { context_enterTrueClause ($1); }
2114 expr TCOLON { context_enterFalseClause ($1); } conditionalExpr
2115 { $$ = exprNode_cond ($1, $4, $7); }
2119 : conditionalIterExpr
2120 | unaryExpr TASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); }
2121 | unaryExpr MUL_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); }
2122 | unaryExpr DIV_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); }
2123 | unaryExpr MOD_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); }
2124 | unaryExpr ADD_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); }
2125 | unaryExpr SUB_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); }
2126 | unaryExpr LEFT_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); }
2127 | unaryExpr RIGHT_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); }
2128 | unaryExpr AND_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); }
2129 | unaryExpr XOR_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); }
2130 | unaryExpr OR_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); }
2134 : ITER_ENDNAME { $$ = $1; }
2135 | /* empty */ { $$ = uentry_undefined; }
2139 : DO { context_enterDoWhileClause (); $$ = $1; }
2144 { $$ = exprNode_while ($1, $2); context_exitWhileClause ($1, $2); }
2145 | doHeader stmt WHILE TLPAREN expr TRPAREN TSEMI
2146 { $$ = exprNode_statement (exprNode_doWhile ($2, $5), $7); }
2148 { $$ = exprNode_for ($1, $2); context_exitForClause ($1, $2); }
2152 : whilePred stmtErr { $$ = exprNode_while ($1, $2); context_exitWhileClause ($1, $2); }
2153 | doHeader stmtErr WHILE TLPAREN expr TRPAREN TSEMI
2154 { $$ = exprNode_statement (exprNode_doWhile ($2, $5), $7); }
2155 | doHeader stmtErr WHILE TLPAREN expr TRPAREN
2156 { $$ = exprNode_doWhile ($2, $5); }
2157 | forPred stmtErr { $$ = exprNode_for ($1, $2); context_exitForClause ($1, $2); }
2161 : GOTO newId TSEMI { $$ = exprNode_goto ($2); }
2162 | CONTINUE TSEMI { $$ = exprNode_continue ($1, BADTOK); }
2163 | QINNERCONTINUE CONTINUE TSEMI
2164 { $$ = exprNode_continue ($1, QINNERCONTINUE); }
2165 | BREAK TSEMI { $$ = exprNode_break ($1, BADTOK); }
2166 | QSWITCHBREAK BREAK TSEMI { $$ = exprNode_break ($2, QSWITCHBREAK); }
2167 | QLOOPBREAK BREAK TSEMI { $$ = exprNode_break ($2, QLOOPBREAK); }
2168 | QINNERBREAK BREAK TSEMI { $$ = exprNode_break ($2, QINNERBREAK); }
2169 | QSAFEBREAK BREAK TSEMI { $$ = exprNode_break ($2, QSAFEBREAK); }
2170 | RETURN TSEMI { $$ = exprNode_nullReturn ($1); }
2171 | RETURN expr TSEMI { $$ = exprNode_return ($2); }
2190 | ITER_NAME { $$ = uentry_getName ($1); }
2191 | ITER_ENDNAME { $$ = uentry_getName ($1); }
2192 | id { $$ = uentry_getName ($1); }
2193 | TYPE_NAME_OR_ID { $$ = $1; }
2198 | TYPE_NAME_OR_ID { $$ = ctype_unknown; }
2199 | CTYPEOF TLPAREN expr TRPAREN { $$ = exprNode_getType ($3); exprNode_free ($3); }
2200 | CTYPEOF TLPAREN typeExpression TRPAREN { $$ = qtype_getType ($3); }
2205 /*@-redecl@*/ /*@-namechecks@*/
2206 extern char *yytext;
2207 /*@=redecl@*/ /*@=namechecks@*/
2209 # include "bison.reset"
2211 void yyerror (/*@unused@*/ char *s)
2213 static bool givehint = FALSE;
2215 if (context_inIterDef ())
2217 llerror (FLG_SYNTAX, message ("Iter syntax not parseable: %s",
2218 context_inFunctionName ()));
2220 else if (context_inIterEnd ())
2222 llerror (FLG_SYNTAX, message ("Iter finalizer syntax not parseable: %s",
2223 context_inFunctionName ()));
2225 else if (context_inMacro ())
2227 llerror (FLG_SYNTAX, message ("Macro syntax not parseable: %s",
2228 context_inFunctionName ()));
2230 if (context_inUnknownMacro ())
2234 llhint (cstring_makeLiteral
2235 ("Precede macro definition with /*@notfunction@*/ "
2236 "to suppress checking and force expansion"));
2241 cscannerHelp_swallowMacro ();
2242 context_exitAllClausesQuiet ();
2246 llparseerror (cstring_undefined);