summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConrad Pankoff <deoxxa@fknsrs.biz>2020-03-12 23:10:27 +1100
committerAndreas Kling <kling@serenityos.org>2020-03-12 13:42:23 +0100
commit9d41aa4d5d9d051cd206163f038c7b7f7381123a (patch)
treebaf24e5f65bf4eddd1296352ebbd2dfbb227f089
parent2b36b4f09ff280ae821b73d73035ba95421701e8 (diff)
downloadserenity-9d41aa4d5d9d051cd206163f038c7b7f7381123a.zip
LibJS: Parse > and < binary operators
-rw-r--r--Libraries/LibJS/Parser.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/Libraries/LibJS/Parser.cpp b/Libraries/LibJS/Parser.cpp
index c022b96b6c..746620484b 100644
--- a/Libraries/LibJS/Parser.cpp
+++ b/Libraries/LibJS/Parser.cpp
@@ -145,9 +145,15 @@ NonnullOwnPtr<Expression> Parser::parse_secondary_expression(NonnullOwnPtr<Expre
case TokenType::SlashEquals:
consume();
return make<AssignmentExpression>(AssignmentOp::SlashEquals, move(lhs), parse_expression());
+ case TokenType::GreaterThan:
+ consume();
+ return make<BinaryExpression>(BinaryOp::GreaterThan, move(lhs), parse_expression());
case TokenType::GreaterThanEquals:
consume();
return make<BinaryExpression>(BinaryOp::GreaterThanEquals, move(lhs), parse_expression());
+ case TokenType::LessThan:
+ consume();
+ return make<BinaryExpression>(BinaryOp::LessThan, move(lhs), parse_expression());
case TokenType::LessThanEquals:
consume();
return make<BinaryExpression>(BinaryOp::LessThanEquals, move(lhs), parse_expression());
@@ -270,7 +276,9 @@ bool Parser::match_secondary_expression() const
|| type == TokenType::Slash
|| type == TokenType::SlashEquals
|| type == TokenType::Equals
+ || type == TokenType::GreaterThan
|| type == TokenType::GreaterThanEquals
+ || type == TokenType::LessThan
|| type == TokenType::LessThanEquals
|| type == TokenType::ParenOpen
|| type == TokenType::Period;