From 3b22716529a867bb72058dfd7714460feb84871f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Dorn?= Date: Fri, 5 Nov 2021 18:57:59 +0100 Subject: [PATCH] fix misplaced comma exception when calling a function the corresponding regression test is in the previous commit --- src/Tokens/Comma.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Tokens/Comma.php b/src/Tokens/Comma.php index 84ff223..f66bb78 100644 --- a/src/Tokens/Comma.php +++ b/src/Tokens/Comma.php @@ -8,12 +8,17 @@ class Comma extends Token { + public function __construct(public string $value = ',') + { + + } + public function consume(Runtime $runtime): void { // If the token is a function argument separator (e.g., a comma): $pe = false; - while ($runtime->operatorStack->isEmpty()) { + while (!$runtime->operatorStack->isEmpty()) { $token = $runtime->operatorStack->top(); if ($token instanceof OpenParenthesis) {