aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/ast.rs70
-rw-r--r--crates/ra_syntax/src/grammar.ron1
-rw-r--r--crates/ra_syntax/src/syntax_kinds/generated.rs2
3 files changed, 72 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
510impl<'a> BinExpr<'a> { 555impl<'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()
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron
index 3c640ed47..d7505ea06 100644
--- a/crates/ra_syntax/src/grammar.ron
+++ b/crates/ra_syntax/src/grammar.ron
@@ -49,6 +49,7 @@ Grammar(
49 ["^=", "CARETEQ"], 49 ["^=", "CARETEQ"],
50 ["/=", "SLASHEQ"], 50 ["/=", "SLASHEQ"],
51 ["*=", "STAREQ"], 51 ["*=", "STAREQ"],
52 ["%=", "PERCENTEQ"],
52 ["&&", "AMPAMP"], 53 ["&&", "AMPAMP"],
53 ["||", "PIPEPIPE"], 54 ["||", "PIPEPIPE"],
54 ["<<", "SHL"], 55 ["<<", "SHL"],
diff --git a/crates/ra_syntax/src/syntax_kinds/generated.rs b/crates/ra_syntax/src/syntax_kinds/generated.rs
index ef4588d93..830fac9f4 100644
--- a/crates/ra_syntax/src/syntax_kinds/generated.rs
+++ b/crates/ra_syntax/src/syntax_kinds/generated.rs
@@ -58,6 +58,7 @@ pub enum SyntaxKind {
58 CARETEQ, 58 CARETEQ,
59 SLASHEQ, 59 SLASHEQ,
60 STAREQ, 60 STAREQ,
61 PERCENTEQ,
61 AMPAMP, 62 AMPAMP,
62 PIPEPIPE, 63 PIPEPIPE,
63 SHL, 64 SHL,
@@ -319,6 +320,7 @@ impl SyntaxKind {
319 CARETEQ => &SyntaxInfo { name: "CARETEQ" }, 320 CARETEQ => &SyntaxInfo { name: "CARETEQ" },
320 SLASHEQ => &SyntaxInfo { name: "SLASHEQ" }, 321 SLASHEQ => &SyntaxInfo { name: "SLASHEQ" },
321 STAREQ => &SyntaxInfo { name: "STAREQ" }, 322 STAREQ => &SyntaxInfo { name: "STAREQ" },
323 PERCENTEQ => &SyntaxInfo { name: "PERCENTEQ" },
322 AMPAMP => &SyntaxInfo { name: "AMPAMP" }, 324 AMPAMP => &SyntaxInfo { name: "AMPAMP" },
323 PIPEPIPE => &SyntaxInfo { name: "PIPEPIPE" }, 325 PIPEPIPE => &SyntaxInfo { name: "PIPEPIPE" },
324 SHL => &SyntaxInfo { name: "SHL" }, 326 SHL => &SyntaxInfo { name: "SHL" },