Skip to content

macros: improve the TokenStream quoter - #40532

Merged
bors merged 1 commit into
rust-lang:masterfrom
jseyfried:improve_tokenstream_quoter
Mar 20, 2017
Merged

macros: improve the TokenStream quoter#40532
bors merged 1 commit into
rust-lang:masterfrom
jseyfried:improve_tokenstream_quoter

Conversation

@jseyfried

@jseyfriedjseyfried commented Mar 14, 2017

Copy link
Copy Markdown
Contributor

This PR

  • renames the TokenStream quoter from qquote! to quote!,
  • uses $ instead of unquote (e.g. let toks: TokenStream = ...; quote!([$toks])),
  • allows unquoting Tokens as well as TokenTrees and TokenStreams (fixestoken quote should be able to unquote a single token #39746), and
  • to preserve syntactic space, requires that $ be followed by
    • a single identifier to unquote, or
    • another $ to produce a literal $.

r? @nrc

@jseyfriedjseyfried changed the title Improve the TokenStream quoter.macros: improve the TokenStream quoterMar 14, 2017
nrc
nrc approved these changes Mar 15, 2017

@nrcnrc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any clash between this quote! macro and the AST quote! macro? I don't recall if that is magically in the global namespace or anything.

r=me if not and with the $$ doc

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you document this in the doc comments for the quote module please?

@jseyfriedjseyfriedMar 15, 2017

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@jseyfried

Copy link
Copy Markdown
ContributorAuthor

@nrc None of the AST quoters are named quote.

@jseyfried
jseyfriedforce-pushed the improve_tokenstream_quoter branch from 0769c60 to ce616a7CompareMarch 15, 2017 23:05
@jseyfried

Copy link
Copy Markdown
ContributorAuthor

@bors r=nrc

@bors

bors commented Mar 15, 2017

Copy link
Copy Markdown
Collaborator

📌 Commit ce616a7 has been approved by nrc

frewsxcv added a commit to frewsxcv/rust that referenced this pull request Mar 17, 2017
…r, r=nrc
macros: improve the `TokenStream` quoter
This PR
- renames the `TokenStream` quoter from `qquote!` to `quote!`,
- uses `$` instead of `unquote` (e.g. `let toks: TokenStream = ...; quote!([$toks])`),
- allows unquoting `Token`s as well as `TokenTree`s and `TokenStream`s (fixesrust-lang#39746), and
- to preserve syntactic space, requires that `$` be followed by
- a single identifier to unquote, or
- another `$` to produce a literal `$`.
r? @nrc
@frewsxcvfrewsxcv mentioned this pull request Mar 17, 2017
arielb1 pushed a commit to arielb1/rust that referenced this pull request Mar 18, 2017
…r, r=nrc
macros: improve the `TokenStream` quoter
This PR
- renames the `TokenStream` quoter from `qquote!` to `quote!`,
- uses `$` instead of `unquote` (e.g. `let toks: TokenStream = ...; quote!([$toks])`),
- allows unquoting `Token`s as well as `TokenTree`s and `TokenStream`s (fixesrust-lang#39746), and
- to preserve syntactic space, requires that `$` be followed by
- a single identifier to unquote, or
- another `$` to produce a literal `$`.
r? @nrc
@arielb1arielb1 mentioned this pull request Mar 18, 2017
bors added a commit that referenced this pull request Mar 18, 2017
@arielb1arielb1 mentioned this pull request Mar 19, 2017
arielb1 pushed a commit to arielb1/rust that referenced this pull request Mar 19, 2017
…r, r=nrc
macros: improve the `TokenStream` quoter
This PR
- renames the `TokenStream` quoter from `qquote!` to `quote!`,
- uses `$` instead of `unquote` (e.g. `let toks: TokenStream = ...; quote!([$toks])`),
- allows unquoting `Token`s as well as `TokenTree`s and `TokenStream`s (fixesrust-lang#39746), and
- to preserve syntactic space, requires that `$` be followed by
- a single identifier to unquote, or
- another `$` to produce a literal `$`.
r? @nrc
@frewsxcvfrewsxcv mentioned this pull request Mar 19, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Mar 20, 2017
…r, r=nrc
macros: improve the `TokenStream` quoter
This PR
- renames the `TokenStream` quoter from `qquote!` to `quote!`,
- uses `$` instead of `unquote` (e.g. `let toks: TokenStream = ...; quote!([$toks])`),
- allows unquoting `Token`s as well as `TokenTree`s and `TokenStream`s (fixesrust-lang#39746), and
- to preserve syntactic space, requires that `$` be followed by
- a single identifier to unquote, or
- another `$` to produce a literal `$`.
r? @nrc
@frewsxcvfrewsxcv mentioned this pull request Mar 20, 2017
bors added a commit that referenced this pull request Mar 20, 2017
Rollup of 9 pull requests
- Successful merges: #40241, #40281, #40398, #40521, #40532, #40554, #40566, #40581, #40587
- Failed merges:
@bors
bors merged commit ce616a7 into rust-lang:masterMar 20, 2017
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

token quote should be able to unquote a single token

3 participants

@jseyfried@bors@nrc