commit 65be00677f3190335a9d2ad05112573b4ed4a4e9
parent 4ef3f8f465c92471ee4739400e6092854eb5f82b
Author: Alexey Yerin <yyp@disroot.org>
Date: Tue, 31 Oct 2023 16:10:41 +0300
hare::parse: Disallow single element tuples
Bootstrap harec already disallows them and in general they are incredibly
broken.
Signed-off-by: Alexey Yerin <yyp@disroot.org>
Diffstat:
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/hare/parse/expr.ha b/hare/parse/expr.ha
@@ -997,15 +997,14 @@ fn plain_tuple(
append(values, alloc(ex));
for (true) {
- match (try(lexer, ltok::RPAREN)?) {
- case lex::token => break;
- case void => void;
- };
-
append(values, alloc(expr(lexer)?));
match (try(lexer, ltok::COMMA)?) {
- case lex::token => void;
+ case lex::token =>
+ match (try(lexer, ltok::RPAREN)) {
+ case lex::token => break;
+ case => void;
+ };
case void =>
want(lexer, ltok::RPAREN)?;
break;