aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/libsyntax2/src/ast/generated.rs.tera11
-rw-r--r--crates/libsyntax2/src/grammar.ron10
-rw-r--r--crates/tools/Cargo.toml2
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<R: TreeRoot> AstNode<R> for {{ Name }}<R> {
19 } 19 }
20 fn syntax(&self) -> &SyntaxNode<R> { &self.syntax } 20 fn syntax(&self) -> &SyntaxNode<R> { &self.syntax }
21} 21}
22
23impl<R: TreeRoot> {{ Name }}<R> {
24{% for (method_name, kind) in node.opts %}
25{% set ChildName = kind | camel %}
26 pub fn {{ method_name }}<'a>(&'a self) -> impl Iterator<Item = {{ ChildKind }}<R>> + 'a {
27 self.syntax()
28 .children()
29 .filter_map({{ ChildKind }}::cast)
30 }
31{% endfor %}
32}
22{% endfor %} 33{% 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(
215 ], 215 ],
216 ast: [ 216 ast: [
217 ( 217 (
218 kind: "FILE" 218 kind: "FILE",
219 collections: [
220 ("functions", "FUNCTION")
221 ]
219 ), 222 ),
220 ( 223 (
221 kind: "FUNCTION" 224 kind: "FUNCTION",
225 options: [
226 ("name", "NAME")
227 ]
222 ), 228 ),
223 ( 229 (
224 kind: "NAME" 230 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 <[email protected]>"]
5publish = false 5publish = false
6 6
7[dependencies] 7[dependencies]
8ron = "0.1.7" 8ron = "0.3.0"
9walkdir = "2.1.3" 9walkdir = "2.1.3"
10itertools = "0.7.8" 10itertools = "0.7.8"
11tera = "0.11" 11tera = "0.11"