added string_to_tts

This commit is contained in:
John Clements
2013-07-14 15:23:56 -04:00
parent 985a92ec12
commit e681e7843e

View File

@@ -22,6 +22,12 @@ pub fn string_to_tts_and_sess (source_str : @str) -> (~[ast::token_tree],@mut Pa
(filemap_to_tts(ps,string_to_filemap(ps,source_str,@"bogofile")),ps)
}
// map a string to tts, using a made-up filename:
pub fn string_to_tts(source_str : @str) -> ~[ast::token_tree] {
let (tts,_) = string_to_tts_and_sess(source_str);
tts
}
pub fn string_to_parser_and_sess(source_str: @str) -> (Parser,@mut ParseSess) {
let ps = new_parse_sess(None);
(new_parser_from_source_str(ps,~[],@"bogofile",source_str),ps)