From 3123a3eb404145cb25222540a9e6a3e90cf27892 Mon Sep 17 00:00:00 2001 From: K Lange Date: Tue, 16 Mar 2021 21:12:08 +0900 Subject: [PATCH] Change a couple of recurse parses to accept assignments or tuples --- src/compiler.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler.c b/src/compiler.c index 710ee54..ef2a5b8 100644 --- a/src/compiler.c +++ b/src/compiler.c @@ -1697,7 +1697,7 @@ static void returnStatement() { if (current->type == TYPE_INIT) { error("Can not return values from __init__"); } - expression(); + parsePrecedence(PREC_ASSIGNMENT); emitByte(OP_RETURN); } } @@ -1711,7 +1711,7 @@ static void yieldStatement() { if (check(TOKEN_EOL) || check(TOKEN_EOF)) { emitByte(OP_NONE); } else { - expression(); + parsePrecedence(PREC_ASSIGNMENT); } emitBytes(OP_YIELD, OP_POP); } @@ -1781,7 +1781,7 @@ static void tryStatement() { } static void raiseStatement() { - expression(); + parsePrecedence(PREC_ASSIGNMENT); emitByte(OP_RAISE); } @@ -2078,7 +2078,7 @@ static void string(int type) { KrkScanner inner = (KrkScanner){.start=c+1, .cur=c+1, .linePtr=lineBefore, .line=lineNo, .startOfLine = 0, .hasUnget = 0}; krk_rewindScanner(inner); advance(); - expression(); + parsePrecedence(PREC_COMMA); /* allow unparen'd tuples, but not assignments, as expressions in f-strings */ if (parser.hadError) { FREE_ARRAY(char,stringBytes,stringCapacity); return;