about summary refs log tree commit diff
path: root/src/libhexfloat/lib.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-06-09 15:52:07 -0700
committerbors <bors@rust-lang.org>2014-06-09 15:52:07 -0700
commit0ea7aa30cc864d00fc30b9ba610f2daefab4e850 (patch)
tree2f3216efe5cc25851595c14d803dc69738030a72 /src/libhexfloat/lib.rs
parentb6146e652ae7f6d373d55dd021dc50cb00e0caf8 (diff)
parentdeecda6a94b31489045d420f16840a72c44af7e1 (diff)
downloadrust-0ea7aa30cc864d00fc30b9ba610f2daefab4e850.tar.gz
rust-0ea7aa30cc864d00fc30b9ba610f2daefab4e850.zip
auto merge of #14554 : kmcallister/rust/plugin_registrar, r=cmr
This implements the design in rust-lang/rfcs#86.  It shouldn't be merged until that RFC is accepted, but it would be great if somebody has time to review the code before then.
Diffstat (limited to 'src/libhexfloat/lib.rs')
-rw-r--r--src/libhexfloat/lib.rs20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/libhexfloat/lib.rs b/src/libhexfloat/lib.rs
index ee14f1aaea9..54bc2802b09 100644
--- a/src/libhexfloat/lib.rs
+++ b/src/libhexfloat/lib.rs
@@ -21,7 +21,7 @@ literal.
 To load the extension and use it:
 
 ```rust,ignore
-#[phase(syntax)]
+#[phase(plugin)]
 extern crate hexfloat;
 
 fn main() {
@@ -45,27 +45,23 @@ fn main() {
        html_root_url = "http://doc.rust-lang.org/")]
 
 #![deny(deprecated_owned_vector)]
-#![feature(macro_registrar, managed_boxes)]
+#![feature(plugin_registrar, managed_boxes)]
 
 extern crate syntax;
+extern crate rustc;
 
 use syntax::ast;
-use syntax::ast::Name;
 use syntax::codemap::{Span, mk_sp};
 use syntax::ext::base;
-use syntax::ext::base::{SyntaxExtension, BasicMacroExpander, NormalTT, ExtCtxt, MacExpr};
+use syntax::ext::base::{ExtCtxt, MacExpr};
 use syntax::ext::build::AstBuilder;
 use syntax::parse;
 use syntax::parse::token;
+use rustc::plugin::Registry;
 
-#[macro_registrar]
-pub fn macro_registrar(register: |Name, SyntaxExtension|) {
-    register(token::intern("hexfloat"),
-        NormalTT(box BasicMacroExpander {
-            expander: expand_syntax_ext,
-            span: None,
-        },
-        None));
+#[plugin_registrar]
+pub fn plugin_registrar(reg: &mut Registry) {
+    reg.register_macro("hexfloat", expand_syntax_ext);
 }
 
 //Check if the literal is valid (as LLVM expects),