aboutsummaryrefslogtreecommitdiff
path: root/src/comp/util/common.rs
blob: 9bcb67b2dc8303a6633f5f061fde29be102579e3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import std._uint;

type pos = rec(uint line, uint col);
type span = rec(str filename, pos lo, pos hi);

type ty_mach = tag( ty_i8(), ty_i16(), ty_i32(), ty_i64(),
                    ty_u8(), ty_u16(), ty_u32(), ty_u64(),
                    ty_f32(), ty_f64() );

fn ty_mach_to_str(ty_mach tm) -> str {
    alt (tm) {
        case (ty_u8()) { ret "u8"; }
        case (ty_u16()) { ret "u16"; }
        case (ty_u32()) { ret "u32"; }
        case (ty_u64()) { ret "u64"; }

        case (ty_i8()) { ret "i8"; }
        case (ty_i16()) { ret "i16"; }
        case (ty_i32()) { ret "i32"; }
        case (ty_i64()) { ret "i64"; }

        case (ty_f32()) { ret "f32"; }
        case (ty_f64()) { ret "f64"; }
    }
}

//
// Local Variables:
// mode: rust
// fill-column: 78;
// indent-tabs-mode: nil
// c-basic-offset: 4
// buffer-file-coding-system: utf-8-unix
// compile-command: "make -k -C ../.. 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
// End:
//