@@ -508,6 +508,13 @@ fn parse_lit(p: parser) -> ast::lit {
508
508
}
509
509
510
510
fn parse_path_without_tps ( p : parser ) -> @ast:: path {
511
+ parse_path_without_tps_ ( p, parse_ident, parse_ident)
512
+ }
513
+
514
+ fn parse_path_without_tps_ (
515
+ p : parser , parse_ident : fn ( parser ) -> ast:: ident ,
516
+ parse_last_ident : fn ( parser ) -> ast:: ident ) -> @ast:: path {
517
+
511
518
let lo = p. span . lo ;
512
519
let global = eat ( p, token:: MOD_SEP ) ;
513
520
let mut ids = [ ] ;
@@ -516,10 +523,11 @@ fn parse_path_without_tps(p: parser) -> @ast::path {
516
523
p. look_ahead ( 2 u) != token:: LT
517
524
&& p. look_ahead ( 1 u) == token:: MOD_SEP ;
518
525
519
- ids += [ parse_ident ( p) ] ;
520
526
if is_not_last {
527
+ ids += [ parse_ident ( p) ] ;
521
528
expect ( p, token:: MOD_SEP ) ;
522
529
} else {
530
+ ids += [ parse_last_ident ( p) ] ;
523
531
break ;
524
532
}
525
533
}
@@ -528,12 +536,7 @@ fn parse_path_without_tps(p: parser) -> @ast::path {
528
536
}
529
537
530
538
fn parse_value_path ( p : parser ) -> @ast:: path {
531
- let pt = parse_path_without_tps ( p) ;
532
- let last_word = vec:: last ( pt. idents ) ;
533
- if is_restricted_keyword ( p, last_word) {
534
- p. fatal ( "found " + last_word + " in expression position" ) ;
535
- }
536
- pt
539
+ parse_path_without_tps_ ( p, parse_ident, parse_value_ident)
537
540
}
538
541
539
542
fn parse_path_with_tps ( p : parser , colons : bool ) -> @ast:: path {
0 commit comments