diff options
| author | John Clements <clements@racket-lang.org> | 2013-07-14 15:23:56 -0400 |
|---|---|---|
| committer | John Clements <clements@racket-lang.org> | 2013-09-06 13:35:13 -0700 |
| commit | e681e7843e6da4348648dcbdf11a633828c1b1a9 (patch) | |
| tree | 2be738d558af41a3a6a370ad8cde5067d7861665 | |
| parent | 985a92ec123ff05a361bde6af4602282e3851d77 (diff) | |
| download | rust-e681e7843e6da4348648dcbdf11a633828c1b1a9.tar.gz rust-e681e7843e6da4348648dcbdf11a633828c1b1a9.zip | |
added string_to_tts
| -rw-r--r-- | src/libsyntax/util/parser_testing.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libsyntax/util/parser_testing.rs b/src/libsyntax/util/parser_testing.rs index 51fd5be71ab..23396c06a9a 100644 --- a/src/libsyntax/util/parser_testing.rs +++ b/src/libsyntax/util/parser_testing.rs @@ -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) |
