MCPcopy Create free account
hub / github.com/AlenVelocity/MeowScript / parse_infix_expr

Method parse_infix_expr

src/parser.rs:383–410  ·  view source on GitHub ↗
(&mut self, left: Expr)

Source from the content-addressed store, hash-verified

381 }
382
383 fn parse_infix_expr(&mut self, left: Expr) -> Option<Expr> {
384 let infix = match self.current_token {
385 Token::Plus => Infix::Plus,
386 Token::Minus => Infix::Minus,
387 Token::Slash => Infix::Divide,
388 Token::Asterisk => Infix::Times,
389 Token::Percent => Infix::Modulo,
390 Token::Equals => Infix::Equals,
391 Token::NotEquals => Infix::NotEquals,
392 Token::Less => Infix::LessThan,
393 Token::Greater => Infix::GreaterThan,
394 Token::LessEqual => Infix::LessThanEqual,
395 Token::GreaterEqual => Infix::GreaterThanEqual,
396 Token::LeftShift => Infix::LeftShift,
397 Token::RightShift => Infix::RightShift,
398 Token::AND => Infix::AND,
399 Token::OR => Infix::OR,
400 Token::XOR => Infix::XOR,
401 Token::In => Infix::In,
402 _ => return None,
403 };
404
405 let precedence = self.current_token_precedence();
406 self.next_token();
407
408 self.parse_expr(precedence)
409 .map(|e| Expr::Infix(infix, Box::new(left), Box::new(e)))
410 }
411
412 fn parse_grouped_expr(&mut self) -> Option<Expr> {
413 let exp = self.parse_expr(Precedence::Lowest);

Callers 1

parse_exprMethod · 0.80

Calls 4

InfixEnum · 0.85
parse_exprMethod · 0.80
next_tokenMethod · 0.45

Tested by

no test coverage detected