From a66c94af1bad3c2dcfd8dd4c07494d0cf6cc8b1b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 24 Aug 2018 02:14:10 +0300 Subject: renames --- crates/libsyntax2/src/grammar/expressions/atom.rs | 2 +- crates/libsyntax2/src/grammar/expressions/mod.rs | 2 +- crates/libsyntax2/src/grammar/items/mod.rs | 10 +++++----- crates/libsyntax2/src/grammar/items/structs.rs | 8 ++++---- crates/libsyntax2/src/grammar/items/traits.rs | 8 ++++---- crates/libsyntax2/src/grammar/mod.rs | 2 +- crates/libsyntax2/src/grammar/params.rs | 4 ++-- crates/libsyntax2/src/grammar/paths.rs | 10 +++++----- crates/libsyntax2/src/grammar/type_args.rs | 2 +- crates/libsyntax2/src/grammar/type_params.rs | 4 ++-- crates/libsyntax2/src/grammar/types.rs | 4 ++-- 11 files changed, 28 insertions(+), 28 deletions(-) (limited to 'crates/libsyntax2/src/grammar') 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 { let m = p.start(); p.eat(MOVE_KW); params::param_list_opt_types(p); - if fn_ret_type(p) { + if opt_fn_ret_type(p) { block(p); } else { 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 { let m = lhs.precede(p); p.bump(); name_ref(p); - type_args::type_arg_list(p, true); + type_args::opt_type_arg_list(p, true); if p.at(L_PAREN) { arg_list(p); } 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) { name(p); // test function_type_params // fn foo(){} - type_params::type_param_list(p); + type_params::opt_type_param_list(p); if p.at(L_PAREN) { match flavor { @@ -240,11 +240,11 @@ fn function(p: &mut Parser, flavor: ItemFlavor) { // test function_ret_type // fn foo() {} // fn bar() -> () {} - fn_ret_type(p); + opt_fn_ret_type(p); // test function_where_clause // fn foo() where T: Copy {} - type_params::where_clause(p); + type_params::opt_where_clause(p); // test fn_decl // trait T { fn foo(); } @@ -263,7 +263,7 @@ fn type_def(p: &mut Parser) { // test type_item_type_params // type Result = (); - type_params::type_param_list(p); + type_params::opt_type_param_list(p); if p.at(COLON) { type_params::bounds(p); @@ -271,7 +271,7 @@ fn type_def(p: &mut Parser) { // test type_item_where_clause // type Foo where Foo: Copy = (); - type_params::where_clause(p); + type_params::opt_where_clause(p); if p.eat(EQ) { 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) { p.bump(); name(p); - type_params::type_param_list(p); + type_params::opt_type_param_list(p); match p.current() { WHERE_KW => { - type_params::where_clause(p); + type_params::opt_where_clause(p); match p.current() { SEMI => { p.bump(); @@ -42,8 +42,8 @@ pub(super) fn enum_def(p: &mut Parser) { assert!(p.at(ENUM_KW)); p.bump(); name(p); - type_params::type_param_list(p); - type_params::where_clause(p); + type_params::opt_type_param_list(p); + type_params::opt_where_clause(p); if p.expect(L_CURLY) { while !p.at(EOF) && !p.at(R_CURLY) { 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) { assert!(p.at(TRAIT_KW)); p.bump(); name(p); - type_params::type_param_list(p); + type_params::opt_type_param_list(p); if p.at(COLON) { type_params::bounds(p); } - type_params::where_clause(p); + type_params::opt_where_clause(p); p.expect(L_CURLY); // test trait_item_items // impl F { @@ -31,7 +31,7 @@ pub(super) fn impl_item(p: &mut Parser) { assert!(p.at(IMPL_KW)); p.bump(); if choose_type_params_over_qpath(p) { - type_params::type_param_list(p); + type_params::opt_type_param_list(p); } // TODO: never type @@ -44,7 +44,7 @@ pub(super) fn impl_item(p: &mut Parser) { if p.eat(FOR_KW) { types::type_(p); } - type_params::where_clause(p); + type_params::opt_where_clause(p); p.expect(L_CURLY); // 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) { abi.complete(p, ABI); } -fn fn_ret_type(p: &mut Parser) -> bool { +fn opt_fn_ret_type(p: &mut Parser) -> bool { if p.at(THIN_ARROW) { p.bump(); 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) { let m = p.start(); p.bump(); if flavor.type_required() { - self_param(p); + opt_self_param(p); } while !p.at(EOF) && !p.at(ket) { value_parameter(p, flavor); @@ -94,7 +94,7 @@ fn value_parameter(p: &mut Parser, flavor: Flavor) { // fn d(&'a mut self, x: i32) {} // fn e(mut self) {} // } -fn self_param(p: &mut Parser) { +fn opt_self_param(p: &mut Parser) { let m; if p.at(SELF_KW) || p.at(MUT_KW) && p.nth(1) == SELF_KW { 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) { match p.current() { IDENT => { name_ref(p); - path_generic_args(p, mode); + opt_path_type_args(p, mode); } SELF_KW | SUPER_KW => p.bump(), _ => { @@ -80,7 +80,7 @@ fn path_segment(p: &mut Parser, mode: Mode, first: bool) { m.complete(p, PATH_SEGMENT); } -fn path_generic_args(p: &mut Parser, mode: Mode) { +fn opt_path_type_args(p: &mut Parser, mode: Mode) { match mode { Mode::Use => return, Mode::Type => { @@ -88,11 +88,11 @@ fn path_generic_args(p: &mut Parser, mode: Mode) { // type F = Box ()>; if p.at(L_PAREN) { params::param_list_opt_patterns(p); - fn_ret_type(p); + opt_fn_ret_type(p); } else { - type_args::type_arg_list(p, false) + type_args::opt_type_arg_list(p, false) } }, - Mode::Expr => type_args::type_arg_list(p, true), + Mode::Expr => type_args::opt_type_arg_list(p, true), } } 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 @@ use super::*; -pub(super) fn type_arg_list(p: &mut Parser, colon_colon_required: bool) { +pub(super) fn opt_type_arg_list(p: &mut Parser, colon_colon_required: bool) { let m; match (colon_colon_required, p.nth(0), p.nth(1)) { (_, 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 @@ use super::*; -pub(super) fn type_param_list(p: &mut Parser) { +pub(super) fn opt_type_param_list(p: &mut Parser) { if !p.at(L_ANGLE) { return; } @@ -96,7 +96,7 @@ pub(super) fn bounds_without_colon(p: &mut Parser) { // T: Clone + Copy + 'static, // Iterator::Item: 'a, // {} -pub(super) fn where_clause(p: &mut Parser) { +pub(super) fn opt_where_clause(p: &mut Parser) { if !p.at(WHERE_KW) { return; } 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) { } // test fn_pointer_type_with_ret // type F = fn() -> (); - fn_ret_type(p); + opt_fn_ret_type(p); m.complete(p, FN_POINTER_TYPE); } @@ -184,7 +184,7 @@ fn for_type(p: &mut Parser) { assert!(p.at(FOR_KW)); let m = p.start(); p.bump(); - type_params::type_param_list(p); + type_params::opt_type_param_list(p); type_(p); m.complete(p, FOR_TYPE); } -- cgit v1.2.3