Index: src/Parser/parser.yy
===================================================================
--- src/Parser/parser.yy	(revision 6b224a52e644258a65fc4b1af5b45c5d9c835149)
+++ src/Parser/parser.yy	(revision 51d6d6a1e904f8ce3655c12aec30eef88af6d6b2)
@@ -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 14:41:43 2017
+// Update Count     : 2711
 //
 
@@ -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> with_clause_opt				with_statement
+%type<sn> exception_statement			handler_clause				finally_clause
+%type<catch_kind> handler_key
+%type<en> when_clause					when_clause_opt				timeout
 %type<sn> waitfor_statement
-%type<sn> fall_through_opt				fall_through
-%type<sn> statement						statement_list
+%type<en> waitfor
+%type<wfs> waitfor_clause
+%type<sn> statement						statement_list				asm_statement
 %type<sn> block_item_list				block_item
-%type<sn> with_clause_opt
 %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<catch_kind> handler_key
-%type<wfs> waitfor_clause
-%type<en> waitfor
+%type<sn> fall_through					fall_through_opt
 
 // declarations
@@ -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 ) ); }
@@ -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
