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/ext/tt/macro_parser.rs | |
| parent | 9ec1623d57f48b02ca1c96930f5ee6fdc7d2c609 (diff) | |
| download | rust-72ee6af4d4e4d16a81e3f518f9c75f513a9a7dea.tar.gz rust-72ee6af4d4e4d16a81e3f518f9c75f513a9a7dea.zip | |
compare macro tokens hygienically (commented out)
Diffstat (limited to 'src/libsyntax/ext/tt/macro_parser.rs')
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 16 |
1 files changed, 15 insertions, 1 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); } |
