about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2012-12-23 17:41:37 -0500
committerPatrick Walton <pcwalton@mimiga.net>2012-12-27 10:02:54 -0800
commit57c599914a19861686030b238a0edc7ebb996068 (patch)
treeda3e6ee27b1260b140dacf0085cc258f15279e38 /src/libsyntax/parse
parent6b659392ea4a7a15226519f26d081431f624c466 (diff)
librustc: Terminate name searches at the nearest module scope for paths that contain at least two components. r=graydon
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/attr.rs5
-rw-r--r--src/libsyntax/parse/classify.rs1
-rw-r--r--src/libsyntax/parse/comments.rs19
-rw-r--r--src/libsyntax/parse/common.rs8
-rw-r--r--src/libsyntax/parse/lexer.rs17
-rw-r--r--src/libsyntax/parse/mod.rs23
-rw-r--r--src/libsyntax/parse/obsolete.rs9
-rw-r--r--src/libsyntax/parse/parser.rs139
-rw-r--r--src/libsyntax/parse/token.rs13
9 files changed, 144 insertions, 90 deletions
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs
index a4bef47fdf2..a3fd069afbb 100644
--- a/src/libsyntax/parse/attr.rs
+++ b/src/libsyntax/parse/attr.rs
@@ -8,9 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use either::{Either, Left, Right};
+use ast;
 use ast_util::spanned;
 use parse::common::*; //resolve bug?
+use parse::token;
+
+use core::either::{Either, Left, Right};
 
 export parser_attr;
 
diff --git a/src/libsyntax/parse/classify.rs b/src/libsyntax/parse/classify.rs
index 0ff5c296125..7f57c777833 100644
--- a/src/libsyntax/parse/classify.rs
+++ b/src/libsyntax/parse/classify.rs
@@ -12,6 +12,7 @@
   Predicates on exprs and stmts that the pretty-printer and parser use
  */
 
+use ast;
 use ast_util::operator_prec;
 
 fn expr_requires_semi_to_be_stmt(e: @ast::expr) -> bool {
diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs
index 22b40736748..0cd3ef0ee73 100644
--- a/src/libsyntax/parse/comments.rs
+++ b/src/libsyntax/parse/comments.rs
@@ -8,11 +8,22 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use io::ReaderUtil;
+use ast;
+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};
+use parse::lexer;
+use parse::token;
+use parse;
 use util::interner;
-use parse::lexer::{string_reader, bump, is_eof, nextch,
-                   is_whitespace, get_str_from, reader};
-use codemap::{FileMap, CharPos};
+
+use core::cmp;
+use core::io::ReaderUtil;
+use core::io;
+use core::str;
+use core::uint;
+use core::vec;
 
 export cmnt;
 export lit;
diff --git a/src/libsyntax/parse/common.rs b/src/libsyntax/parse/common.rs
index 246a8fa9c7c..ca0bbbb7369 100644
--- a/src/libsyntax/parse/common.rs
+++ b/src/libsyntax/parse/common.rs
@@ -8,10 +8,14 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::map::{HashMap};
+use ast;
 use ast_util::spanned;
-use parse::parser::Parser;
 use parse::lexer::reader;
