@@ -457,7 +457,7 @@ pub impl Parser {
457457 let pur = p.parse_fn_purity();
458458 // NB: at the moment, trait methods are public by default; this
459459 // could change.
460- let ident = p.parse_method_name ();
460+ let ident = p.parse_ident ();
461461
462462 let generics = p.parse_generics();
463463
@@ -899,16 +899,9 @@ pub impl Parser {
899899 codemap:: spanned { node : lit, span : mk_sp ( lo, self . last_span . hi ) }
900900 }
901901
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 {
912905 maybe_whole ! ( self , nt_path) ;
913906 let lo = self . span . lo ;
914907 let global = self . eat ( & token:: MOD_SEP ) ;
@@ -919,10 +912,10 @@ pub impl Parser {
919912 && self . look_ahead ( 1 u) == token:: MOD_SEP ;
920913
921914 if is_not_last {
922- ids. push ( parse_ident ( self ) ) ;
915+ ids. push ( self . parse_ident ( ) ) ;
923916 self . expect ( & token:: MOD_SEP ) ;
924917 } else {
925- ids. push ( parse_last_ident ( self ) ) ;
918+ ids. push ( self . parse_ident ( ) ) ;
926919 break ;
927920 }
928921 }
@@ -933,12 +926,7 @@ pub impl Parser {
933926 types : ~[ ] }
934927 }
935928
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 {
942930 debug ! ( "parse_path_with_tps(colons=%b)" , colons) ;
943931
944932 maybe_whole ! ( self , nt_path) ;
@@ -2134,11 +2122,7 @@ pub impl Parser {
21342122 }
21352123
21362124 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 ( ) ;
21422126 let hi1 = self . last_span . lo ;
21432127 let fieldpath = ast_util:: ident_to_path ( mk_sp ( lo1, hi1) ,
21442128 fieldname) ;
@@ -2302,7 +2286,7 @@ pub impl Parser {
23022286 }
23032287
23042288 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 ( ) ;
23062290 let sub;
23072291 if self . eat ( & token:: AT ) {
23082292 sub = Some ( self . parse_pat ( refutable) ) ;
@@ -2375,7 +2359,7 @@ pub impl Parser {
23752359 * self . last_span ,
23762360 ~"expected identifier, found path") ;
23772361 }
2378- let name = self . parse_value_path ( ) ;
2362+ let name = self . parse_path_without_tps ( ) ;
23792363 let sub = if self . eat ( & token:: AT ) {
23802364 Some ( self . parse_pat ( refutable) )
23812365 } else { None } ;
@@ -2473,7 +2457,7 @@ pub impl Parser {
24732457
24742458 // Potential trouble: if we allow macros with paths instead of
24752459 // 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 ( ) ;
24772461 self . bump ( ) ;
24782462
24792463 let id = if * self . token == token:: LPAREN {
@@ -2982,7 +2966,7 @@ pub impl Parser {
29822966 }
29832967
29842968 fn parse_fn_header ( & self ) -> ( ident , ast:: Generics ) {
2985- let id = self . parse_value_ident ( ) ;
2969+ let id = self . parse_ident ( ) ;
29862970 let generics = self . parse_generics ( ) ;
29872971 ( id, generics)
29882972 }
@@ -3005,10 +2989,6 @@ pub impl Parser {
30052989 ( ident, item_fn ( decl, purity, generics, body) , Some ( inner_attrs) )
30062990 }
30072991
3008- fn parse_method_name ( & self ) -> ident {
3009- self . parse_value_ident ( )
3010- }
3011-
30122992 fn parse_method ( & self ) -> @method {
30132993 let attrs = self . parse_outer_attributes ( ) ;
30142994 let lo = self . span . lo ;
@@ -3018,7 +2998,7 @@ pub impl Parser {
30182998
30192999 let visa = self . parse_visibility ( ) ;
30203000 let pur = self . parse_fn_purity ( ) ;
3021- let ident = self . parse_method_name ( ) ;
3001+ let ident = self . parse_ident ( ) ;
30223002 let generics = self . parse_generics ( ) ;
30233003 let ( self_ty, decl) = do self . parse_fn_decl_with_self ( ) |p| {
30243004 p. parse_arg ( )
@@ -3142,7 +3122,7 @@ pub impl Parser {
31423122 }
31433123
31443124 fn parse_item_struct ( & self ) -> item_info {
3145- let class_name = self . parse_value_ident ( ) ;
3125+ let class_name = self . parse_ident ( ) ;
31463126 self . parse_region_param ( ) ;
31473127 let generics = self . parse_generics ( ) ;
31483128 if self . eat ( & token:: COLON ) {
@@ -3370,7 +3350,7 @@ pub impl Parser {
33703350 }
33713351
33723352 fn parse_item_const ( & self ) -> item_info {
3373- let id = self . parse_value_ident ( ) ;
3353+ let id = self . parse_ident ( ) ;
33743354 self . expect ( & token:: COLON ) ;
33753355 let ty = self . parse_ty ( false ) ;
33763356 self . expect ( & token:: EQ ) ;
@@ -3768,7 +3748,7 @@ pub impl Parser {
37683748 kind = enum_variant_kind ( nested_enum_def) ;
37693749 needs_comma = false ;
37703750 } else {
3771- ident = self . parse_value_ident ( ) ;
3751+ ident = self . parse_ident ( ) ;
37723752 if self . eat ( & token:: LBRACE ) {
37733753 // Parse a struct variant.
37743754 all_nullary = false ;
0 commit comments