From cc148b58ff7a4eb6861701be61396d1a685f6657 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Wed, 3 Apr 2013 09:28:36 -0400 Subject: rename Linear{Map,Set} => Hash{Map,Set} --- src/libsyntax/ast_map.rs | 6 +++--- src/libsyntax/attr.rs | 4 ++-- src/libsyntax/ext/base.rs | 18 +++++++++--------- src/libsyntax/ext/tt/macro_parser.rs | 12 ++++++------ src/libsyntax/ext/tt/transcribe.rs | 8 ++++---- src/libsyntax/parse/parser.rs | 12 ++++++------ src/libsyntax/parse/token.rs | 18 +++++++++--------- src/libsyntax/util/interner.rs | 6 +++--- 8 files changed, 42 insertions(+), 42 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index 04d7cbdca0c..147d8227b81 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -23,7 +23,7 @@ use print::pprust; use visit; use core::cmp; -use core::hashmap::LinearMap; +use core::hashmap::HashMap; use core::str; use core::vec; @@ -104,7 +104,7 @@ pub enum ast_node { node_struct_ctor(@struct_def, @item, @path), } -pub type map = @mut LinearMap; +pub type map = @mut HashMap; pub struct Ctx { map: map, @@ -134,7 +134,7 @@ pub fn mk_ast_map_visitor() -> vt { pub fn map_crate(diag: @span_handler, c: crate) -> map { let cx = @mut Ctx { - map: @mut LinearMap::new(), + map: @mut HashMap::new(), path: ~[], local_id: 0u, diag: diag, diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index 71e2faa93f5..5063a0381e7 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -20,7 +20,7 @@ use diagnostic::span_handler; use parse::comments::{doc_comment_style, strip_doc_comment_decoration}; use core::vec; -use core::hashmap::LinearSet; +use core::hashmap::HashSet; use std; /* Constructors */ @@ -333,7 +333,7 @@ pub fn find_inline_attr(attrs: &[ast::attribute]) -> inline_attr { pub fn require_unique_names(diagnostic: @span_handler, metas: &[@ast::meta_item]) { - let mut set = LinearSet::new(); + let mut set = HashSet::new(); for metas.each |meta| { let name = get_meta_item_name(*meta); diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index cae56267f5e..92f0c7c7679 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -20,7 +20,7 @@ use parse; use parse::token; use core::vec; -use core::hashmap::LinearMap; +use core::hashmap::HashMap; // new-style macro! tt code: // @@ -125,7 +125,7 @@ pub fn syntax_expander_table() -> SyntaxEnv { fn builtin_item_tt(f: SyntaxExpanderTTItemFun) -> @Transformer { @SE(IdentTT(SyntaxExpanderTTItem{expander: f, span: None})) } - let mut syntax_expanders = LinearMap::new(); + let mut syntax_expanders = HashMap::new(); // NB identifier starts with space, and can't conflict with legal idents syntax_expanders.insert(@~" block", @ScopeMacros(true)); @@ -430,8 +430,8 @@ pub fn get_exprs_from_tts(cx: @ext_ctxt, tts: &[ast::token_tree]) // a transformer env is either a base map or a map on top // of another chain. pub enum MapChain { - BaseMapChain(~LinearMap), - ConsMapChain(~LinearMap,@mut MapChain) + BaseMapChain(~HashMap), + ConsMapChain(~HashMap,@mut MapChain) } @@ -439,13 +439,13 @@ pub enum MapChain { impl MapChain{ // Constructor. I don't think we need a zero-arg one. - fn new(+init: ~LinearMap) -> @mut MapChain { + fn new(+init: ~HashMap) -> @mut MapChain { @mut BaseMapChain(init) } // add a new frame to the environment (functionally) fn push_frame (@mut self) -> @mut MapChain { - @mut ConsMapChain(~LinearMap::new() ,self) + @mut ConsMapChain(~HashMap::new() ,self) } // no need for pop, it'll just be functional. @@ -454,7 +454,7 @@ impl MapChain{ // ugh: can't get this to compile with mut because of the // lack of flow sensitivity. - fn get_map(&self) -> &'self LinearMap { + fn get_map(&self) -> &'self HashMap { match *self { BaseMapChain (~ref map) => map, ConsMapChain (~ref map,_) => map @@ -509,10 +509,10 @@ impl MapChain{ #[cfg(test)] mod test { use super::MapChain; - use core::hashmap::LinearMap; + use core::hashmap::HashMap; #[test] fn testenv () { - let mut a = LinearMap::new(); + let mut a = HashMap::new(); a.insert (@~"abc",@15); let m = MapChain::new(~a); m.insert (@~"def",@16); diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index fcb0c76a2c7..afb7e04a532 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -20,7 +20,7 @@ use parse::token::{Token, EOF, to_str, nonterminal}; use parse::token; use core::prelude::*; -use core::hashmap::LinearMap; +use core::hashmap::HashMap; /* This is an Earley-like parser, without support for in-grammar nonterminals, only by calling out to the main rust parser for named nonterminals (which it @@ -186,9 +186,9 @@ pub enum named_match { pub type earley_item = ~MatcherPos; pub fn nameize(p_s: @mut ParseSess, ms: ~[matcher], res: ~[@named_match]) - -> LinearMap { + -> HashMap { fn n_rec(p_s: @mut ParseSess, m: matcher, res: ~[@named_match], - ret_val: &mut LinearMap) { + ret_val: &mut HashMap) { match m { codemap::spanned {node: match_tok(_), _} => (), codemap::spanned {node: match_seq(ref more_ms, _, _, _, _), _} => { @@ -207,13 +207,13 @@ pub fn nameize(p_s: @mut ParseSess, ms: ~[matcher], res: ~[@named_match]) } } } - let mut ret_val = LinearMap::new(); + let mut ret_val = HashMap::new(); for ms.each() |m| { n_rec(p_s, *m, res, &mut ret_val) } return ret_val; } pub enum parse_result { - success(LinearMap), + success(HashMap), failure(codemap::span, ~str), error(codemap::span, ~str) } @@ -223,7 +223,7 @@ pub fn parse_or_else( +cfg: ast::crate_cfg, rdr: @reader, ms: ~[matcher] -) -> LinearMap { +) -> HashMap { match parse(sess, cfg, rdr, ms) { success(m) => m, failure(sp, str) => sess.span_diagnostic.span_fatal(sp, str), diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index de0b4c0799f..0a74b6a9435 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -18,7 +18,7 @@ use ext::tt::macro_parser::{named_match, matched_seq, matched_nonterminal}; use parse::token::{EOF, INTERPOLATED, IDENT, Token, nt_ident, ident_interner}; use parse::lexer::TokenAndSpan; -use core::hashmap::LinearMap; +use core::hashmap::HashMap; use core::option; use core::vec; @@ -39,7 +39,7 @@ pub struct TtReader { // the unzipped tree: cur: @mut TtFrame, /* for MBE-style macro transcription */ - interpolations: LinearMap, + interpolations: HashMap, repeat_idx: ~[uint], repeat_len: ~[uint], /* cached: */ @@ -52,7 +52,7 @@ pub struct TtReader { * should) be none. */ pub fn new_tt_reader(sp_diag: @span_handler, itr: @ident_interner, - interp: Option>, + interp: Option>, +src: ~[ast::token_tree]) -> @mut TtReader { let r = @mut TtReader { @@ -66,7 +66,7 @@ pub fn new_tt_reader(sp_diag: @span_handler, up: option::None }, interpolations: match interp { /* just a convienience */ - None => LinearMap::new(), + None => HashMap::new(), Some(x) => x }, repeat_idx: ~[], diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 1b845ad1dd9..f36d8f42f2a 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -94,7 +94,7 @@ use opt_vec::OptVec; use core::either::Either; use core::either; -use core::hashmap::LinearSet; +use core::hashmap::HashSet; use core::vec; #[deriving(Eq)] @@ -243,7 +243,7 @@ pub fn Parser(sess: @mut ParseSess, keywords: token::keyword_table(), strict_keywords: token::strict_keyword_table(), reserved_keywords: token::reserved_keyword_table(), - obsolete_set: @mut LinearSet::new(), + obsolete_set: @mut HashSet::new(), mod_path_stack: @mut ~[], } } @@ -262,12 +262,12 @@ pub struct Parser { quote_depth: @mut uint, // not (yet) related to the quasiquoter reader: @reader, interner: @token::ident_interner, - keywords: LinearSet<~str>, - strict_keywords: LinearSet<~str>, - reserved_keywords: LinearSet<~str>, + keywords: HashSet<~str>, + strict_keywords: HashSet<~str>, + reserved_keywords: HashSet<~str>, /// The set of seen errors about obsolete syntax. Used to suppress /// extra detail when the same error is seen twice - obsolete_set: @mut LinearSet, + obsolete_set: @mut HashSet, /// Used to determine the path to externally loaded source files mod_path_stack: @mut ~[~str], diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index ff10b6070e6..713a6e89475 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -18,7 +18,7 @@ use util::interner; use core::cast; use core::char; -use core::hashmap::LinearSet; +use core::hashmap::HashSet; use core::str; use core::task; @@ -458,8 +458,8 @@ pub fn mk_fake_ident_interner() -> @ident_interner { * appear as identifiers at all. Reserved keywords are not used anywhere in * the language and may not appear as identifiers. */ -pub fn keyword_table() -> LinearSet<~str> { - let mut keywords = LinearSet::new(); +pub fn keyword_table() -> HashSet<~str> { + let mut keywords = HashSet::new(); let mut tmp = temporary_keyword_table(); let mut strict = strict_keyword_table(); let mut reserved = reserved_keyword_table(); @@ -471,8 +471,8 @@ pub fn keyword_table() -> LinearSet<~str> { } /// Keywords that may be used as identifiers -pub fn temporary_keyword_table() -> LinearSet<~str> { - let mut words = LinearSet::new(); +pub fn temporary_keyword_table() -> HashSet<~str> { + let mut words = HashSet::new(); let keys = ~[ ~"self", ~"static", ]; @@ -483,8 +483,8 @@ pub fn temporary_keyword_table() -> LinearSet<~str> { } /// Full keywords. May not appear anywhere else. -pub fn strict_keyword_table() -> LinearSet<~str> { - let mut words = LinearSet::new(); +pub fn strict_keyword_table() -> HashSet<~str> { + let mut words = HashSet::new(); let keys = ~[ ~"as", ~"break", @@ -509,8 +509,8 @@ pub fn strict_keyword_table() -> LinearSet<~str> { return words; } -pub fn reserved_keyword_table() -> LinearSet<~str> { - let mut words = LinearSet::new(); +pub fn reserved_keyword_table() -> HashSet<~str> { + let mut words = HashSet::new(); let keys = ~[ ~"be" ]; diff --git a/src/libsyntax/util/interner.rs b/src/libsyntax/util/interner.rs index dd4044036ef..4108871d008 100644 --- a/src/libsyntax/util/interner.rs +++ b/src/libsyntax/util/interner.rs @@ -13,10 +13,10 @@ // type, and vice versa. use core::prelude::*; -use core::hashmap::LinearMap; +use core::hashmap::HashMap; pub struct Interner { - priv map: @mut LinearMap, + priv map: @mut HashMap, priv vect: @mut ~[T], } @@ -24,7 +24,7 @@ pub struct Interner { pub impl Interner { fn new() -> Interner { Interner { - map: @mut LinearMap::new(), + map: @mut HashMap::new(), vect: @mut ~[], } } -- cgit 1.4.1-3-g733a5