Index: src/Parser/parser.yy
===================================================================
--- src/Parser/parser.yy	(revision 2065609d54faba689bd6249eb4c159415fb8bf29)
+++ src/Parser/parser.yy	(revision 26238c181d3602cb7a91e2509316bdb5f5fa32eb)
@@ -10,6 +10,6 @@
 // Created On       : Sat Sep  1 20:22:55 2001
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Aug 23 21:08:08 2017
-// Update Count     : 2704
+// Last Modified On : Sat Aug 26 17:50:19 2017
+// Update Count     : 2712
 //
 
@@ -120,5 +120,5 @@
 %token RESTRICT											// C99
 %token ATOMIC											// C11
-%token FORALL MUTEX VIRTUAL						// CFA
+%token FORALL MUTEX VIRTUAL								// CFA
 %token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED
 %token BOOL COMPLEX IMAGINARY							// C99
@@ -188,22 +188,21 @@
 %type<flag> asm_volatile_opt
 %type<en> handler_predicate_opt
-%type<en> when_clause_opt timeout
 
 // statements
-%type<sn> labeled_statement				compound_statement			expression_statement		selection_statement
-%type<sn> iteration_statement			jump_statement
-%type<sn> with_statement				exception_statement			asm_statement
-%type<sn> waitfor_statement
-%type<sn> fall_through_opt				fall_through
-%type<sn> statement						statement_list
-%type<sn> block_item_list				block_item
-%type<sn> with_clause_opt
+%type<sn> statement						labeled_statement			compound_statement
+%type<sn> statement_decl				statement_decl_list			statement_list_nodecl
+%type<sn> selection_statement
+%type<sn> switch_clause_list_opt		switch_clause_list			choose_clause_list_opt		choose_clause_list
 %type<en> case_value
 %type<sn> case_clause					case_value_list				case_label					case_label_list
-%type<sn> switch_clause_list_opt		switch_clause_list			choose_clause_list_opt		choose_clause_list
-%type<sn> handler_clause				finally_clause
+%type<sn> fall_through					fall_through_opt
+%type<sn> iteration_statement			jump_statement
+%type<sn> expression_statement			asm_statement
+%type<sn> with_statement				with_clause_opt
+%type<sn> exception_statement			handler_clause				finally_clause
 %type<catch_kind> handler_key
+%type<en> when_clause					when_clause_opt				waitfor						timeout
+%type<sn> waitfor_statement
 %type<wfs> waitfor_clause
-%type<en> waitfor
 
 // declarations
@@ -777,16 +776,16 @@
 	  push push
 	  local_label_declaration_opt						// GCC, local labels
-	  block_item_list									// C99, intermix declarations and statements
+	  statement_decl_list								// C99, intermix declarations and statements
 	  pop '}'
 		{ $$ = new StatementNode( build_compound( $5 ) ); }
 	;
 
-block_item_list:										// C99
-	block_item
-	| block_item_list push block_item
+statement_decl_list:									// C99
+	statement_decl
+	| statement_decl_list push statement_decl
 		{ if ( $1 != 0 ) { $1->set_last( $3 ); $$ = $1; } }
 	;
 
-block_item:
+statement_decl:
 	declaration											// CFA, new & old style declarations
 		{ $$ = new StatementNode( $1 ); }
@@ -806,7 +805,7 @@
 	;
 
-statement_list:
+statement_list_nodecl:
 	statement
-	| statement_list statement
+	| statement_list_nodecl statement
 		{ if ( $1 != 0 ) { $1->set_last( $2 ); $$ = $1; } }
 	;
@@ -818,5 +817,5 @@
 
 selection_statement:
-	IF '(' push if_control_expression ')' statement				%prec THEN
+	IF '(' push if_control_expression ')' statement		%prec THEN
 		// explicitly deal with the shift/reduce conflict on if/else
 		{ $$ = new StatementNode( build_if( $4, $6, nullptr ) ); }
@@ -893,7 +892,7 @@
 
 switch_clause_list:										// CFA
-	case_label_list statement_list
+	case_label_list statement_list_nodecl
 		{ $$ = $1->append_last_case( new StatementNode( build_compound( $2 ) ) ); }
-	| switch_clause_list case_label_list statement_list
+	| switch_clause_list case_label_list statement_list_nodecl
 		{ $$ = (StatementNode *)( $1->set_last( $2->append_last_case( new StatementNode( build_compound( $3 ) ) ) ) ); }
 	;
@@ -908,9 +907,9 @@
 	case_label_list fall_through
 		{ $$ = $1->append_last_case( $2 ); }
-	| case_label_list statement_list fall_through_opt
+	| case_label_list statement_list_nodecl fall_through_opt
 		{ $$ = $1->append_last_case( new StatementNode( build_compound( (StatementNode *)$2->set_last( $3 ) ) ) ); }
 	| choose_clause_list case_label_list fall_through
 		{ $$ = (StatementNode *)( $1->set_last( $2->append_last_case( $3 ))); }
-	| choose_clause_list case_label_list statement_list fall_through_opt
+	| choose_clause_list case_label_list statement_list_nodecl fall_through_opt
 		{ $$ = (StatementNode *)( $1->set_last( $2->append_last_case( new StatementNode( build_compound( (StatementNode *)$3->set_last( $4 ) ) ) ) ) ); }
 	;
@@ -981,9 +980,13 @@
 	;
 
+when_clause:
+	WHEN '(' comma_expression ')'
+		{ $$ = $3; }
+	;
+
 when_clause_opt:
 	// empty
 		{ $$ = nullptr; }
-	| WHEN '(' comma_expression ')'
-		{ $$ = $3; }
+	| when_clause
 	;
 
@@ -1008,18 +1011,19 @@
 
 waitfor_clause:
-	when_clause_opt waitfor statement %prec THEN
+	when_clause_opt waitfor statement					%prec THEN
  		{ $$ = build_waitfor( $2, $3, $1 ); }
 	| when_clause_opt waitfor statement WOR waitfor_clause
  		{ $$ = build_waitfor( $2, $3, $1, $5 ); }
-	| when_clause_opt timeout statement %prec THEN
+	| when_clause_opt timeout statement					%prec THEN
  		{ $$ = build_waitfor_timeout( $2, $3, $1 ); }
 	| when_clause_opt ELSE statement
  		{ $$ = build_waitfor_timeout( nullptr, $3, $1 ); }
-	| when_clause_opt timeout statement WOR when_clause_opt ELSE statement
+		// "else" must be conditional after timeout or timeout is never triggered (i.e., it is meaningless)
+	| when_clause_opt timeout statement WOR when_clause ELSE statement
  		{ $$ = build_waitfor_timeout( $2, $3, $1, $7, $5 ); }
 	;
 
 waitfor_statement:
-	when_clause_opt waitfor statement %prec THEN
+	when_clause_opt waitfor statement					%prec THEN
  		{ $$ = new StatementNode( build_waitfor( $2, $3, $1 ) ); }
 	| when_clause_opt waitfor statement WOR waitfor_clause
