Changes in / [43109ce:25d32e7]
- Location:
- src/Parser
- Files:
-
- 3 edited
-
StatementNode.cc (modified) (2 diffs)
-
StatementNode.h (modified) (2 diffs)
-
parser.yy (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/StatementNode.cc
r43109ce r25d32e7 10 10 // Author : Rodolfo G. Esteves 11 11 // Created On : Sat May 16 14:59:41 2015 12 // Last Modified By : Peter A. Buhr13 // Last Modified On : Fri Aug 11 11:44:15202314 // Update Count : 42 912 // Last Modified By : Andrew Beach 13 // Last Modified On : Tue Apr 11 10:16:00 2023 14 // Update Count : 428 15 15 // 16 16 … … 374 374 } 375 375 376 ast::WaitUntilStmt::ClauseNode * build_waituntil_timeout( const CodeLocation & loc, ExpressionNode * when, ExpressionNode * timeout, StatementNode * stmt ) { 377 ast::WhenClause * clause = new ast::WhenClause( loc ); 378 clause->when_cond = notZeroExpr( maybeMoveBuild( when ) ); 379 clause->stmt = maybeMoveBuild( stmt ); 380 clause->target = maybeMoveBuild( timeout ); 381 return new ast::WaitUntilStmt::ClauseNode( ast::WaitUntilStmt::ClauseNode::Op::TIMEOUT, clause ); 382 } 383 376 384 ast::WaitUntilStmt * build_waituntil_stmt( const CodeLocation & loc, ast::WaitUntilStmt::ClauseNode * root ) { 377 385 ast::WaitUntilStmt * retStmt = new ast::WaitUntilStmt( loc ); -
src/Parser/StatementNode.h
r43109ce r25d32e7 9 9 // Author : Andrew Beach 10 10 // Created On : Wed Apr 5 11:42:00 2023 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Aug 11 11:44:07202313 // Update Count : 211 // Last Modified By : Andrew Beach 12 // Last Modified On : Tue Apr 11 9:43:00 2023 13 // Update Count : 1 14 14 // 15 15 … … 102 102 ast::WaitUntilStmt::ClauseNode * build_waituntil_clause( const CodeLocation &, ExpressionNode * when, ExpressionNode * targetExpr, StatementNode * stmt ); 103 103 ast::WaitUntilStmt::ClauseNode * build_waituntil_else( const CodeLocation &, ExpressionNode * when, StatementNode * stmt ); 104 ast::WaitUntilStmt::ClauseNode * build_waituntil_timeout( const CodeLocation &, ExpressionNode * when, ExpressionNode * timeout, StatementNode * stmt ); 104 105 ast::WaitUntilStmt * build_waituntil_stmt( const CodeLocation &, ast::WaitUntilStmt::ClauseNode * root ); 105 106 ast::Stmt * build_with( const CodeLocation &, ExpressionNode * exprs, StatementNode * stmt ); -
src/Parser/parser.yy
r43109ce r25d32e7 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jul 18 22:51:30202313 // Update Count : 63 9112 // Last Modified On : Wed Jul 12 23:06:44 2023 13 // Update Count : 6389 14 14 // 15 15 … … 1708 1708 | wor_waituntil_clause wor when_clause_opt ELSE statement 1709 1709 { $$ = new ast::WaitUntilStmt::ClauseNode( ast::WaitUntilStmt::ClauseNode::Op::LEFT_OR, $1, build_waituntil_else( yylloc, $3, maybe_build_compound( yylloc, $5 ) ) ); } 1710 | wor_waituntil_clause wor when_clause_opt timeout statement %prec THEN 1711 { $$ = new ast::WaitUntilStmt::ClauseNode( ast::WaitUntilStmt::ClauseNode::Op::LEFT_OR, $1, build_waituntil_timeout( yylloc, $3, $4, maybe_build_compound( yylloc, $5 ) ) ); } 1712 // "else" must be conditional after timeout or timeout is never triggered (i.e., it is meaningless) 1713 | wor_waituntil_clause wor when_clause_opt timeout statement wor ELSE statement // invalid syntax rule 1714 { SemanticError( yylloc, "syntax error, else clause must be conditional after timeout or timeout never triggered." ); $$ = nullptr; } 1715 | wor_waituntil_clause wor when_clause_opt timeout statement wor when_clause ELSE statement 1716 { $$ = new ast::WaitUntilStmt::ClauseNode( ast::WaitUntilStmt::ClauseNode::Op::LEFT_OR, $1, 1717 new ast::WaitUntilStmt::ClauseNode( ast::WaitUntilStmt::ClauseNode::Op::OR, 1718 build_waituntil_timeout( yylloc, $3, $4, maybe_build_compound( yylloc, $5 ) ), 1719 build_waituntil_else( yylloc, $7, maybe_build_compound( yylloc, $9 ) ) ) ); } 1710 1720 ; 1711 1721 1712 1722 waituntil_statement: 1713 1723 wor_waituntil_clause %prec THEN 1714 { $$ = new StatementNode( build_waituntil_stmt( yylloc, $1 ) ); } 1724 // SKULLDUGGERY: create an empty compound statement to test parsing of waituntil statement. 1725 { 1726 $$ = new StatementNode( build_waituntil_stmt( yylloc, $1 ) ); 1727 // $$ = new StatementNode( build_compound( yylloc, nullptr ) ); 1728 } 1715 1729 ; 1716 1730
Note:
See TracChangeset
for help on using the changeset viewer.