Fix binding power of * // /

This commit is contained in:
Tangent Wantwight 2024-05-18 21:24:43 -04:00
parent 21e8d95f98
commit 1078dc3653

View file

@ -80,13 +80,13 @@ const Operators: TokenHandler[] = [
leftBindingPower: 20,
token: TIMES_TOKEN,
parse: ({ value: left }, matched, parser) =>
map(parser.parseSubExpression(11), (right) => ({ value: left * right })),
map(parser.parseSubExpression(21), (right) => ({ value: left * right })),
},
{
leftBindingPower: 20,
token: FLOOR_TOKEN,
parse: ({ value: left }, matched, parser) =>
map(parser.parseSubExpression(11), (right) => ({
map(parser.parseSubExpression(21), (right) => ({
value: Math.floor(left / right),
})),
},
@ -94,7 +94,7 @@ const Operators: TokenHandler[] = [
leftBindingPower: 20,
token: DIV_TOKEN,
parse: ({ value: left }, matched, parser) =>
map(parser.parseSubExpression(11), (right) => ({ value: left / right })),
map(parser.parseSubExpression(21), (right) => ({ value: left / right })),
},
];