Skip to content

Commit 7e90e32

Browse files
committed
---
yaml --- r: 56488 b: refs/heads/auto c: ae4e09f h: refs/heads/master v: v3
1 parent 87ad3bb commit 7e90e32

File tree

2 files changed

+35
-20
lines changed

2 files changed

+35
-20
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: 28b285764cd6d9b184584756177199d0f1c32ce3
17+
refs/heads/auto: ae4e09f71ac545dbf51778ee3ffe695de1d50f60
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/src/libsyntax/parse/parser.rs

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -900,30 +900,45 @@ pub impl Parser {
900900
codemap::spanned { node: lit, span: mk_sp(lo, self.last_span.hi) }
901901
}
902902

903-
// parse a path that doesn't have type parameters attached
904-
fn parse_path_without_tps(&self)
905-
-> @ast::Path {
906-
maybe_whole!(self, nt_path);
903+
// parse a path into a vector of idents, whether the path starts
904+
// with ::, and a span.
905+
fn parse_path(&self) -> (~[ast::ident],bool,span) {
906+
let lo = self.span.lo;
907+
let is_global = self.eat(&token::MOD_SEP);
908+
let (ids,span{lo:_,hi,expn_info}) = self.parse_path_non_global();
909+
(ids,is_global,span{lo:lo,hi:hi,expn_info:expn_info})
910+
}
911+
912+
// parse a path beginning with an identifier into a vector of idents and a span
913+
fn parse_path_non_global(&self) -> (~[ast::ident],span) {
907914
let lo = self.span.lo;
908-
let global = self.eat(&token::MOD_SEP);
909915
let mut ids = ~[];
916+
// must be at least one to begin:
917+
ids.push(self.parse_ident());
910918
loop {
911-
// if there's a ::< coming, stop processing
912-
// the path.
913-
let is_not_last =
914-
self.look_ahead(2u) != token::LT
915-
&& self.look_ahead(1u) == token::MOD_SEP;
916-
917-
if is_not_last {
918-
ids.push(self.parse_ident());
919-
self.expect(&token::MOD_SEP);
920-
} else {
921-
ids.push(self.parse_ident());
922-
break;
919+
match *self.token {
920+
token::MOD_SEP => {
921+
match self.look_ahead(1u) {
922+
token::IDENT(id,_) => {
923+
self.bump();
924+
ids.push(self.parse_ident());
925+
}
926+
_ => break
927+
}
928+
}
929+
_ => break
923930
}
924931
}
925-
@ast::Path { span: mk_sp(lo, self.last_span.hi),
926-
global: global,
932+
(ids, mk_sp(lo, self.last_span.hi))
933+
}
934+
935+
// parse a path that doesn't have type parameters attached
936+
fn parse_path_without_tps(&self)
937+
-> @ast::Path {
938+
maybe_whole!(self, nt_path);
939+
let (ids,is_global,sp) = self.parse_path();
940+
@ast::Path { span: sp,
941+
global: is_global,
927942
idents: ids,
928943
rp: None,
929944
types: ~[] }

0 commit comments

Comments
 (0)