about summary refs log tree commit diff
path: root/src/libsyntax/util/parser_testing.rs
diff options
context:
space:
mode:
authorJohn Clements <clements@racket-lang.org>2013-06-04 12:34:25 -0700
committerJohn Clements <clements@racket-lang.org>2013-06-05 12:01:38 -0700
commit320359547126b1a317d49ed68102d1b6e8be5ca2 (patch)
tree0acad4ebe7ddec98ed996a9603098533da2f9bfb /src/libsyntax/util/parser_testing.rs
parentae02bf70e01f48dc00b82620ff121eedc9e7db7c (diff)
downloadrust-320359547126b1a317d49ed68102d1b6e8be5ca2.tar.gz
rust-320359547126b1a317d49ed68102d1b6e8be5ca2.zip
interner just uses uints, not idents with syntax context
Diffstat (limited to 'src/libsyntax/util/parser_testing.rs')
-rw-r--r--src/libsyntax/util/parser_testing.rs18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/libsyntax/util/parser_testing.rs b/src/libsyntax/util/parser_testing.rs
index 1c2210c96b6..2b74ef7fbea 100644
--- a/src/libsyntax/util/parser_testing.rs
+++ b/src/libsyntax/util/parser_testing.rs
@@ -10,11 +10,11 @@
 
 use core::option::{Option,None};
 use ast;
-use parse::parser::Parser;
 use parse::{new_parse_sess};
-
-use syntax::parse::{ParseSess,string_to_filemap,filemap_to_tts};
-use syntax::parse::{new_parser_from_source_str};
+use parse::{ParseSess,string_to_filemap,filemap_to_tts};
+use parse::{new_parser_from_source_str};
+use parse::parser::Parser;
+use parse::token;
 
 // map a string to tts, using a made-up filename: return both the token_trees
 // and the ParseSess
@@ -58,3 +58,13 @@ pub fn string_to_stmt (source_str : @~str) -> @ast::stmt {
     string_to_parser(source_str).parse_stmt(~[])
 }
 
+// parse a string, return a pat. Uses "irrefutable"... which doesn't
+// (currently) affect parsing.
+pub fn string_to_pat(source_str : @~str) -> @ast::pat {
+    string_to_parser(source_str).parse_pat()
+}
+
+// convert a vector of strings to a vector of ast::idents
+pub fn strs_to_idents(ids: ~[&str]) -> ~[ast::ident] {
+    ids.map(|u| token::str_to_ident(*u))
+}