diff options
Diffstat (limited to 'src/libsyntax/parse.rs')
| -rw-r--r-- | src/libsyntax/parse.rs | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/libsyntax/parse.rs b/src/libsyntax/parse.rs index 7ccc9c5a438..9d56754e5d4 100644 --- a/src/libsyntax/parse.rs +++ b/src/libsyntax/parse.rs @@ -25,7 +25,7 @@ type parse_sess = @{ cm: codemap::codemap, mut next_id: node_id, span_diagnostic: span_handler, - interner: @interner::interner<@str/~>, + interner: @interner::interner<@~str>, // these two must be kept up to date mut chpos: uint, mut byte_pos: uint @@ -36,7 +36,7 @@ fn new_parse_sess(demitter: option<emitter>) -> parse_sess { ret @{cm: cm, mut next_id: 1, span_diagnostic: mk_span_handler(mk_handler(demitter), cm), - interner: @interner::mk::<@str/~>(|x| str::hash(*x), + interner: @interner::mk::<@~str>(|x| str::hash(*x), |x,y| str::eq(*x, *y)), mut chpos: 0u, mut byte_pos: 0u}; } @@ -46,24 +46,24 @@ fn new_parse_sess_special_handler(sh: span_handler, cm: codemap::codemap) ret @{cm: cm, mut next_id: 1, span_diagnostic: sh, - interner: @interner::mk::<@str/~>(|x| str::hash(*x), + interner: @interner::mk::<@~str>(|x| str::hash(*x), |x,y| str::eq(*x, *y)), mut chpos: 0u, mut byte_pos: 0u}; } -fn parse_crate_from_file(input: str, cfg: ast::crate_cfg, sess: parse_sess) -> - @ast::crate { - if str::ends_with(input, ".rc") { +fn parse_crate_from_file(input: ~str, cfg: ast::crate_cfg, + sess: parse_sess) -> @ast::crate { + if str::ends_with(input, ~".rc") { parse_crate_from_crate_file(input, cfg, sess) - } else if str::ends_with(input, ".rs") { + } else if str::ends_with(input, ~".rs") { parse_crate_from_source_file(input, cfg, sess) } else { - sess.span_diagnostic.handler().fatal("unknown input file type: " + + sess.span_diagnostic.handler().fatal(~"unknown input file type: " + input) } } -fn parse_crate_from_crate_file(input: str, cfg: ast::crate_cfg, +fn parse_crate_from_crate_file(input: ~str, cfg: ast::crate_cfg, sess: parse_sess) -> @ast::crate { let (p, rdr) = new_parser_etc_from_file(sess, cfg, input, parser::CRATE_FILE); @@ -87,7 +87,7 @@ fn parse_crate_from_crate_file(input: str, cfg: ast::crate_cfg, config: /* FIXME (#2543) */ copy p.cfg}); } -fn parse_crate_from_source_file(input: str, cfg: ast::crate_cfg, +fn parse_crate_from_source_file(input: ~str, cfg: ast::crate_cfg, sess: parse_sess) -> @ast::crate { let (p, rdr) = new_parser_etc_from_file(sess, cfg, input, parser::SOURCE_FILE); @@ -97,7 +97,7 @@ fn parse_crate_from_source_file(input: str, cfg: ast::crate_cfg, ret r; } -fn parse_crate_from_source_str(name: str, source: @str/~, cfg: ast::crate_cfg, +fn parse_crate_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg, sess: parse_sess) -> @ast::crate { let (p, rdr) = new_parser_etc_from_source_str(sess, cfg, name, codemap::fss_none, source); @@ -107,7 +107,7 @@ fn parse_crate_from_source_str(name: str, source: @str/~, cfg: ast::crate_cfg, ret r; } -fn parse_expr_from_source_str(name: str, source: @str/~, cfg: ast::crate_cfg, +fn parse_expr_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg, sess: parse_sess) -> @ast::expr { let (p, rdr) = new_parser_etc_from_source_str(sess, cfg, name, codemap::fss_none, source); @@ -117,7 +117,7 @@ fn parse_expr_from_source_str(name: str, source: @str/~, cfg: ast::crate_cfg, ret r; } -fn parse_item_from_source_str(name: str, source: @str/~, cfg: ast::crate_cfg, +fn parse_item_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg, +attrs: ~[ast::attribute], vis: ast::visibility, sess: parse_sess) -> option<@ast::item> { @@ -130,8 +130,8 @@ fn parse_item_from_source_str(name: str, source: @str/~, cfg: ast::crate_cfg, } fn parse_from_source_str<T>(f: fn (p: parser) -> T, - name: str, ss: codemap::file_substr, - source: @str/~, cfg: ast::crate_cfg, + name: ~str, ss: codemap::file_substr, + source: @~str, cfg: ast::crate_cfg, sess: parse_sess) -> T { @@ -139,7 +139,7 @@ fn parse_from_source_str<T>(f: fn (p: parser) -> T, source); let r = f(p); if !p.reader.is_eof() { - p.reader.fatal("expected end-of-string"); + p.reader.fatal(~"expected end-of-string"); } sess.chpos = rdr.chpos; sess.byte_pos = sess.byte_pos + rdr.pos; @@ -155,8 +155,8 @@ fn next_node_id(sess: parse_sess) -> node_id { } fn new_parser_etc_from_source_str(sess: parse_sess, cfg: ast::crate_cfg, - +name: str, +ss: codemap::file_substr, - source: @str/~) -> (parser, string_reader) { + +name: ~str, +ss: codemap::file_substr, + source: @~str) -> (parser, string_reader) { let ftype = parser::SOURCE_FILE; let filemap = codemap::new_filemap_w_substr (name, ss, source, sess.chpos, sess.byte_pos); @@ -167,15 +167,15 @@ fn new_parser_etc_from_source_str(sess: parse_sess, cfg: ast::crate_cfg, } fn new_parser_from_source_str(sess: parse_sess, cfg: ast::crate_cfg, - +name: str, +ss: codemap::file_substr, - source: @str/~) -> parser { + +name: ~str, +ss: codemap::file_substr, + source: @~str) -> parser { let (p, _) = new_parser_etc_from_source_str(sess, cfg, name, ss, source); ret p; } -fn new_parser_etc_from_file(sess: parse_sess, cfg: ast::crate_cfg, +path: str, - ftype: parser::file_type) -> +fn new_parser_etc_from_file(sess: parse_sess, cfg: ast::crate_cfg, + +path: ~str, ftype: parser::file_type) -> (parser, string_reader) { let res = io::read_whole_file_str(path); alt res { @@ -190,7 +190,7 @@ fn new_parser_etc_from_file(sess: parse_sess, cfg: ast::crate_cfg, +path: str, ret (parser(sess, cfg, srdr as reader, ftype), srdr); } -fn new_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, +path: str, +fn new_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, +path: ~str, ftype: parser::file_type) -> parser { let (p, _) = new_parser_etc_from_file(sess, cfg, path, ftype); ret p; |
