aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/libsyntax2/src/grammar/expressions/atom.rs2
-rw-r--r--crates/libsyntax2/src/grammar/expressions/mod.rs2
-rw-r--r--crates/libsyntax2/src/grammar/items/mod.rs10
-rw-r--r--crates/libsyntax2/src/grammar/items/structs.rs8
-rw-r--r--crates/libsyntax2/src/grammar/items/traits.rs8
-rw-r--r--crates/libsyntax2/src/grammar/mod.rs2
-rw-r--r--crates/libsyntax2/src/grammar/params.rs4
-rw-r--r--crates/libsyntax2/src/grammar/paths.rs10
-rw-r--r--crates/libsyntax2/src/grammar/type_args.rs2
-rw-r--r--crates/libsyntax2/src/grammar/type_params.rs4
-rw-r--r--crates/libsyntax2/src/grammar/types.rs4
11 files changed, 28 insertions, 28 deletions
diff --git a/crates/libsyntax2/src/grammar/expressions/atom.rs b/crates/libsyntax2/src/grammar/expressions/atom.rs
index 4f03862b1..57a887f84 100644
--- a/crates/libsyntax2/src/grammar/expressions/atom.rs
+++ b/crates/libsyntax2/src/grammar/expressions/atom.rs
@@ -130,7 +130,7 @@ fn lambda_expr(p: &mut Parser) -> CompletedMarker {
130 let m = p.start(); 130 let m = p.start();
131 p.eat(MOVE_KW); 131 p.eat(MOVE_KW);
132 params::param_list_opt_types(p); 132 params::param_list_opt_types(p);
133 if fn_ret_type(p) { 133 if opt_fn_ret_type(p) {
134 block(p); 134 block(p);
135 } else { 135 } else {
136 expr(p); 136 expr(p);
diff --git a/crates/libsyntax2/src/grammar/expressions/mod.rs b/crates/libsyntax2/src/grammar/expressions/mod.rs
index 3da539699..9ce0c1f8f 100644
--- a/crates/libsyntax2/src/grammar/expressions/mod.rs
+++ b/crates/libsyntax2/src/grammar/expressions/mod.rs
@@ -265,7 +265,7 @@ fn method_call_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker {
265 let m = lhs.precede(p); 265 let m = lhs.precede(p);
266 p.bump(); 266 p.bump();
267 name_ref(p); 267 name_ref(p);
268 type_args::type_arg_list(p, true); 268 type_args::opt_type_arg_list(p, true);
269 if p.at(L_PAREN) { 269 if p.at(L_PAREN) {
270 arg_list(p); 270 arg_list(p);
271 } 271 }
diff --git a/crates/libsyntax2/src/grammar/items/mod.rs b/crates/libsyntax2/src/grammar/items/mod.rs
index d460612b4..18b681ee2 100644
--- a/crates/libsyntax2/src/grammar/items/mod.rs
+++ b/crates/libsyntax2/src/grammar/items/mod.rs
@@ -225,7 +225,7 @@ fn function(p: &mut Parser, flavor: ItemFlavor) {
225 name(p); 225 name(p);
226 // test function_type_params 226 // test function_type_params
227 // fn foo<T: Clone + Copy>(){} 227 // fn foo<T: Clone + Copy>(){}
228 type_params::type_param_list(p); 228 type_params::opt_type_param_list(p);
229 229
230 if p.at(L_PAREN) { 230 if p.at(L_PAREN) {
231 match flavor { 231 match flavor {
@@ -240,11 +240,11 @@ fn function(p: &mut Parser, flavor: ItemFlavor) {
240 // test function_ret_type 240 // test function_ret_type
241 // fn foo() {} 241 // fn foo() {}
242 // fn bar() -> () {} 242 // fn bar() -> () {}
243 fn_ret_type(p); 243 opt_fn_ret_type(p);
244 244
245 // test function_where_clause 245 // test function_where_clause
246 // fn foo<T>() where T: Copy {} 246 // fn foo<T>() where T: Copy {}
247 type_params::where_clause(p); 247 type_params::opt_where_clause(p);
248 248
249 // test fn_decl 249 // test fn_decl
250 // trait T { fn foo(); } 250 // trait T { fn foo(); }
@@ -263,7 +263,7 @@ fn type_def(p: &mut Parser) {
263 263
264 // test type_item_type_params 264 // test type_item_type_params
265 // type Result<T> = (); 265 // type Result<T> = ();
266 type_params::type_param_list(p); 266 type_params::opt_type_param_list(p);
267 267
268 if p.at(COLON) { 268 if p.at(COLON) {
269 type_params::bounds(p); 269 type_params::bounds(p);
@@ -271,7 +271,7 @@ fn type_def(p: &mut Parser) {
271 271
272 // test type_item_where_clause 272 // test type_item_where_clause
273 // type Foo where Foo: Copy = (); 273 // type Foo where Foo: Copy = ();
274 type_params::where_clause(p); 274 type_params::opt_where_clause(p);
275 275
276 if p.eat(EQ) { 276 if p.eat(EQ) {
277 types::type_(p); 277 types::type_(p);
diff --git a/crates/libsyntax2/src/grammar/items/structs.rs b/crates/libsyntax2/src/grammar/items/structs.rs
index b3ed94fe3..cde9d0ae6 100644
--- a/crates/libsyntax2/src/grammar/items/structs.rs
+++ b/crates/libsyntax2/src/grammar/items/structs.rs
@@ -5,10 +5,10 @@ pub(super) fn struct_def(p: &mut Parser) {
5 p.bump(); 5 p.bump();
6 6
7 name(p); 7 name(p);
8 type_params::type_param_list(p); 8 type_params::opt_type_param_list(p);
9 match p.current() { 9 match p.current() {
10 WHERE_KW => { 10 WHERE_KW => {
11 type_params::where_clause(p); 11 type_params::opt_where_clause(p);
12 match p.current() { 12 match p.current() {
13 SEMI => { 13 SEMI => {
14 p.bump(); 14 p.bump();
@@ -42,8 +42,8 @@ pub(super) fn enum_def(p: &mut Parser) {
42 assert!(p.at(ENUM_KW)); 42 assert!(p.at(ENUM_KW));
43 p.bump(); 43 p.bump();
44 name(p); 44 name(p);
45 type_params::type_param_list(p); 45 type_params::opt_type_param_list(p);
46 type_params::where_clause(p); 46 type_params::opt_where_clause(p);
47 if p.expect(L_CURLY) { 47 if p.expect(L_CURLY) {
48 while !p.at(EOF) && !p.at(R_CURLY) { 48 while !p.at(EOF) && !p.at(R_CURLY) {
49 let var = p.start(); 49 let var = p.start();
diff --git a/crates/libsyntax2/src/grammar/items/traits.rs b/crates/libsyntax2/src/grammar/items/traits.rs
index daecaff5c..73ecd4bef 100644
--- a/crates/libsyntax2/src/grammar/items/traits.rs
+++ b/crates/libsyntax2/src/grammar/items/traits.rs
@@ -6,11 +6,11 @@ pub(super) fn trait_def(p: &mut Parser) {
6 assert!(p.at(TRAIT_KW)); 6 assert!(p.at(TRAIT_KW));
7 p.bump(); 7 p.bump();
8 name(p); 8 name(p);
9 type_params::type_param_list(p); 9 type_params::opt_type_param_list(p);
10 if p.at(COLON) { 10 if p.at(COLON) {
11 type_params::bounds(p); 11 type_params::bounds(p);
12 } 12 }
13 type_params::where_clause(p); 13 type_params::opt_where_clause(p);
14 p.expect(L_CURLY); 14 p.expect(L_CURLY);
15 // test trait_item_items 15 // test trait_item_items
16 // impl F { 16 // impl F {
@@ -31,7 +31,7 @@ pub(super) fn impl_item(p: &mut Parser) {
31 assert!(p.at(IMPL_KW)); 31 assert!(p.at(IMPL_KW));
32 p.bump(); 32 p.bump();
33 if choose_type_params_over_qpath(p) { 33 if choose_type_params_over_qpath(p) {
34 type_params::type_param_list(p); 34 type_params::opt_type_param_list(p);
35 } 35 }
36 36
37 // TODO: never type 37 // TODO: never type
@@ -44,7 +44,7 @@ pub(super) fn impl_item(p: &mut Parser) {
44 if p.eat(FOR_KW) { 44 if p.eat(FOR_KW) {
45 types::type_(p); 45 types::type_(p);
46 } 46 }
47 type_params::where_clause(p); 47 type_params::opt_where_clause(p);
48 p.expect(L_CURLY); 48 p.expect(L_CURLY);
49 49
50 // test impl_item_items 50 // test impl_item_items
diff --git a/crates/libsyntax2/src/grammar/mod.rs b/crates/libsyntax2/src/grammar/mod.rs
index d09a9dc9c..0f168eb60 100644
--- a/crates/libsyntax2/src/grammar/mod.rs
+++ b/crates/libsyntax2/src/grammar/mod.rs
@@ -113,7 +113,7 @@ fn abi(p: &mut Parser) {
113 abi.complete(p, ABI); 113 abi.complete(p, ABI);
114} 114}
115 115
116fn fn_ret_type(p: &mut Parser) -> bool { 116fn opt_fn_ret_type(p: &mut Parser) -> bool {
117 if p.at(THIN_ARROW) { 117 if p.at(THIN_ARROW) {
118 p.bump(); 118 p.bump();
119 types::type_(p); 119 types::type_(p);
diff --git a/crates/libsyntax2/src/grammar/params.rs b/crates/libsyntax2/src/grammar/params.rs
index 47567ec8a..5b1322b3a 100644
--- a/crates/libsyntax2/src/grammar/params.rs
+++ b/crates/libsyntax2/src/grammar/params.rs
@@ -45,7 +45,7 @@ fn list_(p: &mut Parser, flavor: Flavor) {
45 let m = p.start(); 45 let m = p.start();
46 p.bump(); 46 p.bump();
47 if flavor.type_required() { 47 if flavor.type_required() {
48 self_param(p); 48 opt_self_param(p);
49 } 49 }
50 while !p.at(EOF) && !p.at(ket) { 50 while !p.at(EOF) && !p.at(ket) {
51 value_parameter(p, flavor); 51 value_parameter(p, flavor);
@@ -94,7 +94,7 @@ fn value_parameter(p: &mut Parser, flavor: Flavor) {
94// fn d(&'a mut self, x: i32) {} 94// fn d(&'a mut self, x: i32) {}
95// fn e(mut self) {} 95// fn e(mut self) {}
96// } 96// }
97fn self_param(p: &mut Parser) { 97fn opt_self_param(p: &mut Parser) {
98 let m; 98 let m;
99 if p.at(SELF_KW) || p.at(MUT_KW) && p.nth(1) == SELF_KW { 99 if p.at(SELF_KW) || p.at(MUT_KW) && p.nth(1) == SELF_KW {
100 m = p.start(); 100 m = p.start();
diff --git a/crates/libsyntax2/src/grammar/paths.rs b/crates/libsyntax2/src/grammar/paths.rs
index 97ab1880b..8f5e82d91 100644
--- a/crates/libsyntax2/src/grammar/paths.rs
+++ b/crates/libsyntax2/src/grammar/paths.rs
@@ -69,7 +69,7 @@ fn path_segment(p: &mut Parser, mode: Mode, first: bool) {
69 match p.current() { 69 match p.current() {
70 IDENT => { 70 IDENT => {
71 name_ref(p); 71 name_ref(p);
72 path_generic_args(p, mode); 72 opt_path_type_args(p, mode);
73 } 73 }
74 SELF_KW | SUPER_KW => p.bump(), 74 SELF_KW | SUPER_KW => p.bump(),
75 _ => { 75 _ => {
@@ -80,7 +80,7 @@ fn path_segment(p: &mut Parser, mode: Mode, first: bool) {
80 m.complete(p, PATH_SEGMENT); 80 m.complete(p, PATH_SEGMENT);
81} 81}
82 82
83fn path_generic_args(p: &mut Parser, mode: Mode) { 83fn opt_path_type_args(p: &mut Parser, mode: Mode) {
84 match mode { 84 match mode {
85 Mode::Use => return, 85 Mode::Use => return,
86 Mode::Type => { 86 Mode::Type => {
@@ -88,11 +88,11 @@ fn path_generic_args(p: &mut Parser, mode: Mode) {
88 // type F = Box<Fn(x: i32) -> ()>; 88 // type F = Box<Fn(x: i32) -> ()>;
89 if p.at(L_PAREN) { 89 if p.at(L_PAREN) {
90 params::param_list_opt_patterns(p); 90 params::param_list_opt_patterns(p);
91 fn_ret_type(p); 91 opt_fn_ret_type(p);
92 } else { 92 } else {
93 type_args::type_arg_list(p, false) 93 type_args::opt_type_arg_list(p, false)
94 } 94 }
95 }, 95 },
96 Mode::Expr => type_args::type_arg_list(p, true), 96 Mode::Expr => type_args::opt_type_arg_list(p, true),
97 } 97 }
98} 98}
diff --git a/crates/libsyntax2/src/grammar/type_args.rs b/crates/libsyntax2/src/grammar/type_args.rs
index 5b960f10b..29ff6e534 100644
--- a/crates/libsyntax2/src/grammar/type_args.rs
+++ b/crates/libsyntax2/src/grammar/type_args.rs
@@ -1,6 +1,6 @@
1use super::*; 1use super::*;
2 2
3pub(super) fn type_arg_list(p: &mut Parser, colon_colon_required: bool) { 3pub(super) fn opt_type_arg_list(p: &mut Parser, colon_colon_required: bool) {
4 let m; 4 let m;
5 match (colon_colon_required, p.nth(0), p.nth(1)) { 5 match (colon_colon_required, p.nth(0), p.nth(1)) {
6 (_, COLONCOLON, L_ANGLE) => { 6 (_, COLONCOLON, L_ANGLE) => {
diff --git a/crates/libsyntax2/src/grammar/type_params.rs b/crates/libsyntax2/src/grammar/type_params.rs
index a97eeb142..3fb4bd356 100644
--- a/crates/libsyntax2/src/grammar/type_params.rs
+++ b/crates/libsyntax2/src/grammar/type_params.rs
@@ -1,6 +1,6 @@
1use super::*; 1use super::*;
2 2
3pub(super) fn type_param_list(p: &mut Parser) { 3pub(super) fn opt_type_param_list(p: &mut Parser) {
4 if !p.at(L_ANGLE) { 4 if !p.at(L_ANGLE) {
5 return; 5 return;
6 } 6 }
@@ -96,7 +96,7 @@ pub(super) fn bounds_without_colon(p: &mut Parser) {
96// T: Clone + Copy + 'static, 96// T: Clone + Copy + 'static,
97// Iterator::Item: 'a, 97// Iterator::Item: 'a,
98// {} 98// {}
99pub(super) fn where_clause(p: &mut Parser) { 99pub(super) fn opt_where_clause(p: &mut Parser) {
100 if !p.at(WHERE_KW) { 100 if !p.at(WHERE_KW) {
101 return; 101 return;
102 } 102 }
diff --git a/crates/libsyntax2/src/grammar/types.rs b/crates/libsyntax2/src/grammar/types.rs
index f58b545c7..2088a38e3 100644
--- a/crates/libsyntax2/src/grammar/types.rs
+++ b/crates/libsyntax2/src/grammar/types.rs
@@ -174,7 +174,7 @@ fn fn_pointer_type(p: &mut Parser) {
174 } 174 }
175 // test fn_pointer_type_with_ret 175 // test fn_pointer_type_with_ret
176 // type F = fn() -> (); 176 // type F = fn() -> ();
177 fn_ret_type(p); 177 opt_fn_ret_type(p);
178 m.complete(p, FN_POINTER_TYPE); 178 m.complete(p, FN_POINTER_TYPE);
179} 179}
180 180
@@ -184,7 +184,7 @@ fn for_type(p: &mut Parser) {
184 assert!(p.at(FOR_KW)); 184 assert!(p.at(FOR_KW));
185 let m = p.start(); 185 let m = p.start();
186 p.bump(); 186 p.bump();
187 type_params::type_param_list(p); 187 type_params::opt_type_param_list(p);
188 type_(p); 188 type_(p);
189 m.complete(p, FOR_TYPE); 189 m.complete(p, FOR_TYPE);
190} 190}