diff options
author | Aleksey Kladov <[email protected]> | 2018-08-11 07:38:27 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-11 07:38:27 +0100 |
commit | 7581984601b35c113c4bcdf0f8b402b2635be0dc (patch) | |
tree | 08d21e6af90e57fd739c4f24dc221e0466375a1d /crates/libsyntax2 | |
parent | 35b59bb43877c496fbaf98520b3b52ff9a6518b1 (diff) |
bump ron
Diffstat (limited to 'crates/libsyntax2')
-rw-r--r-- | crates/libsyntax2/src/ast/generated.rs.tera | 11 | ||||
-rw-r--r-- | crates/libsyntax2/src/grammar.ron | 10 |
2 files changed, 19 insertions, 2 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 | |||
23 | impl<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" |