Skip to content

Commit 6aba7be

Browse files
authored
Auto merge of rust-lang#34829 - cgswords:tstream, r=nrc
Added tokenstream parser procedure A tiny PR that simply adds a procedure for parsing `TokenStream`s to the parser in `src/libsyntax`. This is to ease using `TokenStream`s with the current (old) procedural macro system.
2 parents 7ed6068 + fecf3b6 commit 6aba7be

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/libsyntax/parse/mod.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,18 @@ pub fn filemap_to_parser<'a>(sess: &'a ParseSess,
228228
// compiler expands into it
229229
pub fn new_parser_from_tts<'a>(sess: &'a ParseSess,
230230
cfg: ast::CrateConfig,
231-
tts: Vec<tokenstream::TokenTree>) -> Parser<'a> {
231+
tts: Vec<tokenstream::TokenTree>)
232+
-> Parser<'a> {
232233
tts_to_parser(sess, tts, cfg)
233234
}
234235

236+
pub fn new_parser_from_ts<'a>(sess: &'a ParseSess,
237+
cfg: ast::CrateConfig,
238+
ts: tokenstream::TokenStream)
239+
-> Parser<'a> {
240+
tts_to_parser(sess, ts.tts, cfg)
241+
}
242+
235243

236244
// base abstractions
237245

0 commit comments

Comments
 (0)