1
Fork 0

parser: More refactoring of restricted value name checking

This commit is contained in:
Brian Anderson 2012-04-27 15:44:40 -07:00
parent 21dc41649b
commit 5eca3c2210
6 changed files with 17 additions and 14 deletions

View file

@ -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();