diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2012-08-02 15:42:56 -0700 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2012-08-02 15:53:28 -0700 |
| commit | 97452c0ca16238a2de5503aca07db26ff9e8ba63 (patch) | |
| tree | 47ef430d1671ab297bc192009aa74a23723a42fc /src/libsyntax/parse | |
| parent | 476ce459bd3b687658e566c75d0fb73281450d67 (diff) | |
| download | rust-97452c0ca16238a2de5503aca07db26ff9e8ba63.tar.gz rust-97452c0ca16238a2de5503aca07db26ff9e8ba63.zip | |
Remove modes from map API and replace with regions.
API is (for now) mostly by value, there are options to use it by reference if you like. Hash and equality functions must be pure and by reference (forward looking to the day when something like send_map becomes the standard map).
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/common.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/parse/lexer.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/libsyntax/parse/common.rs b/src/libsyntax/parse/common.rs index e0b551f0e45..092238e17be 100644 --- a/src/libsyntax/parse/common.rs +++ b/src/libsyntax/parse/common.rs @@ -112,14 +112,14 @@ impl parser_common of parser_common for parser { // A sanity check that the word we are asking for is a known keyword fn require_keyword(word: ~str) { - if !self.keywords.contains_key(word) { + if !self.keywords.contains_key_ref(&word) { self.bug(fmt!{"unknown keyword: %s", word}); } } fn token_is_word(word: ~str, ++tok: token::token) -> bool { alt tok { - token::IDENT(sid, false) => { str::eq(word, *self.get_str(sid)) } + token::IDENT(sid, false) => { word == *self.get_str(sid) } _ => { false } } } @@ -136,7 +136,7 @@ impl parser_common of parser_common for parser { fn is_any_keyword(tok: token::token) -> bool { alt tok { token::IDENT(sid, false) { - self.keywords.contains_key(*self.get_str(sid)) + self.keywords.contains_key_ref(self.get_str(sid)) } _ { false } } @@ -148,7 +148,7 @@ impl parser_common of parser_common for parser { let mut bump = false; let val = alt self.token { token::IDENT(sid, false) { - if str::eq(word, *self.get_str(sid)) { + if word == *self.get_str(sid) { bump = true; true } else { false } @@ -169,7 +169,7 @@ impl parser_common of parser_common for parser { } fn is_restricted_keyword(word: ~str) -> bool { - self.restricted_keywords.contains_key(word) + self.restricted_keywords.contains_key_ref(&word) } fn check_restricted_keywords() { diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index a2d7a04a6bf..9583be3461d 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -456,7 +456,7 @@ fn next_token_inner(rdr: string_reader) -> token::token { bump(rdr); c = rdr.curr; } - if str::eq(accum_str, ~"_") { return token::UNDERSCORE; } + if accum_str == ~"_" { return token::UNDERSCORE; } let is_mod_name = c == ':' && nextch(rdr) == ':'; // FIXME: perform NFKC normalization here. (Issue #2253) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 29fdc884604..7d5a088a04f 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2066,7 +2066,7 @@ class parser { fn is_self_ident() -> bool { alt self.token { - token::IDENT(sid, false) if str::eq(~"self", *self.get_str(sid)) { + token::IDENT(sid, false) if ~"self" == *self.get_str(sid) { true } _ => { |
