@@ -457,7 +457,7 @@ pub impl Parser {
457
457
let pur = p.parse_fn_purity();
458
458
// NB: at the moment, trait methods are public by default; this
459
459
// could change.
460
- let ident = p.parse_method_name ();
460
+ let ident = p.parse_ident ();
461
461
462
462
let generics = p.parse_generics();
463
463
@@ -899,16 +899,9 @@ pub impl Parser {
899
899
codemap:: spanned { node : lit, span : mk_sp ( lo, self . last_span . hi ) }
900
900
}
901
901
902
- fn parse_path_without_tps ( & self ) -> @path {
903
- self . parse_path_without_tps_ ( |p| p. parse_ident ( ) ,
904
- |p| p. parse_ident ( ) )
905
- }
906
-
907
- fn parse_path_without_tps_ (
908
- & self ,
909
- parse_ident : fn ( & Parser ) -> ident ,
910
- parse_last_ident : fn ( & Parser ) -> ident
911
- ) -> @path {
902
+ // parse a path that doesn't have type parameters attached
903
+ fn parse_path_without_tps ( & self )
904
+ -> @ast:: path {
912
905
maybe_whole ! ( self , nt_path) ;
913
906
let lo = self . span . lo ;
914
907
let global = self . eat ( & token:: MOD_SEP ) ;
@@ -919,10 +912,10 @@ pub impl Parser {
919
912
&& self . look_ahead ( 1 u) == token:: MOD_SEP ;
920
913
921
914
if is_not_last {
922
- ids. push ( parse_ident ( self ) ) ;
915
+ ids. push ( self . parse_ident ( ) ) ;
923
916
self . expect ( & token:: MOD_SEP ) ;
924
917
} else {
925
- ids. push ( parse_last_ident ( self ) ) ;
918
+ ids. push ( self . parse_ident ( ) ) ;
926
919
break ;
927
920
}
928
921
}
@@ -933,12 +926,7 @@ pub impl Parser {
933
926
types : ~[ ] }
934
927
}
935
928
936
- fn parse_value_path ( & self ) -> @path {
937
- self . parse_path_without_tps_ ( |p| p. parse_ident ( ) ,
938
- |p| p. parse_value_ident ( ) )
939
- }
940
-
941
- fn parse_path_with_tps ( & self , colons : bool ) -> @path {
929
+ fn parse_path_with_tps ( & self , colons : bool ) -> @ast:: path {
942
930
debug ! ( "parse_path_with_tps(colons=%b)" , colons) ;
943
931
944
932
maybe_whole ! ( self , nt_path) ;
@@ -2134,11 +2122,7 @@ pub impl Parser {
2134
2122
}
2135
2123
2136
2124
let lo1 = self . last_span . lo ;
2137
- let fieldname = if self . look_ahead ( 1 u) == token:: COLON {
2138
- self . parse_ident ( )
2139
- } else {
2140
- self . parse_value_ident ( )
2141
- } ;
2125
+ let fieldname = self . parse_ident ( ) ;
2142
2126
let hi1 = self . last_span . lo ;
2143
2127
let fieldpath = ast_util:: ident_to_path ( mk_sp ( lo1, hi1) ,
2144
2128
fieldname) ;
@@ -2302,7 +2286,7 @@ pub impl Parser {
2302
2286
}
2303
2287
2304
2288
if is_plain_ident ( & * self . token ) && cannot_be_enum_or_struct {
2305
- let name = self . parse_value_path ( ) ;
2289
+ let name = self . parse_path_without_tps ( ) ;
2306
2290
let sub;
2307
2291
if self . eat ( & token:: AT ) {
2308
2292
sub = Some ( self . parse_pat ( refutable) ) ;
@@ -2375,7 +2359,7 @@ pub impl Parser {
2375
2359
* self . last_span ,
2376
2360
~"expected identifier, found path") ;
2377
2361
}
2378
- let name = self . parse_value_path ( ) ;
2362
+ let name = self . parse_path_without_tps ( ) ;
2379
2363
let sub = if self . eat ( & token:: AT ) {
2380
2364
Some ( self . parse_pat ( refutable) )
2381
2365
} else { None } ;
@@ -2473,7 +2457,7 @@ pub impl Parser {
2473
2457
2474
2458
// Potential trouble: if we allow macros with paths instead of
2475
2459
// idents, we'd need to look ahead past the whole path here...
2476
- let pth = self . parse_value_path ( ) ;
2460
+ let pth = self . parse_path_without_tps ( ) ;
2477
2461
self . bump ( ) ;
2478
2462
2479
2463
let id = if * self . token == token:: LPAREN {
@@ -2982,7 +2966,7 @@ pub impl Parser {
2982
2966
}
2983
2967
2984
2968
fn parse_fn_header ( & self ) -> ( ident , ast:: Generics ) {
2985
- let id = self . parse_value_ident ( ) ;
2969
+ let id = self . parse_ident ( ) ;
2986
2970
let generics = self . parse_generics ( ) ;
2987
2971
( id, generics)
2988
2972
}
@@ -3005,10 +2989,6 @@ pub impl Parser {
3005
2989
( ident, item_fn ( decl, purity, generics, body) , Some ( inner_attrs) )
3006
2990
}
3007
2991
3008
- fn parse_method_name ( & self ) -> ident {
3009
- self . parse_value_ident ( )
3010
- }
3011
-
3012
2992
fn parse_method ( & self ) -> @method {
3013
2993
let attrs = self . parse_outer_attributes ( ) ;
3014
2994
let lo = self . span . lo ;
@@ -3018,7 +2998,7 @@ pub impl Parser {
3018
2998
3019
2999
let visa = self . parse_visibility ( ) ;
3020
3000
let pur = self . parse_fn_purity ( ) ;
3021
- let ident = self . parse_method_name ( ) ;
3001
+ let ident = self . parse_ident ( ) ;
3022
3002
let generics = self . parse_generics ( ) ;
3023
3003
let ( self_ty, decl) = do self . parse_fn_decl_with_self ( ) |p| {
3024
3004
p. parse_arg ( )
@@ -3142,7 +3122,7 @@ pub impl Parser {
3142
3122
}
3143
3123
3144
3124
fn parse_item_struct ( & self ) -> item_info {
3145
- let class_name = self . parse_value_ident ( ) ;
3125
+ let class_name = self . parse_ident ( ) ;
3146
3126
self . parse_region_param ( ) ;
3147
3127
let generics = self . parse_generics ( ) ;
3148
3128
if self . eat ( & token:: COLON ) {
@@ -3370,7 +3350,7 @@ pub impl Parser {
3370
3350
}
3371
3351
3372
3352
fn parse_item_const ( & self ) -> item_info {
3373
- let id = self . parse_value_ident ( ) ;
3353
+ let id = self . parse_ident ( ) ;
3374
3354
self . expect ( & token:: COLON ) ;
3375
3355
let ty = self . parse_ty ( false ) ;
3376
3356
self . expect ( & token:: EQ ) ;
@@ -3768,7 +3748,7 @@ pub impl Parser {
3768
3748
kind = enum_variant_kind ( nested_enum_def) ;
3769
3749
needs_comma = false ;
3770
3750
} else {
3771
- ident = self . parse_value_ident ( ) ;
3751
+ ident = self . parse_ident ( ) ;
3772
3752
if self . eat ( & token:: LBRACE ) {
3773
3753
// Parse a struct variant.
3774
3754
all_nullary = false ;
0 commit comments