diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2013-08-03 12:45:23 -0400 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2013-08-03 22:48:02 -0400 |
| commit | 10089455287dcc3652b984ab4bfd6971e1b5f302 (patch) | |
| tree | a9570eacf4ff89a1f14b7380c080af77918589f6 /src/libsyntax/parse | |
| parent | 9f74217d80290d1cb36afcaf68a566b4b4907d27 (diff) | |
| download | rust-10089455287dcc3652b984ab4bfd6971e1b5f302.tar.gz rust-10089455287dcc3652b984ab4bfd6971e1b5f302.zip | |
remove obsolete `foreach` keyword
this has been replaced by `for`
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/comments.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/parse/lexer.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 14 | ||||
| -rw-r--r-- | src/libsyntax/parse/token.rs | 17 |
4 files changed, 16 insertions, 21 deletions
diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index c5454a2ca95..41379e6599c 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -73,8 +73,8 @@ pub fn strip_doc_comment_decoration(comment: &str) -> ~str { let mut i = uint::max_value; let mut can_trim = true; let mut first = true; - foreach line in lines.iter() { - foreach (j, c) in line.iter().enumerate() { + for line in lines.iter() { + for (j, c) in line.iter().enumerate() { if j > i || !"* \t".contains_char(c) { can_trim = false; break; diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index 3259d49fcd1..49deafeda40 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -837,7 +837,7 @@ mod test { // check that the given reader produces the desired stream // of tokens (stop checking after exhausting the expected vec) fn check_tokenization (env: Env, expected: ~[token::Token]) { - foreach expected_tok in expected.iter() { + for expected_tok in expected.iter() { let TokenAndSpan {tok:actual_tok, sp: _} = env.string_reader.next_token(); assert_eq!(&actual_tok,expected_tok); diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index ac3c50a53de..afa2e7a5e42 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1623,8 +1623,6 @@ impl Parser { hi = self.span.hi; } else if self.eat_keyword(keywords::If) { return self.parse_if_expr(); - } else if self.eat_keyword(keywords::ForEach) { - return self.parse_for_expr(); } else if self.eat_keyword(keywords::For) { return self.parse_for_expr(); } else if self.eat_keyword(keywords::Do) { @@ -3150,7 +3148,7 @@ impl Parser { } = self.parse_items_and_view_items(first_item_attrs, false, false); - foreach item in items.iter() { + for item in items.iter() { let decl = @spanned(item.span.lo, item.span.hi, decl_item(*item)); stmts.push(@spanned(item.span.lo, item.span.hi, stmt_decl(decl, self.get_id()))); @@ -3755,7 +3753,7 @@ impl Parser { fields = ~[]; while *self.token != token::RBRACE { let r = self.parse_struct_decl_field(); - foreach struct_field in r.iter() { + for struct_field in r.iter() { fields.push(*struct_field) } } @@ -4038,7 +4036,7 @@ impl Parser { Some(i) => { let stack = &self.sess.included_mod_stack; let mut err = ~"circular modules: "; - foreach p in stack.slice(i, stack.len()).iter() { + for p in stack.slice(i, stack.len()).iter() { err.push_str(p.to_str()); err.push_str(" -> "); } @@ -4252,7 +4250,7 @@ impl Parser { let mut fields: ~[@struct_field] = ~[]; while *self.token != token::RBRACE { let r = self.parse_struct_decl_field(); - foreach struct_field in r.iter() { + for struct_field in r.iter() { fields.push(*struct_field); } } @@ -4292,7 +4290,7 @@ impl Parser { seq_sep_trailing_disallowed(token::COMMA), |p| p.parse_ty(false) ); - foreach ty in arg_tys.consume_iter() { + for ty in arg_tys.consume_iter() { args.push(ast::variant_arg { ty: ty, id: self.get_id(), @@ -4401,7 +4399,7 @@ impl Parser { self.bump(); let the_string = ident_to_str(&s); let mut abis = AbiSet::empty(); - foreach word in the_string.word_iter() { + for word in the_string.word_iter() { match abi::lookup(word) { Some(abi) => { if abis.contains(abi) { diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 706357320a5..39668e5c8b2 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -471,10 +471,9 @@ fn mk_fresh_ident_interner() -> @ident_interner { "use", // 61 "while", // 62 "in", // 63 - "foreach", // 64 - "be", // 65 - "pure", // 66 + "be", // 64 + "pure", // 65 ]; @ident_interner { @@ -571,7 +570,6 @@ pub mod keywords { False, Fn, For, - ForEach, If, Impl, In, @@ -615,7 +613,6 @@ pub mod keywords { False => ident { name: 39, ctxt: 0 }, Fn => ident { name: 40, ctxt: 0 }, For => ident { name: 41, ctxt: 0 }, - ForEach => ident { name: 64, ctxt: 0 }, If => ident { name: 42, ctxt: 0 }, Impl => ident { name: 43, ctxt: 0 }, In => ident { name: 63, ctxt: 0 }, @@ -628,7 +625,7 @@ pub mod keywords { Once => ident { name: 50, ctxt: 0 }, Priv => ident { name: 51, ctxt: 0 }, Pub => ident { name: 52, ctxt: 0 }, - Pure => ident { name: 66, ctxt: 0 }, + Pure => ident { name: 65, ctxt: 0 }, Ref => ident { name: 53, ctxt: 0 }, Return => ident { name: 54, ctxt: 0 }, Static => ident { name: 27, ctxt: 0 }, @@ -641,7 +638,7 @@ pub mod keywords { Unsafe => ident { name: 60, ctxt: 0 }, Use => ident { name: 61, ctxt: 0 }, While => ident { name: 62, ctxt: 0 }, - Be => ident { name: 65, ctxt: 0 }, + Be => ident { name: 64, ctxt: 0 }, } } } @@ -657,7 +654,7 @@ pub fn is_keyword(kw: keywords::Keyword, tok: &Token) -> bool { pub fn is_any_keyword(tok: &Token) -> bool { match *tok { token::IDENT(sid, false) => match sid.name { - 8 | 27 | 32 .. 66 => true, + 8 | 27 | 32 .. 65 => true, _ => false, }, _ => false @@ -667,7 +664,7 @@ pub fn is_any_keyword(tok: &Token) -> bool { pub fn is_strict_keyword(tok: &Token) -> bool { match *tok { token::IDENT(sid, false) => match sid.name { - 8 | 27 | 32 .. 64 => true, + 8 | 27 | 32 .. 63 => true, _ => false, }, _ => false, @@ -677,7 +674,7 @@ pub fn is_strict_keyword(tok: &Token) -> bool { pub fn is_reserved_keyword(tok: &Token) -> bool { match *tok { token::IDENT(sid, false) => match sid.name { - 65 .. 66 => true, + 64 .. 65 => true, _ => false, }, _ => false, |
