diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2016-10-21 20:55:39 +1300 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2016-10-28 12:17:17 +1300 |
| commit | 15821caee9b6f6eecbf8e405c7ee3d6278b932ca (patch) | |
| tree | 982c57daf203891b28b7f8a741025094fb2fb9e7 /src/libproc_macro_plugin/lib.rs | |
| parent | 3a25b65c1fbdd6101b77e8a8b06a5e42d775dc3f (diff) | |
| download | rust-15821caee9b6f6eecbf8e405c7ee3d6278b932ca.tar.gz rust-15821caee9b6f6eecbf8e405c7ee3d6278b932ca.zip | |
Split up libproc_macro_plugin
Separate the plugin code from non-plugin code to break a potential cycle in crates. This will allow us to merge the new libproc_macro_tokens into libproc_macro.
Diffstat (limited to 'src/libproc_macro_plugin/lib.rs')
| -rw-r--r-- | src/libproc_macro_plugin/lib.rs | 42 |
1 files changed, 6 insertions, 36 deletions
diff --git a/src/libproc_macro_plugin/lib.rs b/src/libproc_macro_plugin/lib.rs index e82e97b5134..c45762bfb6e 100644 --- a/src/libproc_macro_plugin/lib.rs +++ b/src/libproc_macro_plugin/lib.rs @@ -13,43 +13,14 @@ //! A library for procedural macro writers. //! //! ## Usage -//! This package provides the `qquote!` macro for syntax creation, and the prelude -//! (at libproc_macro::prelude) provides a number of operations: -//! - `concat`, for concatenating two TokenStreams. -//! - `ident_eq`, for checking if two identifiers are equal regardless of syntax context. -//! - `str_to_token_ident`, for converting an `&str` into a Token. -//! - `keyword_to_token_delim`, for converting a `parse::token::keywords::Keyword` into a -//! Token. -//! - `build_delimited`, for creating a new TokenStream from an existing one and a delimiter -//! by wrapping the TokenStream in the delimiter. -//! - `build_bracket_delimited`, `build_brace_delimited`, and `build_paren_delimited`, for -//! easing the above. -//! - `build_empty_args`, which returns a TokenStream containing `()`. -//! - `lex`, which takes an `&str` and returns the TokenStream it represents. -//! -//! The `qquote!` macro also imports `syntax::ext::proc_macro_shim::prelude::*`, so you +//! 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 is stabilized to support the token construction +//! 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). //! -//! ## TokenStreams -//! -//! TokenStreams serve as the basis of the macro system. They are, in essence, vectors of -//! TokenTrees, where indexing treats delimited values as a single term. That is, the term -//! `even(a+c) && even(b)` will be indexibly encoded as `even | (a+c) | even | (b)` where, -//! in reality, `(a+c)` is actually a decorated pointer to `a | + | c`. -//! -//! If a user has a TokenStream that is a single, delimited value, they can use -//! `maybe_delimited` to destruct it and receive the internal vector as a new TokenStream -//! as: -//! ``` -//! `(a+c)`.maybe_delimited() ~> Some(a | + | c)` -//! ``` -//! -//! Check the TokenStream documentation for more information; the structure also provides -//! cheap concatenation and slicing. -//! //! ## Quasiquotation //! //! The quasiquoter creates output that, when run, constructs the tokenstream specified as @@ -118,12 +89,11 @@ extern crate rustc_plugin; extern crate syntax; extern crate syntax_pos; +extern crate proc_macro_tokens; #[macro_use] extern crate log; mod qquote; -pub mod build; -pub mod parse; -pub mod prelude; + use qquote::qquote; use rustc_plugin::Registry; |
