harec

[hare] Hare compiler, written in C11 for POSIX OSs
Log | Files | Refs | README | LICENSE

commit 2106aeb4546a4d143363f789a66d27a0114bba91
parent ad8ea63a84d097ced8c588efe87b5624f0a0ad09
Author: Sebastian <sebastian@sebsite.pw>
Date:   Thu,  5 Jan 2023 18:01:26 -0500

parse: allow control expression in parentheses

e.g. (yield foo);

Not that you'd ever want to do this, but the spec requires it and it's
trivial to implement.

Signed-off-by: Sebastian <sebastian@sebsite.pw>

Diffstat:
Msrc/parse.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/parse.c b/src/parse.c @@ -2185,7 +2185,7 @@ parse_control_expression(struct lexer *lexer) exp->_return.value = NULL; switch (lex(lexer, &tok)) { case T_SEMICOLON: - case T_COMMA: + case T_RPAREN: unlex(lexer, &tok); break; default: @@ -2199,6 +2199,7 @@ parse_control_expression(struct lexer *lexer) exp->control.value = NULL; switch (lex(lexer, &tok)) { case T_SEMICOLON: + case T_RPAREN: unlex(lexer, &tok); break; case T_COLON: