/* additional tokens introduced by splint pre-processor. */
%token <tok> LLMACRO LLMACROITER LLMACROEND TENDMACRO
+/* For debugging purposes */
+%token <tok> QDREVEALSTATE
+
/* break comments: */
%token <tok> QSWITCHBREAK QLOOPBREAK QINNERBREAK QSAFEBREAK
%token <tok> QINNERCONTINUE
%type <entry> endIter
%type <funcclauselist> functionClauses functionClausesPlain
-%type <funcclause> functionClause functionClause functionClausePlain
+%type <funcclause> functionClause functionClausePlain
%type <globsclause> globalsClause globalsClausePlain
%type <modsclause> modifiesClause modifiesClausePlain nomodsClause
%type <expr> orIterExpr conditionalIterExpr assignIterExpr iterArgExpr
%type <expr> expr optExpr constantExpr
%type <expr> init macroBody iterBody endBody partialIterStmt iterSelectionStmt
-%type <expr> stmt stmtList fcnBody iterStmt iterDefStmt iterDefStmtList
+%type <expr> stmt stmtList fcnBody iterStmt iterDefStmt iterDefStmtList debugStmt
%type <expr> labeledStmt caseStmt defaultStmt
%type <expr> compoundStmt compoundStmtAux compoundStmtRest compoundStmtAuxErr
%type <expr> expressionStmt selectionStmt iterationStmt jumpStmt iterDefIterationStmt
conditionalExpr
: orExpr
+ | orExpr TQUEST
+ { /* GCC extension: conditional with empty if */
+ exprNode_produceGuards ($1); context_enterTrueClause ($1); } TCOLON
+ { context_enterFalseClause ($1); } conditionalExpr
+ { $$ = exprNode_condIfOmit ($1, $6); context_exitClause ($1, exprNode_undefined, $6); }
| orExpr TQUEST { exprNode_produceGuards ($1); context_enterTrueClause ($1); } expr TCOLON
{ context_enterFalseClause ($1); } conditionalExpr
{ $$ = exprNode_cond ($1, $4, $7); context_exitClause ($1, $4, $7); }
| iterationStmt
| iterStmt
| jumpStmt
+ | debugStmt
;
+debugStmt
+ : QDREVEALSTATE TLPAREN expr TRPAREN { exprNode_revealState ($3); $$ = exprNode_undefined; }
+;
iterBody
: iterDefStmtList { $$ = $1; }
| iterationStmtErr
| TLPAREN stmtErr TRPAREN { $$ = exprNode_addParens ($1, $2); }
| jumpStmt
+ | debugStmt
| error { $$ = exprNode_makeError (); }
;
conditionalIterExpr
: orIterExpr
+ | orExpr TQUEST { context_enterTrueClause ($1); }
+ TCOLON { context_enterFalseClause ($1); } conditionalExpr
+ { $$ = exprNode_condIfOmit ($1, $6); }
| orExpr TQUEST { context_enterTrueClause ($1); }
expr TCOLON { context_enterFalseClause ($1); } conditionalExpr
{ $$ = exprNode_cond ($1, $4, $7); }