diff options
author | Conrad Pankoff <deoxxa@fknsrs.biz> | 2020-03-12 23:07:08 +1100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-03-12 13:42:23 +0100 |
commit | 0fe87c5fec856e174157a6adce5a41e760851885 (patch) | |
tree | b1f0aba340e00ffd5c27f11fe15481cce3146bb1 /Libraries/LibJS/Parser.cpp | |
parent | fdf7f81ba9723b2c2cb21dbd8460e563ea6db45a (diff) | |
download | serenity-0fe87c5fec856e174157a6adce5a41e760851885.zip |
LibJS: Implement <= and >= binary operators
Diffstat (limited to 'Libraries/LibJS/Parser.cpp')
-rw-r--r-- | Libraries/LibJS/Parser.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Libraries/LibJS/Parser.cpp b/Libraries/LibJS/Parser.cpp index df5e3bca32..38e278300c 100644 --- a/Libraries/LibJS/Parser.cpp +++ b/Libraries/LibJS/Parser.cpp @@ -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; } |