Copy first batch of material from libstd to libcore.
This commit is contained in:
parent
32087f5c2a
commit
fa9ad984fb
325 changed files with 5579 additions and 720 deletions
|
|
@ -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};
|
||||
|
|
|
|||
|
|
@ -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) }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import std::{vec, option};
|
||||
import core::{vec, option};
|
||||
import std::map::hashmap;
|
||||
import driver::session::session;
|
||||
import codemap::span;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import std::option;
|
||||
import option;
|
||||
import base::*;
|
||||
import syntax::ast;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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::*;
|
||||
|
|
|
|||
|
|
@ -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"; }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import std::{vec, option};
|
||||
import core::{vec, option};
|
||||
import base::*;
|
||||
import syntax::ast;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import std::{option};
|
||||
import option;
|
||||
import base::*;
|
||||
import syntax::ast;
|
||||
|
||||
|
|
|
|||
|
|
@ -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};
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
import util::interner;
|
||||
import std::{int, uint, str};
|
||||
import core::{int, uint, str};
|
||||
|
||||
type str_num = uint;
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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>,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
import ast::*;
|
||||
import std::option;
|
||||
import std::option::{none, some};
|
||||
import option;
|
||||
import option::{none, some};
|
||||
import codemap::span;
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue