1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

LibJS: Implement <= and >= binary operators

This commit is contained in:
Conrad Pankoff 2020-03-12 23:07:08 +11:00 committed by Andreas Kling
parent fdf7f81ba9
commit 0fe87c5fec
6 changed files with 38 additions and 0 deletions

View file

@ -133,6 +133,12 @@ NonnullOwnPtr<Expression> Parser::parse_secondary_expression(NonnullOwnPtr<Expre
case TokenType::Slash:
consume();
return make<BinaryExpression>(BinaryOp::Slash, move(lhs), parse_expression());
case TokenType::GreaterThanEquals:
consume();
return make<BinaryExpression>(BinaryOp::GreaterThanEquals, move(lhs), parse_expression());
case TokenType::LessThanEquals:
consume();
return make<BinaryExpression>(BinaryOp::LessThanEquals, move(lhs), parse_expression());
case TokenType::ParenOpen:
return parse_call_expression(move(lhs));
case TokenType::Equals:
@ -248,6 +254,8 @@ bool Parser::match_secondary_expression() const
|| type == TokenType::Asterisk
|| type == TokenType::Slash
|| type == TokenType::Equals
|| type == TokenType::GreaterThanEquals
|| type == TokenType::LessThanEquals
|| type == TokenType::ParenOpen
|| type == TokenType::Period;
}