diff options
| author | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2017-01-18 03:27:09 +0000 |
|---|---|---|
| committer | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2017-01-22 21:37:38 +0000 |
| commit | 2dc60b1180b2974b8966c33100e9541845e1d2e8 (patch) | |
| tree | 8d5ca1abc7811361e7528325010330143daba668 /src/libproc_macro_plugin/lib.rs | |
| parent | ec29011346ac91f2acdc0455ad6dc19a6f9614ca (diff) | |
| download | rust-2dc60b1180b2974b8966c33100e9541845e1d2e8.tar.gz rust-2dc60b1180b2974b8966c33100e9541845e1d2e8.zip | |
Refactor `TokenStream`.
Diffstat (limited to 'src/libproc_macro_plugin/lib.rs')
| -rw-r--r-- | src/libproc_macro_plugin/lib.rs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/libproc_macro_plugin/lib.rs b/src/libproc_macro_plugin/lib.rs index 9d8bb7fa0f5..e9042909576 100644 --- a/src/libproc_macro_plugin/lib.rs +++ b/src/libproc_macro_plugin/lib.rs @@ -15,11 +15,8 @@ //! ## Usage //! This crate provides the `qquote!` macro for syntax creation. //! -//! The `qquote!` macro imports `syntax::ext::proc_macro_shim::prelude::*`, so you -//! will need to `extern crate syntax` for usage. (This is a temporary solution until more -//! of the external API in libproc_macro_tokens is stabilized to support the token construction -//! operations that the qausiquoter relies on.) The shim file also provides additional -//! operations, such as `build_block_emitter` (as used in the `cond` example below). +//! The `qquote!` macro uses the crate `syntax`, so users must declare `extern crate syntax;` +//! at the crate root. This is a temporary solution until we have better hygiene. //! //! ## Quasiquotation //! @@ -88,19 +85,20 @@ extern crate rustc_plugin; extern crate syntax; -extern crate proc_macro_tokens; -#[macro_use] extern crate log; +extern crate syntax_pos; mod qquote; - use qquote::qquote; use rustc_plugin::Registry; +use syntax::ext::base::SyntaxExtension; +use syntax::symbol::Symbol; // ____________________________________________________________________________________________ // Main macro definition #[plugin_registrar] pub fn plugin_registrar(reg: &mut Registry) { - reg.register_macro("qquote", qquote); + reg.register_syntax_extension(Symbol::intern("qquote"), + SyntaxExtension::ProcMacro(Box::new(qquote))); } |
