parser: Make parse_value_path use parse_value_ident
This commit is contained in:
parent
8ab9efe262
commit
bde5a842ce
1 changed files with 10 additions and 7 deletions
|
@ -508,6 +508,13 @@ fn parse_lit(p: parser) -> ast::lit {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_path_without_tps(p: parser) -> @ast::path {
|
fn parse_path_without_tps(p: parser) -> @ast::path {
|
||||||
|
parse_path_without_tps_(p, parse_ident, parse_ident)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parse_path_without_tps_(
|
||||||
|
p: parser, parse_ident: fn(parser) -> ast::ident,
|
||||||
|
parse_last_ident: fn(parser) -> ast::ident) -> @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 = [];
|
||||||
|
@ -516,10 +523,11 @@ fn parse_path_without_tps(p: parser) -> @ast::path {
|
||||||
p.look_ahead(2u) != token::LT
|
p.look_ahead(2u) != token::LT
|
||||||
&& p.look_ahead(1u) == token::MOD_SEP;
|
&& p.look_ahead(1u) == token::MOD_SEP;
|
||||||
|
|
||||||
ids += [parse_ident(p)];
|
|
||||||
if is_not_last {
|
if is_not_last {
|
||||||
|
ids += [parse_ident(p)];
|
||||||
expect(p, token::MOD_SEP);
|
expect(p, token::MOD_SEP);
|
||||||
} else {
|
} else {
|
||||||
|
ids += [parse_last_ident(p)];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -528,12 +536,7 @@ fn parse_path_without_tps(p: parser) -> @ast::path {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_value_path(p: parser) -> @ast::path {
|
fn parse_value_path(p: parser) -> @ast::path {
|
||||||
let pt = parse_path_without_tps(p);
|
parse_path_without_tps_(p, parse_ident, parse_value_ident)
|
||||||
let last_word = vec::last(pt.idents);
|
|
||||||
if is_restricted_keyword(p, last_word) {
|
|
||||||
p.fatal("found " + last_word + " in expression position");
|
|
||||||
}
|
|
||||||
pt
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_path_with_tps(p: parser, colons: bool) -> @ast::path {
|
fn parse_path_with_tps(p: parser, colons: bool) -> @ast::path {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue