-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
syntax: integrate TokenStream
#40202
Conversation
cc #38356 |
let ps = ParseSess::new(); | ||
filemap_to_tts(&ps, ps.codemap().new_filemap("bogofile".to_string(), None, source_str)) | ||
filemap_to_stream(&ps, ps.codemap().new_filemap("bogofile".to_string(), None, source_str)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this filename appear anywhere? If so, it might be a good idea to use something more meaningful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No -- this is only used in internal unit tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me with the renaming and comments
src/libsyntax/parse/parser.rs
Outdated
@@ -175,12 +175,107 @@ pub struct Parser<'a> { | |||
/// into modules, and sub-parsers have new values for this name. | |||
pub root_module_name: Option<String>, | |||
pub expected_tokens: Vec<TokenType>, | |||
pub tts: Vec<(TokenTree, usize)>, | |||
cursor: Cursor, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: as a field name this is a bit uninformative, it would be good to have an indication of what this is a cursor over
src/libsyntax/parse/parser.rs
Outdated
pub desugar_doc_comments: bool, | ||
/// Whether we should configure out of line modules as we parse. | ||
pub cfg_mods: bool, | ||
} | ||
|
||
struct Cursor { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could also have a more informative name I think - TokenCursor or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, TokenCursor
sounds good.
src/libsyntax/tokenstream.rs
Outdated
@@ -396,6 +328,33 @@ impl Cursor { | |||
} | |||
} | |||
|
|||
#[derive(Debug, Clone)] | |||
pub struct ThinTokenStream(Option<RcSlice<TokenStream>>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to have a comment describing what this is and where it should be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do.
710e2c0
to
0d55413
Compare
@bors r=nrc |
📌 Commit 0d55413 has been approved by |
⌛ Testing commit 0d55413 with merge bd77267... |
💔 Test failed - status-travis |
… On Fri, Mar 3, 2017 at 10:42 AM, bors ***@***.***> wrote:
💔 Test failed - status-travis
<https://travis-ci.org/rust-lang/rust/builds/207395476>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#40202 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAD95HsVqlNIFbFoMQNsXeVSo2E3mZA0ks5riELfgaJpZM4MQnRr>
.
|
syntax: integrate `TokenStream` Use `TokenStream` instead of `Vec<TokenTree>` in `TokenTree::Delimited` and elsewhere. r? @nrc
☀️ Test successful - status-appveyor, status-travis |
Use
TokenStream
instead ofVec<TokenTree>
inTokenTree::Delimited
and elsewhere.r? @nrc