Resolve long-standing left/right binding issue with '**'

This commit is contained in:
K. Lange 2022-07-20 09:21:21 +09:00
parent b966db7b91
commit 79a4a02b58
3 changed files with 3 additions and 1 deletions

View File

@ -812,7 +812,7 @@ static void compare(int exprType, RewindState *rewind) {
static void binary(int exprType, RewindState *rewind) {
KrkTokenType operatorType = parser.previous.type;
ParseRule * rule = getRule(operatorType);
parsePrecedence((Precedence)(rule->precedence + 1));
parsePrecedence((Precedence)(rule->precedence + (rule->precedence != PREC_EXPONENT)));
invalidTarget(exprType, "operator");
switch (operatorType) {

1
test/testPow.krk Normal file
View File

@ -0,0 +1 @@
print(2**3**4)

1
test/testPow.krk.expect Normal file
View File

@ -0,0 +1 @@
2417851639229258349412352