Fix arrayElement operator

This commit is contained in:
Nikolay Degterinsky 2022-05-19 08:37:26 +00:00
parent ecfed4aaef
commit 73adb4bb59

View File

@ -1766,15 +1766,6 @@ bool ParserExpression2::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
storage.push_back(std::make_unique<Layer>(TokenType::ClosingRoundBracket, function_name));
}
}
else if (pos->type == TokenType::OpeningSquareBracket)
{
next = Action::OPERAND;
storage.back()->pushOperand(std::move(tmp));
storage.back()->pushOperator(Operator("arrayElement", 40, 2));
storage.push_back(std::make_unique<Layer>(TokenType::ClosingSquareBracket));
++pos;
}
else
{
storage.back()->pushOperand(std::move(tmp));
@ -1841,6 +1832,12 @@ bool ParserExpression2::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
}
storage.back()->pushOperator(cur_op->second);
}
else if (pos->type == TokenType::OpeningSquareBracket)
{
storage.back()->pushOperator(Operator("arrayElement", 40, 2));
storage.push_back(std::make_unique<Layer>(TokenType::ClosingSquareBracket));
++pos;
}
else if (parseOperator(pos, "::", expected))
{
next = Action::OPERATOR;