diff options
| author | John Clements <clements@racket-lang.org> | 2013-09-05 14:14:31 -0700 |
|---|---|---|
| committer | John Clements <clements@racket-lang.org> | 2013-09-06 13:35:06 -0700 |
| commit | 72ee6af4d4e4d16a81e3f518f9c75f513a9a7dea (patch) | |
| tree | f3511f227d1918b82abc721f8bb8598199361f1c /src/libsyntax | |
| parent | 9ec1623d57f48b02ca1c96930f5ee6fdc7d2c609 (diff) | |
| download | rust-72ee6af4d4e4d16a81e3f518f9c75f513a9a7dea.tar.gz rust-72ee6af4d4e4d16a81e3f518f9c75f513a9a7dea.zip | |
compare macro tokens hygienically (commented out)
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 16 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 5 |
2 files changed, 19 insertions, 2 deletions
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 7a9e916421c..f859a656d1f 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -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( sess: @mut ParseSess, cfg: ast::CrateConfig, @@ -343,7 +356,8 @@ pub fn parse( match_nonterminal(_,_,_) => { bb_eis.push(ei) } match_tok(ref t) => { 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; next_eis.push(ei_t); } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 51c5522ae2f..62abe3850c9 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3518,7 +3518,10 @@ impl Parser { } 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) { |
