Skip to content

Conversation

@edwin0cheng
Copy link
Contributor

@edwin0cheng edwin0cheng commented Mar 8, 2020

This PR introduce a function for parsing &str to tt::TokenTree:

// Convert a string to a `TokenTree`
pub fn parse_to_token_tree(text: &str) -> Option<(tt::Subtree, TokenMap)> {

@edwin0cheng edwin0cheng requested a review from matklad March 8, 2020 16:16
@matklad
Copy link
Contributor

matklad commented Mar 9, 2020

Hm, I am somewhat unhappy about the duplication of logic here.... In rustc, all parsing happens through the syntax trees, so you get a nice syntax pipeline.

We parse either from token trees or from text, and those two modes are different, and require explicit bridging between them. And include! case becomes kind of silly, because it seems like you should use "parse text" mode, but, because it is a macro, you have to interface with it via token trees.... Not sure if there's a good solution here....

bors r+

@bors
Copy link
Contributor

bors bot commented Mar 9, 2020

@bors bors bot merged commit 0363c94 into rust-lang:master Mar 9, 2020
@edwin0cheng edwin0cheng deleted the parse_to_token_tree branch March 10, 2020 03:24
Sign up for free to 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.

2 participants