From 2d73c909fe03c799b488aa0f97a588e13bbd7006 Mon Sep 17 00:00:00 2001 From: Lenard Pratt Date: Wed, 3 Apr 2019 23:23:58 +0100 Subject: Added inference of array length --- crates/ra_syntax/src/ast/generated.rs | 4 ++++ crates/ra_syntax/src/grammar.ron | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'crates/ra_syntax/src') diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 0376c91c8..39b760551 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs @@ -108,6 +108,10 @@ impl ArrayExpr { pub fn exprs(&self) -> impl Iterator { super::children(self) } + + pub fn repeat(&self) -> Option<&Expr> { + super::child_opt(self) + } } // ArrayType diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index 0a35e25d5..c7116c69b 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron @@ -395,7 +395,8 @@ Grammar( collections: [["exprs", "Expr"]] ), "ArrayExpr": ( - collections: [["exprs", "Expr"]] + collections: [["exprs", "Expr"]], + options:[["repeat","Expr"]] ), "ParenExpr": (options: ["Expr"]), "PathExpr": (options: ["Path"]), -- cgit v1.2.3