diff options
| author | Brian Anderson <[email protected]> | 2011-04-13 18:59:40 -0400 |
|---|---|---|
| committer | Brian Anderson <[email protected]> | 2011-04-13 22:13:21 -0400 |
| commit | aebdef0cd6dff87322f51850f72c42ccb54fbd53 (patch) | |
| tree | 8b80cb4ca955f24f099bcca1360ed7b854eb486c /src/lib | |
| parent | Add ExtFmt test for unsigned type (diff) | |
| download | rust-aebdef0cd6dff87322f51850f72c42ccb54fbd53.tar.xz rust-aebdef0cd6dff87322f51850f72c42ccb54fbd53.zip | |
Move #fmt conversion model into ExtFmt.CT namespace
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/ExtFmt.rs | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/src/lib/ExtFmt.rs b/src/lib/ExtFmt.rs index e08de7ee..35b9c5dd 100644 --- a/src/lib/ExtFmt.rs +++ b/src/lib/ExtFmt.rs @@ -1,56 +1,56 @@ import option.none; import option.some; -tag signedness { - signed; - unsigned; -} +// Functions used by the fmt extension at compile time +mod CT { + tag signedness { + signed; + unsigned; + } -tag caseness { - case_upper; - case_lower; -} + tag caseness { + case_upper; + case_lower; + } -tag ty { - ty_bool; - ty_str; - ty_char; - ty_int(signedness); - ty_bits; - ty_hex(caseness); - // FIXME: More types -} + tag ty { + ty_bool; + ty_str; + ty_char; + ty_int(signedness); + ty_bits; + ty_hex(caseness); + // FIXME: More types + } -tag flag { - flag_left_justify; - flag_left_zero_pad; - flag_left_space_pad; - flag_plus_if_positive; - flag_alternate; -} + tag flag { + flag_left_justify; + flag_left_zero_pad; + flag_left_space_pad; + flag_plus_if_positive; + flag_alternate; + } -tag count { - count_is(int); - count_is_param(int); - count_is_next_param; - count_implied; -} + tag count { + count_is(int); + count_is_param(int); + count_is_next_param; + count_implied; + } -// A formatted conversion from an expression to a string -type conv = rec(option.t[int] param, - vec[flag] flags, - count width, - count precision, - ty ty); - -// A fragment of the output sequence -tag piece { - piece_string(str); - piece_conv(conv); -} + // A formatted conversion from an expression to a string + type conv = rec(option.t[int] param, + vec[flag] flags, + count width, + count precision, + ty ty); + + // A fragment of the output sequence + tag piece { + piece_string(str); + piece_conv(conv); + } -// Functions used by the fmt extension at compile time -mod CT { fn parse_fmt_string(str s) -> vec[piece] { let vec[piece] pieces = vec(); auto lim = _str.byte_len(s); |