parser: Rewrite parse_path_without_tps so it knows beforehand which is the last ident
Needed to centralize all keyword-as-value parsing in parse_value_ident
This commit is contained in:
parent
beece25abe
commit
8ab9efe262
1 changed files with 11 additions and 2 deletions
|
@ -511,9 +511,18 @@ fn parse_path_without_tps(p: parser) -> @ast::path {
|
||||||
let lo = p.span.lo;
|
let lo = p.span.lo;
|
||||||
let global = eat(p, token::MOD_SEP);
|
let global = eat(p, token::MOD_SEP);
|
||||||
let mut ids = [];
|
let mut ids = [];
|
||||||
do {
|
loop {
|
||||||
|
let is_not_last =
|
||||||
|
p.look_ahead(2u) != token::LT
|
||||||
|
&& p.look_ahead(1u) == token::MOD_SEP;
|
||||||
|
|
||||||
ids += [parse_ident(p)];
|
ids += [parse_ident(p)];
|
||||||
} while p.look_ahead(1u) != token::LT && eat(p, token::MOD_SEP);
|
if is_not_last {
|
||||||
|
expect(p, token::MOD_SEP);
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
@{span: mk_sp(lo, p.last_span.hi), global: global,
|
@{span: mk_sp(lo, p.last_span.hi), global: global,
|
||||||
idents: ids, rp: none, types: []}
|
idents: ids, rp: none, types: []}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue