From 7581984601b35c113c4bcdf0f8b402b2635be0dc Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 11 Aug 2018 09:38:27 +0300 Subject: bump ron --- crates/libsyntax2/src/ast/generated.rs.tera | 11 +++++++++++ crates/libsyntax2/src/grammar.ron | 10 ++++++++-- crates/tools/Cargo.toml | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/crates/libsyntax2/src/ast/generated.rs.tera b/crates/libsyntax2/src/ast/generated.rs.tera index 242837801..afce068c8 100644 --- a/crates/libsyntax2/src/ast/generated.rs.tera +++ b/crates/libsyntax2/src/ast/generated.rs.tera @@ -19,4 +19,15 @@ impl AstNode for {{ Name }} { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } + +impl {{ Name }} { +{% for (method_name, kind) in node.opts %} +{% set ChildName = kind | camel %} + pub fn {{ method_name }}<'a>(&'a self) -> impl Iterator> + 'a { + self.syntax() + .children() + .filter_map({{ ChildKind }}::cast) + } +{% endfor %} +} {% endfor %} diff --git a/crates/libsyntax2/src/grammar.ron b/crates/libsyntax2/src/grammar.ron index bcc79843a..9ad2c2ec1 100644 --- a/crates/libsyntax2/src/grammar.ron +++ b/crates/libsyntax2/src/grammar.ron @@ -215,10 +215,16 @@ Grammar( ], ast: [ ( - kind: "FILE" + kind: "FILE", + collections: [ + ("functions", "FUNCTION") + ] ), ( - kind: "FUNCTION" + kind: "FUNCTION", + options: [ + ("name", "NAME") + ] ), ( kind: "NAME" diff --git a/crates/tools/Cargo.toml b/crates/tools/Cargo.toml index f9fee16f9..856f7d8cb 100644 --- a/crates/tools/Cargo.toml +++ b/crates/tools/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Aleksey Kladov "] publish = false [dependencies] -ron = "0.1.7" +ron = "0.3.0" walkdir = "2.1.3" itertools = "0.7.8" tera = "0.11" -- cgit v1.2.3