interner just uses uints, not idents with syntax context

This commit is contained in:
John Clements
2013-06-04 12:34:25 -07:00
parent ae02bf70e0
commit 3203595471
32 changed files with 225 additions and 201 deletions

View File

@@ -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))
}