Pull file reading out of the lexer

This commit is contained in:
Brian Anderson
2011-07-11 16:43:51 -07:00
parent 05390b4b38
commit 08f8753d80
2 changed files with 11 additions and 10 deletions

View File

@@ -113,10 +113,11 @@ fn new_parser(parse_sess sess, ast::crate_cfg cfg,
auto ftype = SOURCE_FILE;
if (str::ends_with(path, ".rc")) { ftype = CRATE_FILE; }
auto srdr = io::file_reader(path);
auto src = str::unsafe_from_bytes(srdr.read_whole_stream());
auto filemap = codemap::new_filemap(path, pos);
vec::push(sess.cm.files, filemap);
auto itr = @interner::mk(str::hash, str::eq);
auto rdr = lexer::new_reader(sess.cm, srdr, filemap, itr);
auto rdr = lexer::new_reader(sess.cm, src, filemap, itr);
// Make sure npos points at first actual token:
lexer::consume_whitespace_and_comments(rdr);