parser: More refactoring of restricted value name checking
This commit is contained in:
parent
21dc41649b
commit
5eca3c2210
6 changed files with 17 additions and 14 deletions
|
@ -95,14 +95,18 @@ fn check_restricted_keywords(p: parser) {
|
|||
alt p.token {
|
||||
token::IDENT(_, false) {
|
||||
let w = token_to_str(p.reader, p.token);
|
||||
if is_restricted_keyword(p, w) {
|
||||
p.fatal("found `" + w + "` in expression position");
|
||||
}
|
||||
check_restricted_keywords_(p, w);
|
||||
}
|
||||
_ { }
|
||||
}
|
||||
}
|
||||
|
||||
fn check_restricted_keywords_(p: parser, w: ast::ident) {
|
||||
if is_restricted_keyword(p, w) {
|
||||
p.fatal("found `" + w + "` in restricted position");
|
||||
}
|
||||
}
|
||||
|
||||
fn expect_gt(p: parser) {
|
||||
if p.token == token::GT {
|
||||
p.bump();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue