diff options
| author | Graydon Hoare <graydon@mozilla.com> | 2011-12-13 16:25:51 -0800 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2011-12-13 16:34:50 -0800 |
| commit | fa9ad984fb2f013baebdbe01a42baa3b9101dd84 (patch) | |
| tree | 49115690e45ca322337b93f25308cd618f85b013 /src/comp/syntax | |
| parent | 32087f5c2a35bf8050067c22a57fd60269633a60 (diff) | |
| download | rust-fa9ad984fb2f013baebdbe01a42baa3b9101dd84.tar.gz rust-fa9ad984fb2f013baebdbe01a42baa3b9101dd84.zip | |
Copy first batch of material from libstd to libcore.
Diffstat (limited to 'src/comp/syntax')
| -rw-r--r-- | src/comp/syntax/ast.rs | 2 | ||||
| -rw-r--r-- | src/comp/syntax/ast_util.rs | 7 | ||||
| -rw-r--r-- | src/comp/syntax/codemap.rs | 5 | ||||
| -rw-r--r-- | src/comp/syntax/ext/base.rs | 2 | ||||
| -rw-r--r-- | src/comp/syntax/ext/concat_idents.rs | 2 | ||||
| -rw-r--r-- | src/comp/syntax/ext/env.rs | 3 | ||||
| -rw-r--r-- | src/comp/syntax/ext/expand.rs | 4 | ||||
| -rw-r--r-- | src/comp/syntax/ext/fmt.rs | 16 | ||||
| -rw-r--r-- | src/comp/syntax/ext/ident_to_str.rs | 2 | ||||
| -rw-r--r-- | src/comp/syntax/ext/log_syntax.rs | 2 | ||||
| -rw-r--r-- | src/comp/syntax/ext/simplext.rs | 2 | ||||
| -rw-r--r-- | src/comp/syntax/fold.rs | 2 | ||||
| -rw-r--r-- | src/comp/syntax/parse/eval.rs | 5 | ||||
| -rw-r--r-- | src/comp/syntax/parse/lexer.rs | 11 | ||||
| -rw-r--r-- | src/comp/syntax/parse/parser.rs | 7 | ||||
| -rw-r--r-- | src/comp/syntax/parse/token.rs | 2 | ||||
| -rw-r--r-- | src/comp/syntax/print/pp.rs | 3 | ||||
| -rw-r--r-- | src/comp/syntax/print/pprust.rs | 3 | ||||
| -rw-r--r-- | src/comp/syntax/util/interner.rs | 5 | ||||
| -rw-r--r-- | src/comp/syntax/visit.rs | 4 |
20 files changed, 49 insertions, 40 deletions
diff --git a/src/comp/syntax/ast.rs b/src/comp/syntax/ast.rs index 30acee6dc68..a20d1ae5c6f 100644 --- a/src/comp/syntax/ast.rs +++ b/src/comp/syntax/ast.rs @@ -1,6 +1,6 @@ // The Rust abstract syntax tree. -import std::option; +import option; import codemap::{span, filename}; type spanned<T> = {node: T, span: span}; diff --git a/src/comp/syntax/ast_util.rs b/src/comp/syntax/ast_util.rs index 794d4bf5339..2ab55edcb74 100644 --- a/src/comp/syntax/ast_util.rs +++ b/src/comp/syntax/ast_util.rs @@ -1,4 +1,5 @@ -import std::{str, option, int, map}; +import core::{str, option, int}; +import std::map; import codemap::span; import ast::*; @@ -212,7 +213,7 @@ fn is_constraint_arg(e: @expr) -> bool { } } -fn eq_ty(&&a: @ty, &&b: @ty) -> bool { ret std::box::ptr_eq(a, b); } +fn eq_ty(&&a: @ty, &&b: @ty) -> bool { ret box::ptr_eq(a, b); } fn hash_ty(&&t: @ty) -> uint { let res = (t.span.lo << 16u) + t.span.hi; @@ -333,7 +334,7 @@ fn lit_to_const(lit: @lit) -> const_val { lit_str(s) { const_str(s) } lit_int(n, _) { const_int(n) } lit_uint(n, _) { const_uint(n) } - lit_float(n, _) { const_float(std::float::from_str(n)) } + lit_float(n, _) { const_float(float::from_str(n)) } lit_nil. { const_int(0i64) } lit_bool(b) { const_int(b as i64) } } diff --git a/src/comp/syntax/codemap.rs b/src/comp/syntax/codemap.rs index 106a4dae46a..9725517ed28 100644 --- a/src/comp/syntax/codemap.rs +++ b/src/comp/syntax/codemap.rs @@ -1,5 +1,6 @@ -import std::{vec, uint, str, term, io, option, result}; -import std::option::{some, none}; +import core::{vec, uint, str, option, result}; +import std::{term, io}; +import option::{some, none}; type filename = str; diff --git a/src/comp/syntax/ext/base.rs b/src/comp/syntax/ext/base.rs index 55948be708f..55294000f66 100644 --- a/src/comp/syntax/ext/base.rs +++ b/src/comp/syntax/ext/base.rs @@ -1,4 +1,4 @@ -import std::{vec, option}; +import core::{vec, option}; import std::map::hashmap; import driver::session::session; import codemap::span; diff --git a/src/comp/syntax/ext/concat_idents.rs b/src/comp/syntax/ext/concat_idents.rs index 711a180c9a0..c487a3ecc36 100644 --- a/src/comp/syntax/ext/concat_idents.rs +++ b/src/comp/syntax/ext/concat_idents.rs @@ -1,4 +1,4 @@ -import std::option; +import option; import base::*; import syntax::ast; diff --git a/src/comp/syntax/ext/env.rs b/src/comp/syntax/ext/env.rs index 413ea1ac9d3..0b536159367 100644 --- a/src/comp/syntax/ext/env.rs +++ b/src/comp/syntax/ext/env.rs @@ -4,7 +4,8 @@ * should all get sucked into either the compiler syntax extension plugin * interface. */ -import std::{vec, option, generic_os}; +import core::{vec, option}; +import std::generic_os; import base::*; export expand_syntax_ext; diff --git a/src/comp/syntax/ext/expand.rs b/src/comp/syntax/ext/expand.rs index 072f773e4da..ef2105b4271 100644 --- a/src/comp/syntax/ext/expand.rs +++ b/src/comp/syntax/ext/expand.rs @@ -1,9 +1,9 @@ import driver::session; -import std::option::{none, some}; +import option::{none, some}; import std::map::hashmap; -import std::{vec}; +import vec; import syntax::ast::{crate, expr_, expr_mac, mac_invoc}; import syntax::fold::*; diff --git a/src/comp/syntax/ext/fmt.rs b/src/comp/syntax/ext/fmt.rs index 2d36d973870..c8721d058a3 100644 --- a/src/comp/syntax/ext/fmt.rs +++ b/src/comp/syntax/ext/fmt.rs @@ -5,9 +5,9 @@ * should all get sucked into either the standard library extfmt module or the * compiler syntax extension plugin interface. */ -import std::{vec, str, option}; -import std::option::{some}; -import std::extfmt::ct::*; +import core::{vec, str, option}; +import option::{some}; +import extfmt::ct::*; import base::*; import codemap::span; export expand_syntax_ext; @@ -257,7 +257,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, pieces: [piece], args: [@ast::expr]) } fn log_conv(c: conv) { alt c.param { - some(p) { log "param: " + std::int::to_str(p, 10u); } + some(p) { log "param: " + int::to_str(p, 10u); } _ { log "param: none"; } } for f: flag in c.flags { @@ -270,17 +270,17 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, pieces: [piece], args: [@ast::expr]) } } alt c.width { - count_is(i) { log "width: count is " + std::int::to_str(i, 10u); } + count_is(i) { log "width: count is " + int::to_str(i, 10u); } count_is_param(i) { - log "width: count is param " + std::int::to_str(i, 10u); + log "width: count is param " + int::to_str(i, 10u); } count_is_next_param. { log "width: count is next param"; } count_implied. { log "width: count is implied"; } } alt c.precision { - count_is(i) { log "prec: count is " + std::int::to_str(i, 10u); } + count_is(i) { log "prec: count is " + int::to_str(i, 10u); } count_is_param(i) { - log "prec: count is param " + std::int::to_str(i, 10u); + log "prec: count is param " + int::to_str(i, 10u); } count_is_next_param. { log "prec: count is next param"; } count_implied. { log "prec: count is implied"; } diff --git a/src/comp/syntax/ext/ident_to_str.rs b/src/comp/syntax/ext/ident_to_str.rs index 5a08399da49..d6093b61dbf 100644 --- a/src/comp/syntax/ext/ident_to_str.rs +++ b/src/comp/syntax/ext/ident_to_str.rs @@ -1,4 +1,4 @@ -import std::{vec, option}; +import core::{vec, option}; import base::*; import syntax::ast; diff --git a/src/comp/syntax/ext/log_syntax.rs b/src/comp/syntax/ext/log_syntax.rs index 67b92913602..40bc90e510d 100644 --- a/src/comp/syntax/ext/log_syntax.rs +++ b/src/comp/syntax/ext/log_syntax.rs @@ -1,4 +1,4 @@ -import std::{option}; +import option; import base::*; import syntax::ast; diff --git a/src/comp/syntax/ext/simplext.rs b/src/comp/syntax/ext/simplext.rs index 96d214584e7..8243483f2c4 100644 --- a/src/comp/syntax/ext/simplext.rs +++ b/src/comp/syntax/ext/simplext.rs @@ -1,7 +1,7 @@ use std; import codemap::span; -import std::{vec, option}; +import core::{vec, option}; import std::map::{hashmap, new_str_hash}; import option::{some, none}; diff --git a/src/comp/syntax/fold.rs b/src/comp/syntax/fold.rs index ce82c4d7c3b..fc1a45366fe 100644 --- a/src/comp/syntax/fold.rs +++ b/src/comp/syntax/fold.rs @@ -1,7 +1,7 @@ import syntax::codemap::span; import ast::*; -import std::{vec, option}; +import core::{vec, option}; export ast_fold_precursor; export ast_fold; diff --git a/src/comp/syntax/parse/eval.rs b/src/comp/syntax/parse/eval.rs index bc8a51e1f34..2b0fcab9b8e 100644 --- a/src/comp/syntax/parse/eval.rs +++ b/src/comp/syntax/parse/eval.rs @@ -1,7 +1,8 @@ import front::attr; -import std::{option, result, io, fs}; -import std::option::{some, none}; +import core::{option, result}; +import std::{io, fs}; +import option::{some, none}; import syntax::ast; import syntax::parse::token; import syntax::parse::parser::{parser, new_parser_from_file, diff --git a/src/comp/syntax/parse/lexer.rs b/src/comp/syntax/parse/lexer.rs index bd841b94051..299a7ecafeb 100644 --- a/src/comp/syntax/parse/lexer.rs +++ b/src/comp/syntax/parse/lexer.rs @@ -1,6 +1,7 @@ -import std::{io, vec, str, option, either}; -import std::option::{some, none}; +import core::{vec, str, option, either}; +import std::io; +import option::{some, none}; import util::interner; import util::interner::intern; import codemap; @@ -180,7 +181,7 @@ fn scan_digits(rdr: reader, radix: uint) -> str { while true { let c = rdr.curr(); if c == '_' { rdr.bump(); cont; } - alt std::char::maybe_digit(c) { + alt char::maybe_digit(c) { some(d) when (d as uint) < radix { str::push_byte(rslt, c as u8); rdr.bump(); @@ -232,7 +233,7 @@ fn scan_number(c: char, rdr: reader) -> token::token { tp = signed ? either::left(ast::ty_i64) : either::right(ast::ty_u64); } - let parsed = std::u64::from_str(num_str, base as u64); + let parsed = u64::from_str(num_str, base as u64); alt tp { either::left(t) { ret token::LIT_INT(parsed as i64, t); } either::right(t) { ret token::LIT_UINT(parsed, t); } @@ -276,7 +277,7 @@ fn scan_number(c: char, rdr: reader) -> token::token { ret token::LIT_FLOAT(interner::intern(*rdr.get_interner(), num_str), ast::ty_f); } else { - let parsed = std::u64::from_str(num_str, base as u64); + let parsed = u64::from_str(num_str, base as u64); ret token::LIT_INT(parsed as i64, ast::ty_i); } } diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index 7b8bd726eed..7ff08181e1a 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -1,7 +1,8 @@ -import std::{io, vec, str, option, either, result, fs}; -import std::option::{some, none}; -import std::either::{left, right}; +import core::{vec, str, option, either, result}; +import std::{io, fs}; +import option::{some, none}; +import either::{left, right}; import std::map::{hashmap, new_str_hash}; import token::can_begin_expr; import codemap::span; diff --git a/src/comp/syntax/parse/token.rs b/src/comp/syntax/parse/token.rs index 6740ba74c00..5ff688ecc68 100644 --- a/src/comp/syntax/parse/token.rs +++ b/src/comp/syntax/parse/token.rs @@ -1,6 +1,6 @@ import util::interner; -import std::{int, uint, str}; +import core::{int, uint, str}; type str_num = uint; diff --git a/src/comp/syntax/print/pp.rs b/src/comp/syntax/print/pp.rs index 19f2b007594..b870f9f93da 100644 --- a/src/comp/syntax/print/pp.rs +++ b/src/comp/syntax/print/pp.rs @@ -1,5 +1,6 @@ -import std::{io, vec, str}; +import core::{vec, str}; +import std::io; /* * This pretty-printer is a direct reimplementation of Philip Karlton's diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs index ff28edd057a..f58bea2ee74 100644 --- a/src/comp/syntax/print/pprust.rs +++ b/src/comp/syntax/print/pprust.rs @@ -1,5 +1,6 @@ -import std::{vec, int, io, str, uint, option}; +import core::{vec, int, str, uint, option}; +import std::io; import parse::lexer; import syntax::codemap::codemap; import ast; diff --git a/src/comp/syntax/util/interner.rs b/src/comp/syntax/util/interner.rs index 6993eeee35e..2c1589085f2 100644 --- a/src/comp/syntax/util/interner.rs +++ b/src/comp/syntax/util/interner.rs @@ -1,9 +1,10 @@ // 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. -import std::{vec, map}; +import core::vec; +import std::map; import std::map::{hashmap, hashfn, eqfn}; -import std::option::{none, some}; +import option::{none, some}; type interner<T> = {map: hashmap<T, uint>, diff --git a/src/comp/syntax/visit.rs b/src/comp/syntax/visit.rs index 9e61d82287c..310d169805b 100644 --- a/src/comp/syntax/visit.rs +++ b/src/comp/syntax/visit.rs @@ -1,7 +1,7 @@ import ast::*; -import std::option; -import std::option::{none, some}; +import option; +import option::{none, some}; import codemap::span; |
