diff options
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 30 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar.ron | 5 |
2 files changed, 35 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 9dd6bd3ea..b917f77fe 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -551,6 +551,36 @@ impl ConstDef { | |||
551 | } | 551 | } |
552 | } | 552 | } |
553 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 553 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
554 | pub struct ConstParam { | ||
555 | pub(crate) syntax: SyntaxNode, | ||
556 | } | ||
557 | impl AstNode for ConstParam { | ||
558 | fn can_cast(kind: SyntaxKind) -> bool { | ||
559 | match kind { | ||
560 | CONST_PARAM => true, | ||
561 | _ => false, | ||
562 | } | ||
563 | } | ||
564 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
565 | if Self::can_cast(syntax.kind()) { | ||
566 | Some(Self { syntax }) | ||
567 | } else { | ||
568 | None | ||
569 | } | ||
570 | } | ||
571 | fn syntax(&self) -> &SyntaxNode { | ||
572 | &self.syntax | ||
573 | } | ||
574 | } | ||
575 | impl ast::NameOwner for ConstParam {} | ||
576 | impl ast::AttrsOwner for ConstParam {} | ||
577 | impl ast::TypeAscriptionOwner for ConstParam {} | ||
578 | impl ConstParam { | ||
579 | pub fn default_val(&self) -> Option<Expr> { | ||
580 | AstChildren::new(&self.syntax).next() | ||
581 | } | ||
582 | } | ||
583 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
554 | pub struct ContinueExpr { | 584 | pub struct ContinueExpr { |
555 | pub(crate) syntax: SyntaxNode, | 585 | pub(crate) syntax: SyntaxNode, |
556 | } | 586 | } |
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index 9ffa9095b..d6802b6fb 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron | |||
@@ -243,6 +243,7 @@ Grammar( | |||
243 | "TYPE_PARAM_LIST", | 243 | "TYPE_PARAM_LIST", |
244 | "LIFETIME_PARAM", | 244 | "LIFETIME_PARAM", |
245 | "TYPE_PARAM", | 245 | "TYPE_PARAM", |
246 | "CONST_PARAM", | ||
246 | "TYPE_ARG_LIST", | 247 | "TYPE_ARG_LIST", |
247 | "LIFETIME_ARG", | 248 | "LIFETIME_ARG", |
248 | "TYPE_ARG", | 249 | "TYPE_ARG", |
@@ -602,6 +603,10 @@ Grammar( | |||
602 | options: [("default_type", "TypeRef")], | 603 | options: [("default_type", "TypeRef")], |
603 | traits: ["NameOwner", "AttrsOwner", "TypeBoundsOwner"], | 604 | traits: ["NameOwner", "AttrsOwner", "TypeBoundsOwner"], |
604 | ), | 605 | ), |
606 | "ConstParam": ( | ||
607 | options: [("default_val", "Expr")], | ||
608 | traits: ["NameOwner", "AttrsOwner", "TypeAscriptionOwner"], | ||
609 | ), | ||
605 | "LifetimeParam": ( | 610 | "LifetimeParam": ( |
606 | traits: ["AttrsOwner"], | 611 | traits: ["AttrsOwner"], |
607 | ), | 612 | ), |