diff options
Diffstat (limited to 'crates/ra_syntax/src/ast.rs')
-rw-r--r-- | crates/ra_syntax/src/ast.rs | 70 |
1 files changed, 69 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index 9df8ec663..d8e187514 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs | |||
@@ -504,7 +504,52 @@ pub enum BinOp { | |||
504 | LesserTest, | 504 | LesserTest, |
505 | /// The `>` operator for comparison | 505 | /// The `>` operator for comparison |
506 | GreaterTest, | 506 | GreaterTest, |
507 | // TODO: lots of others | 507 | /// The `+` operator for addition |
508 | Addition, | ||
509 | /// The `*` operator for multiplication | ||
510 | Multiplication, | ||
511 | /// The `-` operator for subtraction | ||
512 | Subtraction, | ||
513 | /// The `/` operator for division | ||
514 | Division, | ||
515 | /// The `%` operator for remainder after division | ||
516 | Remainder, | ||
517 | /// The `<<` operator for left shift | ||
518 | LeftShift, | ||
519 | /// The `>>` operator for right shift | ||
520 | RightShift, | ||
521 | /// The `^` operator for bitwise XOR | ||
522 | BitwiseXor, | ||
523 | /// The `|` operator for bitwise OR | ||
524 | BitwiseOr, | ||
525 | /// The `&` operator for bitwise AND | ||
526 | BitwiseAnd, | ||
527 | /// The `..` operator for right-open ranges | ||
528 | RangeRightOpen, | ||
529 | /// The `..=` operator for right-closed ranges | ||
530 | RangeRightClosed, | ||
531 | /// The `=` operator for assignment | ||
532 | Assignment, | ||
533 | /// The `+=` operator for assignment after additon | ||
534 | AddAssign, | ||
535 | /// The `/=` operator for assignment after division | ||
536 | DivAssign, | ||
537 | /// The `*=` operator for assignment after multiplication | ||
538 | MulAssign, | ||
539 | /// The `%=` operator for assignment after remainders | ||
540 | RemAssign, | ||
541 | /// The `>>=` operator for assignment after shifting right | ||
542 | ShrAssign, | ||
543 | /// The `<<=` operator for assignment after shifting left | ||
544 | ShlAssign, | ||
545 | /// The `-=` operator for assignment after subtraction | ||
546 | SubAssign, | ||
547 | /// The `|=` operator for assignment after bitwise OR | ||
548 | BitOrAssign, | ||
549 | /// The `&=` operator for assignment after bitwise AND | ||
550 | BitAndAssign, | ||
551 | /// The `^=` operator for assignment after bitwise XOR | ||
552 | BitXorAssin, | ||
508 | } | 553 | } |
509 | 554 | ||
510 | impl<'a> BinExpr<'a> { | 555 | impl<'a> BinExpr<'a> { |
@@ -519,6 +564,29 @@ impl<'a> BinExpr<'a> { | |||
519 | GTEQ => Some(BinOp::GreaterEqualTest), | 564 | GTEQ => Some(BinOp::GreaterEqualTest), |
520 | L_ANGLE => Some(BinOp::LesserTest), | 565 | L_ANGLE => Some(BinOp::LesserTest), |
521 | R_ANGLE => Some(BinOp::GreaterTest), | 566 | R_ANGLE => Some(BinOp::GreaterTest), |
567 | PLUS => Some(BinOp::Addition), | ||
568 | STAR => Some(BinOp::Multiplication), | ||
569 | MINUS => Some(BinOp::Subtraction), | ||
570 | SLASH => Some(BinOp::Division), | ||
571 | PERCENT => Some(BinOp::Remainder), | ||
572 | SHL => Some(BinOp::LeftShift), | ||
573 | SHR => Some(BinOp::RightShift), | ||
574 | CARET => Some(BinOp::BitwiseXor), | ||
575 | PIPE => Some(BinOp::BitwiseOr), | ||
576 | AMP => Some(BinOp::BitwiseAnd), | ||
577 | DOTDOT => Some(BinOp::RangeRightOpen), | ||
578 | DOTDOTEQ => Some(BinOp::RangeRightClosed), | ||
579 | EQ => Some(BinOp::Assignment), | ||
580 | PLUSEQ => Some(BinOp::AddAssign), | ||
581 | SLASHEQ => Some(BinOp::DivAssign), | ||
582 | STAREQ => Some(BinOp::MulAssign), | ||
583 | PERCENTEQ => Some(BinOp::RemAssign), | ||
584 | SHREQ => Some(BinOp::ShrAssign), | ||
585 | SHLEQ => Some(BinOp::ShlAssign), | ||
586 | MINUSEQ => Some(BinOp::SubAssign), | ||
587 | PIPEEQ => Some(BinOp::BitOrAssign), | ||
588 | AMPEQ => Some(BinOp::BitAndAssign), | ||
589 | CARETEQ => Some(BinOp::BitXorAssin), | ||
522 | _ => None, | 590 | _ => None, |
523 | }) | 591 | }) |
524 | .next() | 592 | .next() |