compare macro tokens hygienically (commented out)
This commit is contained in:
parent
9ec1623d57
commit
72ee6af4d4
2 changed files with 19 additions and 2 deletions
|
@ -234,6 +234,19 @@ pub fn parse_or_else(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// temporary for testing
|
||||||
|
pub fn token_name_eq(t1 : &Token, t2 : &Token) -> bool {
|
||||||
|
if (*t1 == *t2) {
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
match (t1,t2) {
|
||||||
|
(&token::IDENT(id1,_),&token::IDENT(id2,_)) =>
|
||||||
|
id1.name == id2.name,
|
||||||
|
_ => false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn parse(
|
pub fn parse(
|
||||||
sess: @mut ParseSess,
|
sess: @mut ParseSess,
|
||||||
cfg: ast::CrateConfig,
|
cfg: ast::CrateConfig,
|
||||||
|
@ -343,7 +356,8 @@ pub fn parse(
|
||||||
match_nonterminal(_,_,_) => { bb_eis.push(ei) }
|
match_nonterminal(_,_,_) => { bb_eis.push(ei) }
|
||||||
match_tok(ref t) => {
|
match_tok(ref t) => {
|
||||||
let mut ei_t = ei.clone();
|
let mut ei_t = ei.clone();
|
||||||
if (*t) == tok {
|
if (token_name_eq(t,&tok)) {
|
||||||
|
//if (token::mtwt_token_eq(t,&tok)) {
|
||||||
ei_t.idx += 1;
|
ei_t.idx += 1;
|
||||||
next_eis.push(ei_t);
|
next_eis.push(ei_t);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3518,7 +3518,10 @@ impl Parser {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_self_ident(&self) -> bool {
|
fn is_self_ident(&self) -> bool {
|
||||||
*self.token == token::IDENT(special_idents::self_, false)
|
match *self.token {
|
||||||
|
token::IDENT(id, false) => id.name == special_idents::self_.name,
|
||||||
|
_ => false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn expect_self_ident(&self) {
|
fn expect_self_ident(&self) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue