From 0bd6371155d187ce8d8ad5c0a45ea344804f6813 Mon Sep 17 00:00:00 2001 From: Paul Stansifer Date: Tue, 31 Jul 2012 13:53:00 -0700 Subject: Now you can use whatever delimiter you want to invoke syntax extensions. --- src/libsyntax/parse/token.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/libsyntax/parse/token.rs') diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 372fff90c50..50eaa4d0632 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -225,6 +225,21 @@ pure fn can_begin_expr(t: token) -> bool { } } +/// what's the opposite delimiter? +fn flip_delimiter(&t: token::token) -> token::token { + alt t { + token::LPAREN { token::RPAREN } + token::LBRACE { token::RBRACE } + token::LBRACKET { token::RBRACKET } + token::RPAREN { token::LPAREN } + token::RBRACE { token::LBRACE } + token::RBRACKET { token::LBRACKET } + _ { fail } + } +} + + + fn is_lit(t: token) -> bool { alt t { LIT_INT(_, _) { true } -- cgit 1.4.1-3-g733a5