diff options
| author | John Clements <clements@racket-lang.org> | 2013-09-05 14:15:00 -0700 |
|---|---|---|
| committer | John Clements <clements@racket-lang.org> | 2013-09-06 13:35:11 -0700 |
| commit | 0954e66442a169be40f1e65de68a85d7e3dacf3a (patch) | |
| tree | 51d8968d8eb83931f7be39c61ca130e91d128c06 /src/libsyntax/parse | |
| parent | d9ba61c786f94ff86339fe83136061657a4c19f9 (diff) | |
| download | rust-0954e66442a169be40f1e65de68a85d7e3dacf3a.tar.gz rust-0954e66442a169be40f1e65de68a85d7e3dacf3a.zip | |
uncomment mtwt_resolve calls
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/token.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 311d498eec2..39e0f85920c 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -720,6 +720,15 @@ pub fn is_reserved_keyword(tok: &Token) -> bool { } } +pub fn mtwt_token_eq(t1 : &Token, t2 : &Token) -> bool { + match (t1,t2) { + (&IDENT(id1,_),&IDENT(id2,_)) => + ast_util::mtwt_resolve(id1) == ast_util::mtwt_resolve(id2), + _ => *t1 == *t2 + } +} + + #[cfg(test)] mod test { use super::*; @@ -728,6 +737,17 @@ mod test { use ast; use ast_util; + fn mark_ident(id : ast::ident, m : ast::Mrk) -> ast::ident { + ast::ident{name:id.name,ctxt:ast_util::new_mark(m,id.ctxt)} + } + + #[test] fn mtwt_token_eq_test() { + assert!(mtwt_token_eq(>,>)); + let a = str_to_ident("bac"); + let a1 = mark_ident(a,92); + assert!(mtwt_token_eq(&IDENT(a,true),&IDENT(a1,false))); + } + #[test] fn str_ptr_eq_tests(){ let a = @"abc"; |
