aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-13 16:36:16 +0100
committerAleksey Kladov <[email protected]>2018-08-13 16:36:16 +0100
commitc146331b1c92c3a6d58217b61f95e69155a3a4f8 (patch)
treeeb8c37068ed82ac04abde7bc021a6e44fd53b1a2 /crates/libsyntax2
parent1d95f34e9a1b2b7cebf44e38238b50a693d3394b (diff)
rename
Diffstat (limited to 'crates/libsyntax2')
-rw-r--r--crates/libsyntax2/src/ast/generated.rs88
-rw-r--r--crates/libsyntax2/src/ast/mod.rs2
-rw-r--r--crates/libsyntax2/src/grammar.ron16
3 files changed, 53 insertions, 53 deletions
diff --git a/crates/libsyntax2/src/ast/generated.rs b/crates/libsyntax2/src/ast/generated.rs
index a557e6d73..b347a05b4 100644
--- a/crates/libsyntax2/src/ast/generated.rs
+++ b/crates/libsyntax2/src/ast/generated.rs
@@ -5,43 +5,43 @@ use {
5 SyntaxKind::*, 5 SyntaxKind::*,
6}; 6};
7 7
8// ConstItem 8// ConstDef
9#[derive(Debug, Clone, Copy)] 9#[derive(Debug, Clone, Copy)]
10pub struct ConstItem<R: TreeRoot = Arc<SyntaxRoot>> { 10pub struct ConstDef<R: TreeRoot = Arc<SyntaxRoot>> {
11 syntax: SyntaxNode<R>, 11 syntax: SyntaxNode<R>,
12} 12}
13 13
14impl<R: TreeRoot> AstNode<R> for ConstItem<R> { 14impl<R: TreeRoot> AstNode<R> for ConstDef<R> {
15 fn cast(syntax: SyntaxNode<R>) -> Option<Self> { 15 fn cast(syntax: SyntaxNode<R>) -> Option<Self> {
16 match syntax.kind() { 16 match syntax.kind() {
17 CONST_DEF => Some(ConstItem { syntax }), 17 CONST_DEF => Some(ConstDef { syntax }),
18 _ => None, 18 _ => None,
19 } 19 }
20 } 20 }
21 fn syntax(&self) -> &SyntaxNode<R> { &self.syntax } 21 fn syntax(&self) -> &SyntaxNode<R> { &self.syntax }
22} 22}
23 23
24impl<R: TreeRoot> ast::NameOwner<R> for ConstItem<R> {} 24impl<R: TreeRoot> ast::NameOwner<R> for ConstDef<R> {}
25impl<R: TreeRoot> ConstItem<R> {} 25impl<R: TreeRoot> ConstDef<R> {}
26 26
27// Enum 27// EnumDef
28#[derive(Debug, Clone, Copy)] 28#[derive(Debug, Clone, Copy)]
29pub struct Enum<R: TreeRoot = Arc<SyntaxRoot>> { 29pub struct EnumDef<R: TreeRoot = Arc<SyntaxRoot>> {
30 syntax: SyntaxNode<R>, 30 syntax: SyntaxNode<R>,
31} 31}
32 32
33impl<R: TreeRoot> AstNode<R> for Enum<R> { 33impl<R: TreeRoot> AstNode<R> for EnumDef<R> {
34 fn cast(syntax: SyntaxNode<R>) -> Option<Self> { 34 fn cast(syntax: SyntaxNode<R>) -> Option<Self> {
35 match syntax.kind() { 35 match syntax.kind() {
36 ENUM_DEF => Some(Enum { syntax }), 36 ENUM_DEF => Some(EnumDef { syntax }),
37 _ => None, 37 _ => None,
38 } 38 }
39 } 39 }
40 fn syntax(&self) -> &SyntaxNode<R> { &self.syntax } 40 fn syntax(&self) -> &SyntaxNode<R> { &self.syntax }
41} 41}
42 42
43impl<R: TreeRoot> ast::NameOwner<R> for Enum<R> {} 43impl<R: TreeRoot> ast::NameOwner<R> for EnumDef<R> {}
44impl<R: TreeRoot> Enum<R> {} 44impl<R: TreeRoot> EnumDef<R> {}
45 45
46// File 46// File
47#[derive(Debug, Clone, Copy)] 47#[derive(Debug, Clone, Copy)]
@@ -60,31 +60,31 @@ impl<R: TreeRoot> AstNode<R> for File<R> {
60} 60}
61 61
62impl<R: TreeRoot> File<R> { 62impl<R: TreeRoot> File<R> {
63 pub fn functions<'a>(&'a self) -> impl Iterator<Item = Function<R>> + 'a { 63 pub fn functions<'a>(&'a self) -> impl Iterator<Item = FnDef<R>> + 'a {
64 self.syntax() 64 self.syntax()
65 .children() 65 .children()
66 .filter_map(Function::cast) 66 .filter_map(FnDef::cast)
67 } 67 }
68} 68}
69 69
70// Function 70// FnDef
71#[derive(Debug, Clone, Copy)] 71#[derive(Debug, Clone, Copy)]
72pub struct Function<R: TreeRoot = Arc<SyntaxRoot>> { 72pub struct FnDef<R: TreeRoot = Arc<SyntaxRoot>> {
73 syntax: SyntaxNode<R>, 73 syntax: SyntaxNode<R>,
74} 74}
75 75
76impl<R: TreeRoot> AstNode<R> for Function<R> { 76impl<R: TreeRoot> AstNode<R> for FnDef<R> {
77 fn cast(syntax: SyntaxNode<R>) -> Option<Self> { 77 fn cast(syntax: SyntaxNode<R>) -> Option<Self> {
78 match syntax.kind() { 78 match syntax.kind() {
79 FN_DEF => Some(Function { syntax }), 79 FN_DEF => Some(FnDef { syntax }),
80 _ => None, 80 _ => None,
81 } 81 }
82 } 82 }
83 fn syntax(&self) -> &SyntaxNode<R> { &self.syntax } 83 fn syntax(&self) -> &SyntaxNode<R> { &self.syntax }
84} 84}
85 85
86impl<R: TreeRoot> ast::NameOwner<R> for Function<R> {} 86impl<R: TreeRoot> ast::NameOwner<R> for FnDef<R> {}
87impl<R: TreeRoot> Function<R> {} 87impl<R: TreeRoot> FnDef<R> {}
88 88
89// Module 89// Module
90#[derive(Debug, Clone, Copy)] 90#[derive(Debug, Clone, Copy)]
@@ -141,79 +141,79 @@ impl<R: TreeRoot> AstNode<R> for NameRef<R> {
141 141
142impl<R: TreeRoot> NameRef<R> {} 142impl<R: TreeRoot> NameRef<R> {}
143 143
144// StaticItem 144// StaticDef
145#[derive(Debug, Clone, Copy)] 145#[derive(Debug, Clone, Copy)]
146pub struct StaticItem<R: TreeRoot = Arc<SyntaxRoot>> { 146pub struct StaticDef<R: TreeRoot = Arc<SyntaxRoot>> {
147 syntax: SyntaxNode<R>, 147 syntax: SyntaxNode<R>,
148} 148}
149 149
150impl<R: TreeRoot> AstNode<R> for StaticItem<R> { 150impl<R: TreeRoot> AstNode<R> for StaticDef<R> {
151 fn cast(syntax: SyntaxNode<R>) -> Option<Self> { 151 fn cast(syntax: SyntaxNode<R>) -> Option<Self> {
152 match syntax.kind() { 152 match syntax.kind() {
153 STATIC_DEF => Some(StaticItem { syntax }), 153 STATIC_DEF => Some(StaticDef { syntax }),
154 _ => None, 154 _ => None,
155 } 155 }
156 } 156 }
157 fn syntax(&self) -> &SyntaxNode<R> { &self.syntax } 157 fn syntax(&self) -> &SyntaxNode<R> { &self.syntax }
158} 158}
159 159
160impl<R: TreeRoot> ast::NameOwner<R> for StaticItem<R> {} 160impl<R: TreeRoot> ast::NameOwner<R> for StaticDef<R> {}
161impl<R: TreeRoot> StaticItem<R> {} 161impl<R: TreeRoot> StaticDef<R> {}
162 162
163// Struct 163// StructDef
164#[derive(Debug, Clone, Copy)] 164#[derive(Debug, Clone, Copy)]
165pub struct Struct<R: TreeRoot = Arc<SyntaxRoot>> { 165pub struct StructDef<R: TreeRoot = Arc<SyntaxRoot>> {
166 syntax: SyntaxNode<R>, 166 syntax: SyntaxNode<R>,
167} 167}
168 168
169impl<R: TreeRoot> AstNode<R> for Struct<R> { 169impl<R: TreeRoot> AstNode<R> for StructDef<R> {
170 fn cast(syntax: SyntaxNode<R>) -> Option<Self> { 170 fn cast(syntax: SyntaxNode<R>) -> Option<Self> {
171 match syntax.kind() { 171 match syntax.kind() {
172 STRUCT_DEF => Some(Struct { syntax }), 172 STRUCT_DEF => Some(StructDef { syntax }),
173 _ => None, 173 _ => None,
174 } 174 }
175 } 175 }
176 fn syntax(&self) -> &SyntaxNode<R> { &self.syntax } 176 fn syntax(&self) -> &SyntaxNode<R> { &self.syntax }
177} 177}
178 178
179impl<R: TreeRoot> ast::NameOwner<R> for Struct<R> {} 179impl<R: TreeRoot> ast::NameOwner<R> for StructDef<R> {}
180impl<R: TreeRoot> Struct<R> {} 180impl<R: TreeRoot> StructDef<R> {}
181 181
182// Trait 182// TraitDef
183#[derive(Debug, Clone, Copy)] 183#[derive(Debug, Clone, Copy)]
184pub struct Trait<R: TreeRoot = Arc<SyntaxRoot>> { 184pub struct TraitDef<R: TreeRoot = Arc<SyntaxRoot>> {
185 syntax: SyntaxNode<R>, 185 syntax: SyntaxNode<R>,
186} 186}
187 187
188impl<R: TreeRoot> AstNode<R> for Trait<R> { 188impl<R: TreeRoot> AstNode<R> for TraitDef<R> {
189 fn cast(syntax: SyntaxNode<R>) -> Option<Self> { 189 fn cast(syntax: SyntaxNode<R>) -> Option<Self> {
190 match syntax.kind() { 190 match syntax.kind() {
191 TRAIT_DEF => Some(Trait { syntax }), 191 TRAIT_DEF => Some(TraitDef { syntax }),
192 _ => None, 192 _ => None,
193 } 193 }
194 } 194 }
195 fn syntax(&self) -> &SyntaxNode<R> { &self.syntax } 195 fn syntax(&self) -> &SyntaxNode<R> { &self.syntax }
196} 196}
197 197
198impl<R: TreeRoot> ast::NameOwner<R> for Trait<R> {} 198impl<R: TreeRoot> ast::NameOwner<R> for TraitDef<R> {}
199impl<R: TreeRoot> Trait<R> {} 199impl<R: TreeRoot> TraitDef<R> {}
200 200
201// TypeItem 201// TypeDef
202#[derive(Debug, Clone, Copy)] 202#[derive(Debug, Clone, Copy)]
203pub struct TypeItem<R: TreeRoot = Arc<SyntaxRoot>> { 203pub struct TypeDef<R: TreeRoot = Arc<SyntaxRoot>> {
204 syntax: SyntaxNode<R>, 204 syntax: SyntaxNode<R>,
205} 205}
206 206
207impl<R: TreeRoot> AstNode<R> for TypeItem<R> { 207impl<R: TreeRoot> AstNode<R> for TypeDef<R> {
208 fn cast(syntax: SyntaxNode<R>) -> Option<Self> { 208 fn cast(syntax: SyntaxNode<R>) -> Option<Self> {
209 match syntax.kind() { 209 match syntax.kind() {
210 TYPE_DEF => Some(TypeItem { syntax }), 210 TYPE_DEF => Some(TypeDef { syntax }),
211 _ => None, 211 _ => None,
212 } 212 }
213 } 213 }
214 fn syntax(&self) -> &SyntaxNode<R> { &self.syntax } 214 fn syntax(&self) -> &SyntaxNode<R> { &self.syntax }
215} 215}
216 216
217impl<R: TreeRoot> ast::NameOwner<R> for TypeItem<R> {} 217impl<R: TreeRoot> ast::NameOwner<R> for TypeDef<R> {}
218impl<R: TreeRoot> TypeItem<R> {} 218impl<R: TreeRoot> TypeDef<R> {}
219 219
diff --git a/crates/libsyntax2/src/ast/mod.rs b/crates/libsyntax2/src/ast/mod.rs
index 2e1fb2d1c..18a9f5d17 100644
--- a/crates/libsyntax2/src/ast/mod.rs
+++ b/crates/libsyntax2/src/ast/mod.rs
@@ -36,7 +36,7 @@ impl<R: TreeRoot> File<R> {
36 } 36 }
37} 37}
38 38
39impl<R: TreeRoot> Function<R> { 39impl<R: TreeRoot> FnDef<R> {
40 pub fn has_atom_attr(&self, atom: &str) -> bool { 40 pub fn has_atom_attr(&self, atom: &str) -> bool {
41 self.syntax() 41 self.syntax()
42 .children() 42 .children()
diff --git a/crates/libsyntax2/src/grammar.ron b/crates/libsyntax2/src/grammar.ron
index 16300af41..ef56761fd 100644
--- a/crates/libsyntax2/src/grammar.ron
+++ b/crates/libsyntax2/src/grammar.ron
@@ -218,17 +218,17 @@ Grammar(
218 ast: { 218 ast: {
219 "File": ( 219 "File": (
220 collections: [ 220 collections: [
221 ["functions", "Function"] 221 ["functions", "FnDef"]
222 ] 222 ]
223 ), 223 ),
224 "Function": ( traits: ["NameOwner"] ), 224 "FnDef": ( traits: ["NameOwner"] ),
225 "Struct": ( traits: ["NameOwner"] ), 225 "StructDef": ( traits: ["NameOwner"] ),
226 "Enum": ( traits: ["NameOwner"] ), 226 "EnumDef": ( traits: ["NameOwner"] ),
227 "Trait": ( traits: ["NameOwner"] ), 227 "TraitDef": ( traits: ["NameOwner"] ),
228 "Module": ( traits: ["NameOwner"] ), 228 "Module": ( traits: ["NameOwner"] ),
229 "ConstItem": ( traits: ["NameOwner"] ), 229 "ConstDef": ( traits: ["NameOwner"] ),
230 "StaticItem": ( traits: ["NameOwner"] ), 230 "StaticDef": ( traits: ["NameOwner"] ),
231 "TypeItem": ( traits: ["NameOwner"] ), 231 "TypeDef": ( traits: ["NameOwner"] ),
232 "Name": (), 232 "Name": (),
233 "NameRef": (), 233 "NameRef": (),
234 }, 234 },