aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ast/generated.rs6
-rw-r--r--src/ast/mod.rs6
-rw-r--r--src/grammar.ron4
-rw-r--r--src/grammar/items/mod.rs12
-rw-r--r--src/grammar/mod.rs2
-rw-r--r--src/syntax_kinds/generated.rs4
6 files changed, 17 insertions, 17 deletions
diff --git a/src/ast/generated.rs b/src/ast/generated.rs
index 612b04f86..b93c76d0c 100644
--- a/src/ast/generated.rs
+++ b/src/ast/generated.rs
@@ -22,14 +22,14 @@ impl<R: TreeRoot> AstNode<R> for File<R> {
22 22
23 23
24#[derive(Debug)] 24#[derive(Debug)]
25pub struct FnItem<R: TreeRoot = Arc<SyntaxRoot>> { 25pub struct Function<R: TreeRoot = Arc<SyntaxRoot>> {
26 syntax: SyntaxNode<R>, 26 syntax: SyntaxNode<R>,
27} 27}
28 28
29impl<R: TreeRoot> AstNode<R> for FnItem<R> { 29impl<R: TreeRoot> AstNode<R> for Function<R> {
30 fn cast(syntax: SyntaxNode<R>) -> Option<Self> { 30 fn cast(syntax: SyntaxNode<R>) -> Option<Self> {
31 match syntax.kind() { 31 match syntax.kind() {
32 FN_ITEM => Some(FnItem { syntax }), 32 FUNCTION => Some(Function { syntax }),
33 _ => None, 33 _ => None,
34 } 34 }
35 } 35 }
diff --git a/src/ast/mod.rs b/src/ast/mod.rs
index dc7e006c9..317ed4f45 100644
--- a/src/ast/mod.rs
+++ b/src/ast/mod.rs
@@ -19,14 +19,14 @@ impl File<Arc<SyntaxRoot>> {
19} 19}
20 20
21impl<R: TreeRoot> File<R> { 21impl<R: TreeRoot> File<R> {
22 pub fn functions<'a>(&'a self) -> impl Iterator<Item = FnItem<R>> + 'a { 22 pub fn functions<'a>(&'a self) -> impl Iterator<Item = Function<R>> + 'a {
23 self.syntax() 23 self.syntax()
24 .children() 24 .children()
25 .filter_map(FnItem::cast) 25 .filter_map(Function::cast)
26 } 26 }
27} 27}
28 28
29impl<R: TreeRoot> FnItem<R> { 29impl<R: TreeRoot> Function<R> {
30 pub fn name(&self) -> Option<Name<R>> { 30 pub fn name(&self) -> Option<Name<R>> {
31 self.syntax() 31 self.syntax()
32 .children() 32 .children()
diff --git a/src/grammar.ron b/src/grammar.ron
index b6a870d84..bcc79843a 100644
--- a/src/grammar.ron
+++ b/src/grammar.ron
@@ -110,7 +110,7 @@ Grammar(
110 110
111 "STRUCT_ITEM", 111 "STRUCT_ITEM",
112 "ENUM_ITEM", 112 "ENUM_ITEM",
113 "FN_ITEM", 113 "FUNCTION",
114 "EXTERN_CRATE_ITEM", 114 "EXTERN_CRATE_ITEM",
115 "MOD_ITEM", 115 "MOD_ITEM",
116 "USE_ITEM", 116 "USE_ITEM",
@@ -218,7 +218,7 @@ Grammar(
218 kind: "FILE" 218 kind: "FILE"
219 ), 219 ),
220 ( 220 (
221 kind: "FN_ITEM" 221 kind: "FUNCTION"
222 ), 222 ),
223 ( 223 (
224 kind: "NAME" 224 kind: "NAME"
diff --git a/src/grammar/items/mod.rs b/src/grammar/items/mod.rs
index 824f1296c..3bf906f85 100644
--- a/src/grammar/items/mod.rs
+++ b/src/grammar/items/mod.rs
@@ -107,8 +107,8 @@ pub(super) fn maybe_item(p: &mut Parser) -> MaybeItem {
107 // test unsafe_fn 107 // test unsafe_fn
108 // unsafe fn foo() {} 108 // unsafe fn foo() {}
109 FN_KW => { 109 FN_KW => {
110 fn_item(p); 110 function(p);
111 FN_ITEM 111 FUNCTION
112 } 112 }
113 113
114 // test unsafe_trait 114 // test unsafe_trait
@@ -217,12 +217,12 @@ fn extern_block(p: &mut Parser) {
217 p.expect(R_CURLY); 217 p.expect(R_CURLY);
218} 218}
219 219
220fn fn_item(p: &mut Parser) { 220fn function(p: &mut Parser) {
221 assert!(p.at(FN_KW)); 221 assert!(p.at(FN_KW));
222 p.bump(); 222 p.bump();
223 223
224 name(p); 224 name(p);
225 // test fn_item_type_params 225 // test function_type_params
226 // fn foo<T: Clone + Copy>(){} 226 // fn foo<T: Clone + Copy>(){}
227 type_params::type_param_list(p); 227 type_params::type_param_list(p);
228 228
@@ -231,12 +231,12 @@ fn fn_item(p: &mut Parser) {
231 } else { 231 } else {
232 p.error("expected function arguments"); 232 p.error("expected function arguments");
233 } 233 }
234 // test fn_item_ret_type 234 // test function_ret_type
235 // fn foo() {} 235 // fn foo() {}
236 // fn bar() -> () {} 236 // fn bar() -> () {}
237 fn_ret_type(p); 237 fn_ret_type(p);
238 238
239 // test fn_item_where_clause 239 // test function_where_clause
240 // fn foo<T>() where T: Copy {} 240 // fn foo<T>() where T: Copy {}
241 type_params::where_clause(p); 241 type_params::where_clause(p);
242 242
diff --git a/src/grammar/mod.rs b/src/grammar/mod.rs
index 1e7d04ce9..e1329044d 100644
--- a/src/grammar/mod.rs
+++ b/src/grammar/mod.rs
@@ -14,7 +14,7 @@
14//! `// test name-of-the-test` comment and look like this: 14//! `// test name-of-the-test` comment and look like this:
15//! 15//!
16//! ``` 16//! ```
17//! // test fn_item_with_zero_parameters 17//! // test function_with_zero_parameters
18//! // fn foo() {} 18//! // fn foo() {}
19//! ``` 19//! ```
20//! 20//!
diff --git a/src/syntax_kinds/generated.rs b/src/syntax_kinds/generated.rs
index 84f90c593..de2807ba6 100644
--- a/src/syntax_kinds/generated.rs
+++ b/src/syntax_kinds/generated.rs
@@ -110,7 +110,7 @@ pub enum SyntaxKind {
110 FILE, 110 FILE,
111 STRUCT_ITEM, 111 STRUCT_ITEM,
112 ENUM_ITEM, 112 ENUM_ITEM,
113 FN_ITEM, 113 FUNCTION,
114 EXTERN_CRATE_ITEM, 114 EXTERN_CRATE_ITEM,
115 MOD_ITEM, 115 MOD_ITEM,
116 USE_ITEM, 116 USE_ITEM,
@@ -345,7 +345,7 @@ impl SyntaxKind {
345 FILE => &SyntaxInfo { name: "FILE" }, 345 FILE => &SyntaxInfo { name: "FILE" },
346 STRUCT_ITEM => &SyntaxInfo { name: "STRUCT_ITEM" }, 346 STRUCT_ITEM => &SyntaxInfo { name: "STRUCT_ITEM" },
347 ENUM_ITEM => &SyntaxInfo { name: "ENUM_ITEM" }, 347 ENUM_ITEM => &SyntaxInfo { name: "ENUM_ITEM" },
348 FN_ITEM => &SyntaxInfo { name: "FN_ITEM" }, 348 FUNCTION => &SyntaxInfo { name: "FUNCTION" },
349 EXTERN_CRATE_ITEM => &SyntaxInfo { name: "EXTERN_CRATE_ITEM" }, 349 EXTERN_CRATE_ITEM => &SyntaxInfo { name: "EXTERN_CRATE_ITEM" },
350 MOD_ITEM => &SyntaxInfo { name: "MOD_ITEM" }, 350 MOD_ITEM => &SyntaxInfo { name: "MOD_ITEM" },
351 USE_ITEM => &SyntaxInfo { name: "USE_ITEM" }, 351 USE_ITEM => &SyntaxInfo { name: "USE_ITEM" },