+use parse::parser::Parser;
+use parse::token;
+
+use core::option;
+use std::map::HashMap;
 
 type seq_sep = {
     sep: Option<token::Token>,
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs
index c4e34311b88..c51f7e4dad6 100644
--- a/src/libsyntax/parse/lexer.rs
+++ b/src/libsyntax/parse/lexer.rs
@@ -8,10 +8,21 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use diagnostic::span_handler;
+use ast;
+use ast_util;
 use codemap::{span, CodeMap, CharPos, BytePos};
-use ext::tt::transcribe::{tt_reader,  new_tt_reader, dup_tt_reader,
-                             tt_next_token};
+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 parse::token;
+
+use core::char;
+use core::either;
+use core::str;
+use core::u64;
+
+use std;
 
 export reader, string_reader, new_string_reader, is_whitespace;
 export tt_reader,  new_tt_reader;
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index 803135f7599..fb5c6250179 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -12,6 +12,20 @@
 
 #[legacy_exports];
 
+use ast::node_id;
+use ast;
+use codemap::{span, CodeMap, FileMap, CharPos, BytePos};
+use codemap;
+use diagnostic::{span_handler, mk_span_handler, mk_handler, emitter};
+use parse::attr::parser_attr;
+use parse::lexer::{reader, string_reader};
+use parse::parser::Parser;
+use parse::token::{ident_interner, mk_ident_interner};
+use util::interner;
+
+use core::io;
+use core::result;
+
 export parser;
 export common;
 export lexer;
@@ -36,15 +50,6 @@ export parse_stmt_from_source_str;
 export parse_tts_from_source_str;
 export parse_from_source_str;
 
-use ast::node_id;
-use codemap::{span, CodeMap, FileMap, CharPos, BytePos};
-use diagnostic::{span_handler, mk_span_handler, mk_handler, emitter};
-use parse::attr::parser_attr;
-use parse::lexer::{reader, string_reader};
-use parse::parser::Parser;
-use parse::token::{ident_interner, mk_ident_interner};
-use util::interner;
-
 
 #[legacy_exports]
 mod lexer;
diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs
index 3db635f3b43..6b73cf308a2 100644
--- a/src/libsyntax/parse/obsolete.rs
+++ b/src/libsyntax/parse/obsolete.rs
@@ -17,10 +17,17 @@ Obsolete syntax that becomes too hard to parse can be
 removed.
 */
 
-use codemap::span;
 use ast::{expr, expr_lit, lit_nil};
+use ast;
 use ast_util::{respan};
+use codemap::span;
 use parse::token::Token;
+use parse::token;
+
+use core::cmp;
+use core::option;
+use core::str;
+use core::to_bytes;
 
 /// The specific types of unsupported syntax
 pub enum ObsoleteSyntax {
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 2b83404e065..f85ca3fefef 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -8,76 +8,79 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use print::pprust::expr_to_str;
-
-use result::Result;
-use either::{Either, Left, Right};
-use std::map::HashMap;
-use parse::token::{can_begin_expr, is_ident, is_ident_or_path, is_plain_ident,
-                   INTERPOLATED, special_idents};
-use codemap::{span,FssNone, BytePos};
-use util::interner::Interner;
+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};
+use ast::{blk_check_mode, box, by_copy, by_move, by_ref, by_val};
+use ast::{capture_clause, capture_item, crate, crate_cfg, decl, decl_item};
+use ast::{decl_local, default_blk, deref, div, enum_def, enum_variant_kind};
+use ast::{expl, expr, expr_, expr_addr_of, expr_match, expr_again};
+use ast::{expr_assert, expr_assign, expr_assign_op, expr_binary, expr_block};
+use ast::{expr_break, expr_call, expr_cast, expr_copy, expr_do_body};
+use ast::{expr_fail, expr_field, expr_fn, expr_fn_block, expr_if, expr_index};
+use ast::{expr_lit, expr_log, expr_loop, expr_loop_body, expr_mac};
+use ast::{expr_method_call, expr_paren, expr_path, expr_rec, expr_repeat};
+use ast::{expr_ret, expr_swap, expr_struct, expr_tup, expr_unary};
+use ast::{expr_unary_move, expr_vec, expr_vstore, expr_vstore_mut_box};
+use ast::{expr_vstore_fixed, expr_vstore_slice, expr_vstore_box};
+use ast::{expr_vstore_mut_slice, expr_while, extern_fn, field, fn_decl};
+use ast::{expr_vstore_uniq, TyFn, Onceness, Once, Many};
+use ast::{foreign_item, foreign_item_const, foreign_item_fn, foreign_mod};
+use ast::{ident, impure_fn, infer, inherited, item, item_, item_const};
+use ast::{item_const, item_enum, item_fn, item_foreign_mod, item_impl};
+use ast::{item_mac, item_mod, item_struct, item_trait, item_ty, lit, lit_};
+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, 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;
+use classify;
+use codemap::{span,FssNone, BytePos};
+use codemap;
+use parse::attr::parser_attr;
+use parse::common::{seq_sep_none, token_to_str};
+use parse::common::{seq_sep_trailing_disallowed, seq_sep_trailing_allowed};
 use parse::lexer::reader;
+use parse::obsolete::{ObsoleteClassTraits, ObsoleteModeInFnType};
+use parse::obsolete::{ObsoleteLet, ObsoleteFieldTerminator};
+use parse::obsolete::{ObsoleteMoveInit, ObsoleteBinaryMove};
+use parse::obsolete::{ObsoleteStructCtor, ObsoleteWith, ObsoleteClassMethod};
+use parse::obsolete::{ObsoleteSyntax, ObsoleteLowerCaseKindBounds};
 use parse::prec::{as_prec, token_to_binop};
-use parse::attr::parser_attr;
-use parse::common::{seq_sep_trailing_disallowed, seq_sep_trailing_allowed,
-                    seq_sep_none, token_to_str};
-use dvec::DVec;
-use vec::{push};
-use parse::obsolete::{
-    ObsoleteSyntax,
-    ObsoleteLowerCaseKindBounds, ObsoleteLet,
-    ObsoleteFieldTerminator, ObsoleteStructCtor,
-    ObsoleteWith, ObsoleteClassMethod, ObsoleteClassTraits,
-    ObsoleteModeInFnType, ObsoleteMoveInit, ObsoleteBinaryMove,
-};
-use ast::{_mod, add, arg, arm, attribute,
-             bind_by_ref, bind_infer, bind_by_value, bind_by_move,
-             bitand, bitor, bitxor, blk, blk_check_mode, box, by_copy,
-             by_move, by_ref, by_val, capture_clause,
-             capture_item, struct_immutable, struct_mutable,
-             crate, crate_cfg, decl, decl_item, decl_local,
-             default_blk, deref, div, enum_def, enum_variant_kind, expl, expr,
-             expr_, expr_addr_of, expr_match, expr_again, expr_assert,
-             expr_assign, expr_assign_op, expr_binary, expr_block, expr_break,
-             expr_call, expr_cast, expr_copy, expr_do_body, expr_fail,
-             expr_field, expr_fn, expr_fn_block, expr_if, expr_index,
-             expr_lit, expr_log, expr_loop, expr_loop_body, expr_mac,
-             expr_method_call, expr_paren, expr_path, expr_rec, expr_repeat,
-             expr_ret, expr_swap, expr_struct, expr_tup, expr_unary,
-             expr_unary_move, expr_vec, expr_vstore, expr_vstore_mut_box,
-             expr_vstore_mut_slice, expr_while, extern_fn, field, fn_decl,
-             foreign_item, foreign_item_const, foreign_item_fn, foreign_mod,
-             ident, impure_fn, infer, inherited,
-             item, item_, item_struct, item_const, item_enum, item_fn,
-             item_foreign_mod, item_impl, item_mac, item_mod, item_trait,
-             item_ty, lit, lit_, lit_bool, lit_float, lit_float_unsuffixed,
-             lit_int, lit_int_unsuffixed, lit_nil, lit_str, lit_uint, local,
-             m_const, m_imm, m_mutbl, mac_,
-             mac_invoc_tt, matcher, match_nonterminal, match_seq,
-             match_tok, method, mode, module_ns, mt, mul, mutability,
-             named_field, neg, noreturn, not, pat, pat_box, pat_enum,
-             pat_ident, pat_lit, pat_range, pat_rec, pat_region, pat_struct,
-             pat_tup, pat_uniq, pat_wild, path, private, Proto, ProtoBare,
-             ProtoBorrowed, ProtoBox, ProtoUniq, provided, public, pure_fn,
-             purity, re_static, re_self, re_anon, re_named, region,
-             rem, required, ret_style, return_val, self_ty, shl, shr, stmt,
-             stmt_decl, stmt_expr, stmt_semi, stmt_mac, struct_def,
-             struct_field, struct_variant_kind, subtract, sty_box, sty_by_ref,
-             sty_region, sty_static, sty_uniq, sty_value, token_tree,
-             trait_method, trait_ref, tt_delim, tt_seq, tt_tok,
-             tt_nonterminal, tuple_variant_kind, Ty, ty_, ty_bot,
-             ty_box, ty_field, ty_fn, ty_infer, ty_mac, ty_method, ty_nil,
-             ty_param, ty_param_bound, ty_path, ty_ptr, ty_rec, ty_rptr,
-             ty_tup, ty_u32, ty_uniq, ty_vec, ty_fixed_length_vec,
-             type_value_ns, uniq, unnamed_field, unsafe_blk, unsafe_fn,
-             variant, view_item, view_item_, view_item_export,
-             view_item_import, view_item_use, view_path, view_path_glob,
-             view_path_list, view_path_simple, visibility, vstore, vstore_box,
-             vstore_fixed, vstore_slice, vstore_uniq,
-             expr_vstore_fixed, expr_vstore_slice, expr_vstore_box,
-             expr_vstore_uniq, TyFn, Onceness, Once, Many};
+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 print::pprust::expr_to_str;
+use util::interner::Interner;
+
+use core::cmp;
+use core::dvec::DVec;
+use core::dvec;
+use core::either::{Either, Left, Right};
+use core::either;
+use core::result::Result;
+use core::vec::push;
+use core::vec;
+use std::map::HashMap;
 
 export Parser;
 
@@ -195,7 +198,7 @@ fn Parser(sess: parse_sess, cfg: ast::crate_cfg,
         keywords: token::keyword_table(),
         strict_keywords: token::strict_keyword_table(),
         reserved_keywords: token::reserved_keyword_table(),
-        obsolete_set: std::map::HashMap(),
+        obsolete_set: HashMap(),
         mod_path_stack: ~[],
     }
 }
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index 04e6e187dbb..f286b15c752 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -8,8 +8,17 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use util::interner;
+use ast;
+use ast_util;
+use parse::token;
 use util::interner::Interner;
+use util::interner;
+
+use core::cast;
+use core::char;
+use core::cmp;
+use core::str;
+use core::task;
 use std::map::HashMap;
 
 #[auto_encode]
@@ -332,7 +341,7 @@ mod special_idents {
 }
 
 struct ident_interner {
-    priv interner: util::interner::Interner<@~str>,
+    priv interner: Interner<@~str>,
 }
 
 impl ident_interner {