summary refs log tree commit diff
path: root/src/libsyntax/parse/token.rs
diff options
context:
space:
mode:
authorPaul Stansifer <paul.stansifer@gmail.com>2012-07-31 13:53:00 -0700
committerPaul Stansifer <paul.stansifer@gmail.com>2012-07-31 14:07:59 -0700
commit0bd6371155d187ce8d8ad5c0a45ea344804f6813 (patch)
treec288b2de08704257d34c5bc416e902ae6ffd830f /src/libsyntax/parse/token.rs
parent8e7fb8e8f5c7175bb18e38c266de3ccce16189bb (diff)
downloadrust-0bd6371155d187ce8d8ad5c0a45ea344804f6813.tar.gz
rust-0bd6371155d187ce8d8ad5c0a45ea344804f6813.zip
Now you can use whatever delimiter you want to invoke syntax extensions.
Diffstat (limited to 'src/libsyntax/parse/token.rs')
-rw-r--r--src/libsyntax/parse/token.rs15
1 files changed, 15 insertions, 0 deletions
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 }