diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-01-08 19:29:16 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-01-08 19:29:16 -0800 |
| commit | 44ab00ee37c4ffb8440ff20fd8a15cd24a6f3e46 (patch) | |
| tree | 83f3d67a9e21c6ce1b99c2ce8f6a737896c673db /src/libsyntax | |
| parent | a8d37af2473da79be704c9ce2374f278c47177b6 (diff) | |
| download | rust-44ab00ee37c4ffb8440ff20fd8a15cd24a6f3e46.tar.gz rust-44ab00ee37c4ffb8440ff20fd8a15cd24a6f3e46.zip | |
Revert "librustc: Make unqualified identifier searches terminate at the nearest module scope. r=tjc"
This reverts commit a8d37af2473da79be704c9ce2374f278c47177b6.
Diffstat (limited to 'src/libsyntax')
39 files changed, 106 insertions, 206 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 42e722f8d53..c7c8c77c70f 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -12,10 +12,10 @@ use ast; use codemap::{span, FileName}; +use parse::token; use core::cast; use core::cmp; -use core::option::{None, Option, Some}; use core::ptr; use core::task; use core::to_bytes; @@ -29,8 +29,7 @@ type spanned<T> = {node: T, span: span}; /* can't import macros yet, so this is copied from token.rs. See its comment * there. */ macro_rules! interner_key ( - () => (cast::transmute::<(uint, uint), - &fn(+v: @@::parse::token::ident_interner)>( + () => (cast::transmute::<(uint, uint), &fn(+v: @@token::ident_interner)>( (-3 as uint, 0u))) ) @@ -769,10 +768,10 @@ type capture_clause = @~[capture_item]; #[auto_decode] #[doc="For macro invocations; parsing is delegated to the macro"] enum token_tree { - tt_tok(span, ::parse::token::Token), + tt_tok(span, token::Token), tt_delim(~[token_tree]), // These only make sense for right-hand-sides of MBE macros - tt_seq(span, ~[token_tree], Option<::parse::token::Token>, bool), + tt_seq(span, ~[token_tree], Option<token::Token>, bool), tt_nonterminal(span, ident) } @@ -834,10 +833,10 @@ type matcher = spanned<matcher_>; #[auto_decode] enum matcher_ { // match one token - match_tok(::parse::token::Token), + match_tok(token::Token), // match repetitions of a sequence: body, separator, zero ok?, // lo, hi position-in-match-array used: - match_seq(~[matcher], Option<::parse::token::Token>, bool, uint, uint), + match_seq(~[matcher], Option<token::Token>, bool, uint, uint), // parse a Rust NT: name to bind, name of NT, position in match array: match_nonterminal(ident, ident, uint) } @@ -1150,7 +1149,7 @@ type fn_decl = #[auto_encode] #[auto_decode] -pub enum purity { +enum purity { pure_fn, // declared with "pure fn" unsafe_fn, // declared with "unsafe fn" impure_fn, // declared with "fn" diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index f56f0c545bf..f35d8c4e1c4 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use core::prelude::*; - use ast::*; use ast; use ast_util::{path_to_ident, stmt_id}; diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 3cab2151fde..eaa61b304cd 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -8,13 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use core::prelude::*; - use ast::*; use ast; use ast_util; use codemap::{span, BytePos}; -use parse::token; use visit; use core::cmp; diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index 985e0951794..73c14e2d00c 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -10,8 +10,6 @@ // Functions dealing with attributes and meta_items -use core::prelude::*; - use ast; use ast_util::{spanned, dummy_spanned}; use attr; diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 1e4a40405fd..1f26711abb9 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -21,8 +21,6 @@ source code snippets, etc. */ -use core::prelude::*; - use ast_util; use core::cmp; diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index 7e9d257a742..ddffa04622f 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use core::prelude::*; - use codemap::span; use codemap; diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs index 152c49461b8..b8fe00e246c 100644 --- a/src/libsyntax/ext/auto_encode.rs +++ b/src/libsyntax/ext/auto_encode.rs @@ -88,14 +88,10 @@ node twice. */ -use core::prelude::*; - -use ast; use ast_util; use attr; use codemap::span; use ext::base::*; -use parse; use core::vec; use std::map; @@ -425,7 +421,7 @@ fn mk_impl( @{ // This is a new-style impl declaration. // XXX: clownshoes - ident: parse::token::special_idents::clownshoes_extensions, + ident: ast::token::special_idents::clownshoes_extensions, attrs: ~[], id: cx.next_id(), node: ast::item_impl(trait_tps, opt_trait, ty, ~[f(ty)]), diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 7b69084a827..dc774805ed3 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use core::prelude::*; - use ast; use ast_util::dummy_sp; use codemap; diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 4a3c8ee2259..d63f14b5774 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use core::prelude::*; - use ast; use codemap; use codemap::span; diff --git a/src/libsyntax/ext/concat_idents.rs b/src/libsyntax/ext/concat_idents.rs index d847cfee053..4f88ffeeb04 100644 --- a/src/libsyntax/ext/concat_idents.rs +++ b/src/libsyntax/ext/concat_idents.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use core::prelude::*; - use ext::base::*; use ext::base; diff --git a/src/libsyntax/ext/deriving.rs b/src/libsyntax/ext/deriving.rs index 41804b1022a..3cbc8f3834f 100644 --- a/src/libsyntax/ext/deriving.rs +++ b/src/libsyntax/ext/deriving.rs @@ -11,8 +11,6 @@ /// The compiler code necessary to implement the #[deriving_eq] and /// #[deriving_iter_bytes] extensions. -use core::prelude::*; - use ast::{Ty, and, bind_by_ref, binop, deref, enum_def, enum_variant_kind}; use ast::{expr, expr_match, ident, item, item_, item_struct, item_enum}; use ast::{item_impl, m_imm, meta_item, method, named_field, or, pat}; diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 8faeb167191..27565b44c6d 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use core::prelude::*; - use ast::{crate, expr_, expr_mac, mac_invoc_tt}; use ast::{tt_delim, tt_tok, item_mac, stmt_, stmt_mac, stmt_expr, stmt_semi}; use ast; diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs index 0eaa983ccad..b8a27096f73 100644 --- a/src/libsyntax/ext/fmt.rs +++ b/src/libsyntax/ext/fmt.rs @@ -16,8 +16,6 @@ * compiler syntax extension plugin interface. */ -use core::prelude::*; - use ast; use codemap::span; use ext::base::*; diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs index 56ace4aac1b..7a87d909fe6 100644 --- a/src/libsyntax/ext/pipes/ast_builder.rs +++ b/src/libsyntax/ext/pipes/ast_builder.rs @@ -13,15 +13,13 @@ // To start with, it will be use dummy spans, but it might someday do // something smarter. -use core::prelude::*; - use ast::{ident, node_id}; use ast; use ast_util::{ident_to_path, respan, dummy_sp}; use ast_util; use attr; use codemap::span; -use ext::base::{ext_ctxt, mk_ctxt}; +use ext::base::mk_ctxt; use ext::quote::rt::*; use core::vec; @@ -114,11 +112,9 @@ trait ext_ctxt_ast_builder { impl ext_ctxt: ext_ctxt_ast_builder { fn ty_option(ty: @ast::Ty) -> @ast::Ty { - self.ty_path_ast_builder(path_global(~[ - self.ident_of(~"core"), - self.ident_of(~"option"), - self.ident_of(~"Option") - ], dummy_sp()).add_ty(ty)) + self.ty_path_ast_builder(path(~[self.ident_of(~"Option")], + dummy_sp()) + .add_ty(ty)) } fn block_expr(b: ast::blk) -> @ast::expr { @@ -287,37 +283,10 @@ impl ext_ctxt: ext_ctxt_ast_builder { fn item_mod(name: ident, span: span, +items: ~[@ast::item]) -> @ast::item { - // XXX: Total hack: import `core::kinds::Owned` to work around a - // parser bug whereby `fn f<T: ::kinds::Owned>` doesn't parse. - let vi = ast::view_item_import(~[ - @{ - node: ast::view_path_simple( - self.ident_of(~"Owned"), - path( - ~[ - self.ident_of(~"core"), - self.ident_of(~"kinds"), - self.ident_of(~"Owned") - ], - ast_util::dummy_sp() - ), - ast::type_value_ns, - self.next_id() - ), - span: ast_util::dummy_sp() - } - ]); - let vi = @{ - node: vi, - attrs: ~[], - vis: ast::private, - span: ast_util::dummy_sp() - }; - self.item(name, span, ast::item_mod({ - view_items: ~[vi], + view_items: ~[], items: items})) } diff --git a/src/libsyntax/ext/pipes/check.rs b/src/libsyntax/ext/pipes/check.rs index f2ba413dd38..8eecafa8fa4 100644 --- a/src/libsyntax/ext/pipes/check.rs +++ b/src/libsyntax/ext/pipes/check.rs @@ -29,10 +29,7 @@ that. */ -use core::prelude::*; - use ast; -use codemap::span; use ext::base::ext_ctxt; use ext::pipes::proto::{state, protocol, next_state}; use ext::pipes::proto; diff --git a/src/libsyntax/ext/pipes/liveness.rs b/src/libsyntax/ext/pipes/liveness.rs index 01e99594083..76749f6b2db 100644 --- a/src/libsyntax/ext/pipes/liveness.rs +++ b/src/libsyntax/ext/pipes/liveness.rs @@ -37,11 +37,6 @@ updating the states using rule (2) until there are no changes. */ -use core::prelude::*; - -use ext::base::ext_ctxt; -use ext::pipes::protocol; - use core::str; use std::bitv::{Bitv}; diff --git a/src/libsyntax/ext/pipes/mod.rs b/src/libsyntax/ext/pipes/mod.rs index cb17e56e990..67b5c81ad2d 100644 --- a/src/libsyntax/ext/pipes/mod.rs +++ b/src/libsyntax/ext/pipes/mod.rs @@ -53,8 +53,6 @@ use ext::pipes::proto::{visit, protocol}; use parse::lexer::{new_tt_reader, reader}; use parse::parser::Parser; -use core::option::None; - #[legacy_exports] mod ast_builder; #[legacy_exports] diff --git a/src/libsyntax/ext/pipes/parse_proto.rs b/src/libsyntax/ext/pipes/parse_proto.rs index 6a6e895bd40..0f6b9dbda28 100644 --- a/src/libsyntax/ext/pipes/parse_proto.rs +++ b/src/libsyntax/ext/pipes/parse_proto.rs @@ -10,11 +10,10 @@ // Parsing pipes protocols from token trees. -use ext::pipes::pipec::*; use parse::parser; use parse::token; -use core::prelude::*; +use ext::pipes::pipec::*; trait proto_parser { fn parse_proto(id: ~str) -> protocol; diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs index e88ddb841be..ef9c086e3f5 100644 --- a/src/libsyntax/ext/pipes/pipec.rs +++ b/src/libsyntax/ext/pipes/pipec.rs @@ -20,7 +20,6 @@ use parse::*; use util::interner; use core::dvec::DVec; -use core::prelude::*; use core::str; use core::to_str::ToStr; use core::vec; @@ -386,8 +385,7 @@ impl protocol: gen_init { } } - cx.ty_path_ast_builder(path(~[cx.ident_of(~"super"), - cx.ident_of(~"__Buffer")], self.span) + cx.ty_path_ast_builder(path(~[cx.ident_of(~"__Buffer")], self.span) .add_tys(cx.ty_vars_global(params))) } diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs index 9953b4de50d..a2673c481b1 100644 --- a/src/libsyntax/ext/pipes/proto.rs +++ b/src/libsyntax/ext/pipes/proto.rs @@ -8,11 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use core::prelude::*; - use ast; -use codemap::span; -use ext::base::ext_ctxt; use ext::pipes::ast_builder::{path, append_types}; use core::cmp; diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 4aed5b64747..184093715c6 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -18,7 +18,6 @@ use parse::token::*; use parse::token; use parse; -use core::prelude::*; use core::str; /** @@ -34,7 +33,6 @@ use core::str; pub mod rt { use ast; - use ext::base::ext_ctxt; use parse; use print::pprust; diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index 3d012b393bb..47c6ea8876e 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -16,7 +16,6 @@ use ext::build::{mk_base_vec_e, mk_uint, mk_u8, mk_base_str}; use print::pprust; use core::io; -use core::prelude::*; use core::result; use core::str; use core::vec; diff --git a/src/libsyntax/ext/trace_macros.rs b/src/libsyntax/ext/trace_macros.rs index d5031b97718..c202778d0df 100644 --- a/src/libsyntax/ext/trace_macros.rs +++ b/src/libsyntax/ext/trace_macros.rs @@ -8,18 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ast::tt_delim; use ast; use codemap::span; -use ext::base::ext_ctxt; use ext::base; +use ext::base::ext_ctxt; +use ast::tt_delim; use parse::lexer::{new_tt_reader, reader}; use parse::parser::Parser; -use core::option::None; - fn expand_trace_macros(cx: ext_ctxt, sp: span, - tt: ~[ast::token_tree]) -> base::mac_result { + tt: ~[ast::token_tree]) -> base::mac_result +{ let sess = cx.parse_sess(); let cfg = cx.cfg(); let tt_rdr = new_tt_reader(cx.parse_sess().span_diagnostic, diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 1f1efdfe165..7386b3b67b9 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use core::prelude::*; - use ast::{ident, matcher_, matcher, match_tok, match_nonterminal, match_seq}; use ast::{tt_delim}; use ast; diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index 47489034a0f..c1745fac710 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use core::prelude::*; - use ast; use ast::{token_tree, tt_delim, tt_tok, tt_seq, tt_nonterminal,ident}; use ast_util; diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 7de4e3f1d5f..6d32c73e1f7 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use core::prelude::*; - use ast::*; use ast; use codemap::span; diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index 49197be4bb9..a3fd069afbb 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -8,11 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use core::prelude::*; - use ast; use ast_util::spanned; -use codemap::BytePos; use parse::common::*; //resolve bug? use parse::token; diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index 0e101d54ba3..d5365d59041 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -8,10 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use core::prelude::*; - use ast; -use codemap::{BytePos, CharPos, CodeMap, FileMap}; +use codemap::{CodeMap, FileMap, CharPos}; use diagnostic; use parse::lexer::{is_whitespace, get_str_from, reader}; use parse::lexer::{string_reader, bump, is_eof, nextch}; diff --git a/src/libsyntax/parse/common.rs b/src/libsyntax/parse/common.rs index 1c6022130dc..ca0bbbb7369 100644 --- a/src/libsyntax/parse/common.rs +++ b/src/libsyntax/parse/common.rs @@ -8,16 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use core::prelude::*; - use ast; use ast_util::spanned; -use codemap::BytePos; use parse::lexer::reader; use parse::parser::Parser; use parse::token; -use core::option::{None, Option, Some}; use core::option; use std::map::HashMap; diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index 573c36e619b..c51f7e4dad6 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -8,15 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use core::prelude::*; - use ast; use ast_util; use codemap::{span, CodeMap, CharPos, BytePos}; use codemap; use diagnostic::span_handler; use ext::tt::transcribe::{tt_next_token}; -use ext::tt::transcribe::{tt_reader, new_tt_reader, dup_tt_reader}; +use ext::tt::transcribe::{tt_reader, new_tt_reader, dup_tt_reader}; use parse::token; use core::char; diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index b14b60af134..fb5c6250179 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -10,6 +10,8 @@ //! The main parser interface +#[legacy_exports]; + use ast::node_id; use ast; use codemap::{span, CodeMap, FileMap, CharPos, BytePos}; @@ -22,47 +24,70 @@ use parse::token::{ident_interner, mk_ident_interner}; use util::interner; use core::io; -use core::option::{None, Option, Some}; -use core::path::Path; -use core::result::{Err, Ok, Result}; use core::result; +export parser; +export common; +export lexer; +export token; +export comments; +export prec; +export classify; +export attr; +export obsolete; + +export parse_sess; +export new_parse_sess, new_parse_sess_special_handler; +export next_node_id; +export new_parser_from_file, new_parser_etc_from_file; +export new_parser_from_source_str; +export new_parser_from_tts; +export new_sub_parser_from_file; +export parse_crate_from_file, parse_crate_from_crate_file; +export parse_crate_from_source_str; +export parse_expr_from_source_str, parse_item_from_source_str; +export parse_stmt_from_source_str; +export parse_tts_from_source_str; +export parse_from_source_str; + + #[legacy_exports] -pub mod lexer; +mod lexer; #[legacy_exports] -pub mod parser; +mod parser; #[legacy_exports] -pub mod token; +mod token; #[legacy_exports] -pub mod comments; +mod comments; #[legacy_exports] -pub mod attr; +mod attr; #[legacy_exports] /// Common routines shared by parser mods #[legacy_exports] -pub mod common; +mod common; /// Functions dealing with operator precedence #[legacy_exports] -pub mod prec; +mod prec; /// Routines the parser uses to classify AST nodes #[legacy_exports] -pub mod classify; +mod classify; /// Reporting obsolete syntax #[legacy_exports] -pub mod obsolete; +mod obsolete; + -pub type parse_sess = @{ +type parse_sess = @{ cm: @codemap::CodeMap, mut next_id: node_id, span_diagnostic: span_handler, interner: @ident_interner, }; -pub fn new_parse_sess(demitter: Option<emitter>) -> parse_sess { +fn new_parse_sess(demitter: Option<emitter>) -> parse_sess { let cm = @CodeMap::new(); return @{cm: cm, mut next_id: 1, @@ -71,7 +96,7 @@ pub fn new_parse_sess(demitter: Option<emitter>) -> parse_sess { }; } -pub fn new_parse_sess_special_handler(sh: span_handler, cm: @codemap::CodeMap) +fn new_parse_sess_special_handler(sh: span_handler, cm: @codemap::CodeMap) -> parse_sess { return @{cm: cm, mut next_id: 1, @@ -80,17 +105,15 @@ pub fn new_parse_sess_special_handler(sh: span_handler, cm: @codemap::CodeMap) }; } -pub fn parse_crate_from_file(input: &Path, cfg: ast::crate_cfg, +fn parse_crate_from_file(input: &Path, cfg: ast::crate_cfg, sess: parse_sess) -> @ast::crate { let p = new_crate_parser_from_file(sess, cfg, input); let r = p.parse_crate_mod(cfg); return r; } -pub fn parse_crate_from_source_str(name: ~str, - source: @~str, - cfg: ast::crate_cfg, - sess: parse_sess) -> @ast::crate { +fn parse_crate_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg, + sess: parse_sess) -> @ast::crate { let p = new_parser_from_source_str(sess, cfg, name, codemap::FssNone, source); let r = p.parse_crate_mod(cfg); @@ -98,10 +121,8 @@ pub fn parse_crate_from_source_str(name: ~str, return r; } -pub fn parse_expr_from_source_str(name: ~str, - source: @~str, - cfg: ast::crate_cfg, - sess: parse_sess) -> @ast::expr { +fn parse_expr_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg, + sess: parse_sess) -> @ast::expr { let p = new_parser_from_source_str(sess, cfg, name, codemap::FssNone, source); let r = p.parse_expr(); @@ -109,12 +130,9 @@ pub fn parse_expr_from_source_str(name: ~str, return r; } -pub fn parse_item_from_source_str(name: ~str, - source: @~str, - cfg: ast::crate_cfg, - +attrs: ~[ast::attribute], - sess: parse_sess) - -> Option<@ast::item> { +fn parse_item_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg, + +attrs: ~[ast::attribute], + sess: parse_sess) -> Option<@ast::item> { let p = new_parser_from_source_str(sess, cfg, name, codemap::FssNone, source); let r = p.parse_item(attrs); @@ -122,11 +140,9 @@ pub fn parse_item_from_source_str(name: ~str, return r; } -pub fn parse_stmt_from_source_str(name: ~str, - source: @~str, - cfg: ast::crate_cfg, - +attrs: ~[ast::attribute], - sess: parse_sess) -> @ast::stmt { +fn parse_stmt_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg, + +attrs: ~[ast::attribute], + sess: parse_sess) -> @ast::stmt { let p = new_parser_from_source_str(sess, cfg, name, codemap::FssNone, source); let r = p.parse_stmt(attrs); @@ -134,10 +150,8 @@ pub fn parse_stmt_from_source_str(name: ~str, return r; } -pub fn parse_tts_from_source_str(name: ~str, - source: @~str, - cfg: ast::crate_cfg, - sess: parse_sess) -> ~[ast::token_tree] { +fn parse_tts_from_source_str(name: ~str, source: @~str, cfg: ast::crate_cfg, + sess: parse_sess) -> ~[ast::token_tree] { let p = new_parser_from_source_str(sess, cfg, name, codemap::FssNone, source); p.quote_depth += 1u; @@ -146,7 +160,7 @@ pub fn parse_tts_from_source_str(name: ~str, return r; } -pub fn parse_from_source_str<T>(f: fn (p: Parser) -> T, +fn parse_from_source_str<T>(f: fn (p: Parser) -> T, name: ~str, ss: codemap::FileSubstr, source: @~str, cfg: ast::crate_cfg, sess: parse_sess) @@ -162,7 +176,7 @@ pub fn parse_from_source_str<T>(f: fn (p: Parser) -> T, move r } -pub fn next_node_id(sess: parse_sess) -> node_id { +fn next_node_id(sess: parse_sess) -> node_id { let rv = sess.next_id; sess.next_id += 1; // ID 0 is reserved for the crate and doesn't actually exist in the AST @@ -170,7 +184,7 @@ pub fn next_node_id(sess: parse_sess) -> node_id { return rv; } -pub fn new_parser_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::FileSubstr, source: @~str) -> Parser { let filemap = sess.cm.new_filemap_w_substr(name, ss, source); @@ -179,7 +193,7 @@ pub fn new_parser_from_source_str(sess: parse_sess, cfg: ast::crate_cfg, return Parser(sess, cfg, srdr as reader); } -pub fn new_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, +fn new_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, path: &Path) -> Result<Parser, ~str> { match io::read_whole_file_str(path) { result::Ok(move src) => { @@ -197,7 +211,7 @@ pub fn new_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, /// Create a new parser for an entire crate, handling errors as appropriate /// if the file doesn't exist -pub fn new_crate_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, +fn new_crate_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, path: &Path) -> Parser { match new_parser_from_file(sess, cfg, path) { Ok(move parser) => move parser, @@ -209,7 +223,7 @@ pub fn new_crate_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, /// Create a new parser based on a span from an existing parser. Handles /// error messages correctly when the file does not exist. -pub fn new_sub_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, +fn new_sub_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, path: &Path, sp: span) -> Parser { match new_parser_from_file(sess, cfg, path) { Ok(move parser) => move parser, @@ -219,7 +233,7 @@ pub fn new_sub_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, } } -pub fn new_parser_from_tts(sess: parse_sess, cfg: ast::crate_cfg, +fn new_parser_from_tts(sess: parse_sess, cfg: ast::crate_cfg, tts: ~[ast::token_tree]) -> Parser { let trdr = lexer::new_tt_reader(sess.span_diagnostic, sess.interner, None, tts); diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index 15905c090db..6b73cf308a2 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -17,13 +17,10 @@ Obsolete syntax that becomes too hard to parse can be removed. */ -use core::prelude::*; - use ast::{expr, expr_lit, lit_nil}; use ast; use ast_util::{respan}; use codemap::span; -use parse::parser::Parser; use parse::token::Token; use parse::token; diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 80fd04f0e10..f32a782622a 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use core::prelude::*; - use ast::{ProtoBox, ProtoUniq, provided, public, pure_fn, purity, re_static}; use ast::{_mod, add, arg, arm, attribute, bind_by_ref, bind_infer}; use ast::{bind_by_value, bind_by_move, bitand, bitor, bitxor, blk}; @@ -35,24 +33,23 @@ use ast::{lit_bool, lit_float, lit_float_unsuffixed, lit_int}; use ast::{lit_int_unsuffixed, lit_nil, lit_str, lit_uint, local, m_const}; use ast::{m_imm, m_mutbl, mac_, mac_invoc_tt, matcher, match_nonterminal}; use ast::{match_seq, match_tok, method, mode, module_ns, mt, mul, mutability}; -use ast::{named_field, neg, node_id, noreturn, not, pat, pat_box, pat_enum}; -use ast::{pat_ident, pat_lit, pat_range, pat_rec, pat_region, pat_struct}; -use ast::{pat_tup, pat_uniq, pat_wild, path, private, Proto, ProtoBare}; -use ast::{ProtoBorrowed, re_self, re_anon, re_named, region, rem, required}; -use ast::{ret_style, return_val, self_ty, shl, shr, stmt, stmt_decl}; -use ast::{stmt_expr, stmt_semi, stmt_mac, struct_def, struct_field}; -use ast::{struct_immutable, struct_mutable, struct_variant_kind, subtract}; -use ast::{sty_box, sty_by_ref, sty_region, sty_static, sty_uniq, sty_value}; -use ast::{token_tree, trait_method, trait_ref, tt_delim, tt_seq, tt_tok}; -use ast::{tt_nonterminal, tuple_variant_kind, Ty, ty_, ty_bot, ty_box}; -use ast::{ty_field, ty_fixed_length_vec, ty_fn, ty_infer, ty_mac, ty_method}; -use ast::{ty_nil, ty_param, ty_param_bound, ty_path, ty_ptr, ty_rec, ty_rptr}; -use ast::{ty_tup, ty_u32, ty_uniq, ty_vec, type_value_ns, uniq}; -use ast::{unnamed_field, unsafe_blk, unsafe_fn, variant, view_item}; -use ast::{view_item_, view_item_export, view_item_import, view_item_use}; -use ast::{view_path, view_path_glob, view_path_list, view_path_simple}; -use ast::{visibility, vstore, vstore_box, vstore_fixed, vstore_slice}; -use ast::{vstore_uniq}; +use ast::{named_field, neg, noreturn, not, pat, pat_box, pat_enum, pat_ident}; +use ast::{pat_lit, pat_range, pat_rec, pat_region, pat_struct, pat_tup}; +use ast::{pat_uniq, pat_wild, path, private, Proto, ProtoBare, ProtoBorrowed}; +use ast::{re_self, re_anon, re_named, region, rem, required, ret_style}; +use ast::{return_val, self_ty, shl, shr, stmt, stmt_decl, stmt_expr}; +use ast::{stmt_semi, stmt_mac, struct_def, struct_field, struct_immutable}; +use ast::{struct_mutable, struct_variant_kind, subtract, sty_box, sty_by_ref}; +use ast::{sty_region, sty_static, sty_uniq, sty_value, token_tree}; +use ast::{trait_method, trait_ref, tt_delim, tt_seq, tt_tok, tt_nonterminal}; +use ast::{tuple_variant_kind, Ty, ty_, ty_bot, ty_box, ty_field, ty_fn}; +use ast::{ty_fixed_length_vec, type_value_ns, uniq, unnamed_field}; +use ast::{ty_infer, ty_mac, ty_method, ty_nil, ty_param, ty_param_bound}; +use ast::{ty_path, ty_ptr, ty_rec, ty_rptr, ty_tup, ty_u32, ty_uniq, ty_vec}; +use ast::{unsafe_blk, unsafe_fn, variant, view_item, view_item_}; +use ast::{view_item_export, view_item_import, view_item_use, view_path}; +use ast::{view_path_glob, view_path_list, view_path_simple, visibility}; +use ast::{vstore, vstore_box, vstore_fixed, vstore_slice, vstore_uniq}; use ast; use ast_util::{spanned, respan, mk_sp, ident_to_path, operator_prec}; use ast_util; @@ -72,7 +69,6 @@ use parse::prec::{as_prec, token_to_binop}; use parse::token::{can_begin_expr, is_ident, is_ident_or_path}; use parse::token::{is_plain_ident, INTERPOLATED, special_idents}; use parse::token; -use parse::{new_sub_parser_from_file, next_node_id, parse_sess}; use print::pprust::expr_to_str; use util::interner::Interner; diff --git a/src/libsyntax/parse/prec.rs b/src/libsyntax/parse/prec.rs index 10754777129..4663b875bb5 100644 --- a/src/libsyntax/parse/prec.rs +++ b/src/libsyntax/parse/prec.rs @@ -12,11 +12,9 @@ export as_prec; export unop_prec; export token_to_binop; -use ast::*; use parse::token::*; use parse::token::Token; - -use core::prelude::*; +use ast::*; /// Unary operators have higher precedence than binary const unop_prec: uint = 100u; diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 606247b8cbe..f286b15c752 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use core::prelude::*; - use ast; use ast_util; use parse::token; diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index b3b267027ce..c9d2abfe0cb 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use core::prelude::*; - use core::cmp; use core::dvec::DVec; use core::io::WriterUtil; diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index c121bc30b96..239cff22cc0 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use core::prelude::*; - use ast::{required, provided}; use ast; use ast_util; @@ -18,9 +16,9 @@ use attr; use codemap::{CodeMap, BytePos}; use codemap; use diagnostic; -use parse::classify::{expr_is_simple_block, expr_requires_semi_to_be_stmt}; -use parse::classify::{stmt_ends_with_semi}; +use parse::classify::*; use parse::token::ident_interner; +use parse::token; use parse::{comments, lexer, token}; use parse; use print::pp::{break_offset, word, printer, space, zerobreak, hardbreak}; diff --git a/src/libsyntax/util/interner.rs b/src/libsyntax/util/interner.rs index fd759a32941..cfa3a4224c5 100644 --- a/src/libsyntax/util/interner.rs +++ b/src/libsyntax/util/interner.rs @@ -11,12 +11,12 @@ // An "interner" is a data structure that associates values with uint tags and // allows bidirectional lookup; i.e. given a value, one can easily find the // type, and vice versa. - -use core::prelude::*; - -use core::dvec::DVec; -use std::map::HashMap; use std::map; +use std::map::HashMap; +use dvec::DVec; +use cmp::Eq; +use hash::Hash; +use to_bytes::IterBytes; type hash_interner<T: Const> = {map: HashMap<T, uint>, diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 3f7ba2dc37b..b7d894a7e9f 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use core::prelude::*; - use ast::*; use ast; use ast_util; |
