aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-04-10 09:35:39 +0100
committerAleksey Kladov <[email protected]>2020-04-10 15:10:28 +0100
commit779f06ed77e868b9409a1724f736a045415d4922 (patch)
tree07bc6a57f62adce315ca5779329b66990c4f9a16 /crates
parent548f562ddad3bca515b304f82e110aeb319591e3 (diff)
Convert more tokens
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_assists/src/handlers/add_explicit_type.rs4
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs28
-rw-r--r--crates/ra_syntax/src/ast/generated/tokens.rs202
3 files changed, 15 insertions, 219 deletions
diff --git a/crates/ra_assists/src/handlers/add_explicit_type.rs b/crates/ra_assists/src/handlers/add_explicit_type.rs
index e7dcfb44e..d86d804b2 100644
--- a/crates/ra_assists/src/handlers/add_explicit_type.rs
+++ b/crates/ra_assists/src/handlers/add_explicit_type.rs
@@ -1,6 +1,6 @@
1use hir::HirDisplay; 1use hir::HirDisplay;
2use ra_syntax::{ 2use ra_syntax::{
3 ast::{self, AstNode, AstToken, LetStmt, NameOwner, TypeAscriptionOwner}, 3 ast::{self, AstNode, LetStmt, NameOwner, TypeAscriptionOwner},
4 TextRange, 4 TextRange,
5}; 5};
6 6
@@ -35,7 +35,7 @@ pub(crate) fn add_explicit_type(ctx: AssistCtx) -> Option<Assist> {
35 let name = pat.name()?; 35 let name = pat.name()?;
36 let name_range = name.syntax().text_range(); 36 let name_range = name.syntax().text_range();
37 let stmt_range = stmt.syntax().text_range(); 37 let stmt_range = stmt.syntax().text_range();
38 let eq_range = stmt.eq_token()?.syntax().text_range(); 38 let eq_range = stmt.eq_token()?.text_range();
39 // Assist should only be applicable if cursor is between 'let' and '=' 39 // Assist should only be applicable if cursor is between 'let' and '='
40 let let_range = TextRange::from_to(stmt_range.start(), eq_range.start()); 40 let let_range = TextRange::from_to(stmt_range.start(), eq_range.start());
41 let cursor_in_range = ctx.frange.range.is_subrange(&let_range); 41 let cursor_in_range = ctx.frange.range.is_subrange(&let_range);
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs
index 0ae5db9fc..106a91c12 100644
--- a/crates/ra_syntax/src/ast/generated/nodes.rs
+++ b/crates/ra_syntax/src/ast/generated/nodes.rs
@@ -276,7 +276,7 @@ impl ast::DocCommentsOwner for EnumVariant {}
276impl ast::AttrsOwner for EnumVariant {} 276impl ast::AttrsOwner for EnumVariant {}
277impl EnumVariant { 277impl EnumVariant {
278 pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) } 278 pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) }
279 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 279 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![=]) }
280 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 280 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
281} 281}
282#[derive(Debug, Clone, PartialEq, Eq, Hash)] 282#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -377,7 +377,7 @@ impl ConstDef {
377 support::token2(&self.syntax, T![default]) 377 support::token2(&self.syntax, T![default])
378 } 378 }
379 pub fn const_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![const]) } 379 pub fn const_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![const]) }
380 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 380 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![=]) }
381 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } 381 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
382 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![;]) } 382 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![;]) }
383} 383}
@@ -405,7 +405,7 @@ impl ast::TypeAscriptionOwner for StaticDef {}
405impl StaticDef { 405impl StaticDef {
406 pub fn static_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![static]) } 406 pub fn static_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![static]) }
407 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![mut]) } 407 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![mut]) }
408 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 408 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![=]) }
409 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } 409 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
410 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![;]) } 410 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![;]) }
411} 411}
@@ -435,7 +435,7 @@ impl TypeAliasDef {
435 support::token2(&self.syntax, T![default]) 435 support::token2(&self.syntax, T![default])
436 } 436 }
437 pub fn type_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![type]) } 437 pub fn type_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![type]) }
438 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 438 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![=]) }
439 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 439 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
440 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![;]) } 440 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![;]) }
441} 441}
@@ -1278,9 +1278,7 @@ impl AstNode for BinExpr {
1278 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1278 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1279} 1279}
1280impl ast::AttrsOwner for BinExpr {} 1280impl ast::AttrsOwner for BinExpr {}
1281impl BinExpr { 1281impl BinExpr {}
1282 pub fn bin_op_token(&self) -> Option<BinOp> { support::token(&self.syntax) }
1283}
1284#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1282#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1285pub struct Literal { 1283pub struct Literal {
1286 pub(crate) syntax: SyntaxNode, 1284 pub(crate) syntax: SyntaxNode,
@@ -1881,7 +1879,7 @@ impl Attr {
1881 pub fn excl_token(&self) -> Option<Excl> { support::token(&self.syntax) } 1879 pub fn excl_token(&self) -> Option<Excl> { support::token(&self.syntax) }
1882 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T!['[']) } 1880 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T!['[']) }
1883 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 1881 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1884 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 1882 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![=]) }
1885 pub fn input(&self) -> Option<AttrInput> { support::child(&self.syntax) } 1883 pub fn input(&self) -> Option<AttrInput> { support::child(&self.syntax) }
1886 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![']']) } 1884 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![']']) }
1887} 1885}
@@ -1943,7 +1941,7 @@ impl ast::NameOwner for TypeParam {}
1943impl ast::AttrsOwner for TypeParam {} 1941impl ast::AttrsOwner for TypeParam {}
1944impl ast::TypeBoundsOwner for TypeParam {} 1942impl ast::TypeBoundsOwner for TypeParam {}
1945impl TypeParam { 1943impl TypeParam {
1946 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 1944 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![=]) }
1947 pub fn default_type(&self) -> Option<TypeRef> { support::child(&self.syntax) } 1945 pub fn default_type(&self) -> Option<TypeRef> { support::child(&self.syntax) }
1948} 1946}
1949#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1947#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -1965,7 +1963,7 @@ impl ast::NameOwner for ConstParam {}
1965impl ast::AttrsOwner for ConstParam {} 1963impl ast::AttrsOwner for ConstParam {}
1966impl ast::TypeAscriptionOwner for ConstParam {} 1964impl ast::TypeAscriptionOwner for ConstParam {}
1967impl ConstParam { 1965impl ConstParam {
1968 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 1966 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![=]) }
1969 pub fn default_val(&self) -> Option<Expr> { support::child(&self.syntax) } 1967 pub fn default_val(&self) -> Option<Expr> { support::child(&self.syntax) }
1970} 1968}
1971#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1969#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -2122,7 +2120,7 @@ impl ast::TypeAscriptionOwner for LetStmt {}
2122impl LetStmt { 2120impl LetStmt {
2123 pub fn let_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![let]) } 2121 pub fn let_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![let]) }
2124 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 2122 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
2125 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 2123 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![=]) }
2126 pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) } 2124 pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) }
2127 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![;]) } 2125 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![;]) }
2128} 2126}
@@ -2144,7 +2142,7 @@ impl AstNode for Condition {
2144impl Condition { 2142impl Condition {
2145 pub fn let_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![let]) } 2143 pub fn let_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![let]) }
2146 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 2144 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
2147 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 2145 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![=]) }
2148 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 2146 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
2149} 2147}
2150#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2148#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -2463,7 +2461,7 @@ impl AstNode for AssocTypeArg {
2463impl ast::TypeBoundsOwner for AssocTypeArg {} 2461impl ast::TypeBoundsOwner for AssocTypeArg {}
2464impl AssocTypeArg { 2462impl AssocTypeArg {
2465 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } 2463 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
2466 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 2464 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![=]) }
2467 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 2465 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
2468} 2466}
2469#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2467#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -2501,7 +2499,7 @@ impl AstNode for ConstArg {
2501} 2499}
2502impl ConstArg { 2500impl ConstArg {
2503 pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) } 2501 pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) }
2504 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 2502 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![=]) }
2505 pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) } 2503 pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) }
2506} 2504}
2507#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2505#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -2597,7 +2595,7 @@ impl AstNode for MetaItem {
2597} 2595}
2598impl MetaItem { 2596impl MetaItem {
2599 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 2597 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
2600 pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } 2598 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, T![=]) }
2601 pub fn attr_input(&self) -> Option<AttrInput> { support::child(&self.syntax) } 2599 pub fn attr_input(&self) -> Option<AttrInput> { support::child(&self.syntax) }
2602 pub fn nested_meta_items(&self) -> AstChildren<MetaItem> { support::children(&self.syntax) } 2600 pub fn nested_meta_items(&self) -> AstChildren<MetaItem> { support::children(&self.syntax) }
2603} 2601}
diff --git a/crates/ra_syntax/src/ast/generated/tokens.rs b/crates/ra_syntax/src/ast/generated/tokens.rs
index 4cbc1d793..7611ce4cb 100644
--- a/crates/ra_syntax/src/ast/generated/tokens.rs
+++ b/crates/ra_syntax/src/ast/generated/tokens.rs
@@ -1410,208 +1410,6 @@ impl AstToken for RangeSeparator {
1410 } 1410 }
1411} 1411}
1412#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1412#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1413pub enum BinOp {
1414 Pipepipe(Pipepipe),
1415 Ampamp(Ampamp),
1416 Eqeq(Eqeq),
1417 Neq(Neq),
1418 Lteq(Lteq),
1419 Gteq(Gteq),
1420 LAngle(LAngle),
1421 RAngle(RAngle),
1422 Plus(Plus),
1423 Star(Star),
1424 Minus(Minus),
1425 Slash(Slash),
1426 Percent(Percent),
1427 Shl(Shl),
1428 Shr(Shr),
1429 Caret(Caret),
1430 Pipe(Pipe),
1431 Amp(Amp),
1432 Eq(Eq),
1433 Pluseq(Pluseq),
1434 Slasheq(Slasheq),
1435 Stareq(Stareq),
1436 Percenteq(Percenteq),
1437 Shreq(Shreq),
1438 Shleq(Shleq),
1439 Minuseq(Minuseq),
1440 Pipeeq(Pipeeq),
1441 Ampeq(Ampeq),
1442 Careteq(Careteq),
1443}
1444impl From<Pipepipe> for BinOp {
1445 fn from(node: Pipepipe) -> BinOp { BinOp::Pipepipe(node) }
1446}
1447impl From<Ampamp> for BinOp {
1448 fn from(node: Ampamp) -> BinOp { BinOp::Ampamp(node) }
1449}
1450impl From<Eqeq> for BinOp {
1451 fn from(node: Eqeq) -> BinOp { BinOp::Eqeq(node) }
1452}
1453impl From<Neq> for BinOp {
1454 fn from(node: Neq) -> BinOp { BinOp::Neq(node) }
1455}
1456impl From<Lteq> for BinOp {
1457 fn from(node: Lteq) -> BinOp { BinOp::Lteq(node) }
1458}
1459impl From<Gteq> for BinOp {
1460 fn from(node: Gteq) -> BinOp { BinOp::Gteq(node) }
1461}
1462impl From<LAngle> for BinOp {
1463 fn from(node: LAngle) -> BinOp { BinOp::LAngle(node) }
1464}
1465impl From<RAngle> for BinOp {
1466 fn from(node: RAngle) -> BinOp { BinOp::RAngle(node) }
1467}
1468impl From<Plus> for BinOp {
1469 fn from(node: Plus) -> BinOp { BinOp::Plus(node) }
1470}
1471impl From<Star> for BinOp {
1472 fn from(node: Star) -> BinOp { BinOp::Star(node) }
1473}
1474impl From<Minus> for BinOp {
1475 fn from(node: Minus) -> BinOp { BinOp::Minus(node) }
1476}
1477impl From<Slash> for BinOp {
1478 fn from(node: Slash) -> BinOp { BinOp::Slash(node) }
1479}
1480impl From<Percent> for BinOp {
1481 fn from(node: Percent) -> BinOp { BinOp::Percent(node) }
1482}
1483impl From<Shl> for BinOp {
1484 fn from(node: Shl) -> BinOp { BinOp::Shl(node) }
1485}
1486impl From<Shr> for BinOp {
1487 fn from(node: Shr) -> BinOp { BinOp::Shr(node) }
1488}
1489impl From<Caret> for BinOp {
1490 fn from(node: Caret) -> BinOp { BinOp::Caret(node) }
1491}
1492impl From<Pipe> for BinOp {
1493 fn from(node: Pipe) -> BinOp { BinOp::Pipe(node) }
1494}
1495impl From<Amp> for BinOp {
1496 fn from(node: Amp) -> BinOp { BinOp::Amp(node) }
1497}
1498impl From<Eq> for BinOp {
1499 fn from(node: Eq) -> BinOp { BinOp::Eq(node) }
1500}
1501impl From<Pluseq> for BinOp {
1502 fn from(node: Pluseq) -> BinOp { BinOp::Pluseq(node) }
1503}
1504impl From<Slasheq> for BinOp {
1505 fn from(node: Slasheq) -> BinOp { BinOp::Slasheq(node) }
1506}
1507impl From<Stareq> for BinOp {
1508 fn from(node: Stareq) -> BinOp { BinOp::Stareq(node) }
1509}
1510impl From<Percenteq> for BinOp {
1511 fn from(node: Percenteq) -> BinOp { BinOp::Percenteq(node) }
1512}
1513impl From<Shreq> for BinOp {
1514 fn from(node: Shreq) -> BinOp { BinOp::Shreq(node) }
1515}
1516impl From<Shleq> for BinOp {
1517 fn from(node: Shleq) -> BinOp { BinOp::Shleq(node) }
1518}
1519impl From<Minuseq> for BinOp {
1520 fn from(node: Minuseq) -> BinOp { BinOp::Minuseq(node) }
1521}
1522impl From<Pipeeq> for BinOp {
1523 fn from(node: Pipeeq) -> BinOp { BinOp::Pipeeq(node) }
1524}
1525impl From<Ampeq> for BinOp {
1526 fn from(node: Ampeq) -> BinOp { BinOp::Ampeq(node) }
1527}
1528impl From<Careteq> for BinOp {
1529 fn from(node: Careteq) -> BinOp { BinOp::Careteq(node) }
1530}
1531impl std::fmt::Display for BinOp {
1532 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1533 std::fmt::Display::fmt(self.syntax(), f)
1534 }
1535}
1536impl AstToken for BinOp {
1537 fn can_cast(kind: SyntaxKind) -> bool {
1538 match kind {
1539 PIPEPIPE | AMPAMP | EQEQ | NEQ | LTEQ | GTEQ | L_ANGLE | R_ANGLE | PLUS | STAR
1540 | MINUS | SLASH | PERCENT | SHL | SHR | CARET | PIPE | AMP | EQ | PLUSEQ | SLASHEQ
1541 | STAREQ | PERCENTEQ | SHREQ | SHLEQ | MINUSEQ | PIPEEQ | AMPEQ | CARETEQ => true,
1542 _ => false,
1543 }
1544 }
1545 fn cast(syntax: SyntaxToken) -> Option<Self> {
1546 let res = match syntax.kind() {
1547 PIPEPIPE => BinOp::Pipepipe(Pipepipe { syntax }),
1548 AMPAMP => BinOp::Ampamp(Ampamp { syntax }),
1549 EQEQ => BinOp::Eqeq(Eqeq { syntax }),
1550 NEQ => BinOp::Neq(Neq { syntax }),
1551 LTEQ => BinOp::Lteq(Lteq { syntax }),
1552 GTEQ => BinOp::Gteq(Gteq { syntax }),
1553 L_ANGLE => BinOp::LAngle(LAngle { syntax }),
1554 R_ANGLE => BinOp::RAngle(RAngle { syntax }),
1555 PLUS => BinOp::Plus(Plus { syntax }),
1556 STAR => BinOp::Star(Star { syntax }),
1557 MINUS => BinOp::Minus(Minus { syntax }),
1558 SLASH => BinOp::Slash(Slash { syntax }),
1559 PERCENT => BinOp::Percent(Percent { syntax }),
1560 SHL => BinOp::Shl(Shl { syntax }),
1561 SHR => BinOp::Shr(Shr { syntax }),
1562 CARET => BinOp::Caret(Caret { syntax }),
1563 PIPE => BinOp::Pipe(Pipe { syntax }),
1564 AMP => BinOp::Amp(Amp { syntax }),
1565 EQ => BinOp::Eq(Eq { syntax }),
1566 PLUSEQ => BinOp::Pluseq(Pluseq { syntax }),
1567 SLASHEQ => BinOp::Slasheq(Slasheq { syntax }),
1568 STAREQ => BinOp::Stareq(Stareq { syntax }),
1569 PERCENTEQ => BinOp::Percenteq(Percenteq { syntax }),
1570 SHREQ => BinOp::Shreq(Shreq { syntax }),
1571 SHLEQ => BinOp::Shleq(Shleq { syntax }),
1572 MINUSEQ => BinOp::Minuseq(Minuseq { syntax }),
1573 PIPEEQ => BinOp::Pipeeq(Pipeeq { syntax }),
1574 AMPEQ => BinOp::Ampeq(Ampeq { syntax }),
1575 CARETEQ => BinOp::Careteq(Careteq { syntax }),
1576 _ => return None,
1577 };
1578 Some(res)
1579 }
1580 fn syntax(&self) -> &SyntaxToken {
1581 match self {
1582 BinOp::Pipepipe(it) => &it.syntax,
1583 BinOp::Ampamp(it) => &it.syntax,
1584 BinOp::Eqeq(it) => &it.syntax,
1585 BinOp::Neq(it) => &it.syntax,
1586 BinOp::Lteq(it) => &it.syntax,
1587 BinOp::Gteq(it) => &it.syntax,
1588 BinOp::LAngle(it) => &it.syntax,
1589 BinOp::RAngle(it) => &it.syntax,
1590 BinOp::Plus(it) => &it.syntax,
1591 BinOp::Star(it) => &it.syntax,
1592 BinOp::Minus(it) => &it.syntax,
1593 BinOp::Slash(it) => &it.syntax,
1594 BinOp::Percent(it) => &it.syntax,
1595 BinOp::Shl(it) => &it.syntax,
1596 BinOp::Shr(it) => &it.syntax,
1597 BinOp::Caret(it) => &it.syntax,
1598 BinOp::Pipe(it) => &it.syntax,
1599 BinOp::Amp(it) => &it.syntax,
1600 BinOp::Eq(it) => &it.syntax,
1601 BinOp::Pluseq(it) => &it.syntax,
1602 BinOp::Slasheq(it) => &it.syntax,
1603 BinOp::Stareq(it) => &it.syntax,
1604 BinOp::Percenteq(it) => &it.syntax,
1605 BinOp::Shreq(it) => &it.syntax,
1606 BinOp::Shleq(it) => &it.syntax,
1607 BinOp::Minuseq(it) => &it.syntax,
1608 BinOp::Pipeeq(it) => &it.syntax,
1609 BinOp::Ampeq(it) => &it.syntax,
1610 BinOp::Careteq(it) => &it.syntax,
1611 }
1612 }
1613}
1614#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1615pub enum PrefixOp { 1413pub enum PrefixOp {
1616 Minus(Minus), 1414 Minus(Minus),
1617 Excl(Excl), 1415 Excl(Excl),