diff options
| author | bors <bors@rust-lang.org> | 2016-08-16 16:35:10 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-08-16 16:35:10 -0700 |
| commit | 1bf5fa3269ba32ae21e349ac675bdedcc7e99a66 (patch) | |
| tree | a7e9ecbddb7b1661c5455da1edc9e5c2d94c1140 /src/libsyntax/tokenstream.rs | |
| parent | 514d4cef24a3a463d7423bd75d17335547c6a99c (diff) | |
| parent | 98c8e0a05dd7b1ecbbda28c1d01e05c1e41b1638 (diff) | |
| download | rust-1bf5fa3269ba32ae21e349ac675bdedcc7e99a66.tar.gz rust-1bf5fa3269ba32ae21e349ac675bdedcc7e99a66.zip | |
Auto merge of #35538 - cgswords:libproc_macro, r=nrc
Kicking off libproc_macro This PR introduces `libproc_macro`, which is currently quite bare-bones (just a few macro construction tools and an initial `quote!` macro). This PR also introduces a few test cases for it, and an additional `shim` file (at `src/libsyntax/ext/proc_macro_shim.rs` to allow a facsimile usage of Macros 2.0 *today*!
Diffstat (limited to 'src/libsyntax/tokenstream.rs')
| -rw-r--r-- | src/libsyntax/tokenstream.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libsyntax/tokenstream.rs b/src/libsyntax/tokenstream.rs index 0171f24101a..7b1df6f0e97 100644 --- a/src/libsyntax/tokenstream.rs +++ b/src/libsyntax/tokenstream.rs @@ -589,6 +589,12 @@ impl TokenStream { TokenStream::mk_leaf(Rc::new(trees), span) } + /// Convert a vector of Tokens into a TokenStream. + pub fn from_tokens(tokens: Vec<Token>) -> TokenStream { + // FIXME do something nicer with the spans + TokenStream::from_tts(tokens.into_iter().map(|t| TokenTree::Token(DUMMY_SP, t)).collect()) + } + /// Manually change a TokenStream's span. pub fn respan(self, span: Span) -> TokenStream { match self.ts { |
