Skip to content

Commit

Permalink
fix: change if statement parsing to correctly parse if-else blocks on…
Browse files Browse the repository at this point in the history
… linux
  • Loading branch information
alexdovzhanyn committed Sep 30, 2024
1 parent c6af0d9 commit 1d4cd6a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/parser/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,9 @@ namespace Theta {
};

while (match(Token::KEYWORD, Lexemes::ELSE) && match(Token::KEYWORD, Lexemes::IF)) {
conditionExpressionPairs.push_back(make_pair(parseExpression(cfNode), parseBlock(cfNode)));
cnd = parseExpression(cfNode);
expr = parseBlock(cfNode);
conditionExpressionPairs.push_back(make_pair(cnd, expr));
}

// If we just matched an else but no if afterwards. This way it only matches one else block per control flow
Expand Down

0 comments on commit 1d4cd6a

Please sign in to comment.