Fixed boolean OR never being parsed

This commit is contained in:
WerWolv 2021-01-10 22:52:28 +01:00
parent e4c2049975
commit 557313ae1e
1 changed files with 3 additions and 3 deletions

View File

@ -240,15 +240,15 @@ namespace hex::lang {
// (parseBooleanOr) ? (parseBooleanOr) : (parseBooleanOr)
ASTNode* Parser::parseTernaryConditional() {
auto node = this->parseBooleanXor();
auto node = this->parseBooleanOr();
while (MATCHES(sequence(OPERATOR_TERNARYCONDITIONAL))) {
auto second = this->parseBooleanXor();
auto second = this->parseBooleanOr();
if (!MATCHES(sequence(OPERATOR_INHERIT)))
throwParseError("expected ':' in ternary expression");
auto third = this->parseBooleanXor();
auto third = this->parseBooleanOr();
node = new ASTNodeTernaryExpression(node, second, third, Token::Operator::TernaryConditional);
}