From 8ddbf06e39a13ed3f45e57d77727b7a35cec1749 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 17:24:07 +0200 Subject: Finalize structs grammar --- crates/ra_syntax/src/ast/generated/nodes.rs | 1 - xtask/src/codegen/rust.ungram | 7 +++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 46d73215c..1776fb6e6 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs @@ -422,7 +422,6 @@ pub struct TupleField { pub(crate) syntax: SyntaxNode, } impl ast::AttrsOwner for TupleField {} -impl ast::NameOwner for TupleField {} impl ast::VisibilityOwner for TupleField {} impl TupleField { pub fn type_ref(&self) -> Option { support::child(&self.syntax) } diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index ba922af0d..28b50f021 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram @@ -83,22 +83,21 @@ StructDef = ) RecordFieldList = - '{' fields:RecordField* '}' + '{' fields:(RecordField (',' RecordField)* ','?)? '}' RecordField = Attr* Visibility? Name ':' ascribed_type:TypeRef TupleFieldList = - '(' fields:TupleField* ')' + '(' fields:(TupleField (',' TupleField)* ','?)? ')' TupleField = - Attr* Visibility? Name TypeRef + Attr* Visibility? TypeRef FieldList = RecordFieldList | TupleFieldList - UnionDef = Attr* Visibility? 'union' Name GenericParamList? WhereClause? RecordFieldList -- cgit v1.2.3