Skip to content

Commit d8ed7ec

Browse files
committed
Fixed parsing logic for variable declaration expression.
1 parent 63ac7fc commit d8ed7ec

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/zhivo/parser/Parser.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ std::unique_ptr<ASTNode> Parser::exprVal() {
865865
}
866866

867867
std::map<Token, std::unique_ptr<ASTNode>> declarations;
868-
while(!this->isNext(";", TokenType::OPERATOR)) {
868+
while(true) {
869869
if(!declarations.empty())
870870
this->consume(",");
871871

@@ -889,6 +889,9 @@ std::unique_ptr<ASTNode> Parser::exprVal() {
889889
);
890890

891891
declarations.insert({variable, std::move(value)});
892+
893+
if(!this->isNext(",", TokenType::OPERATOR))
894+
break;
892895
}
893896

894897
return std::make_unique<VariableDeclarationExpression>(

0 commit comments

Comments
 (0)