aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Anderson <[email protected]>2011-04-13 18:59:40 -0400
committerBrian Anderson <[email protected]>2011-04-13 22:13:21 -0400
commitaebdef0cd6dff87322f51850f72c42ccb54fbd53 (patch)
tree8b80cb4ca955f24f099bcca1360ed7b854eb486c
parentAdd ExtFmt test for unsigned type (diff)
downloadrust-aebdef0cd6dff87322f51850f72c42ccb54fbd53.tar.xz
rust-aebdef0cd6dff87322f51850f72c42ccb54fbd53.zip
Move #fmt conversion model into ExtFmt.CT namespace
-rw-r--r--src/comp/front/extfmt.rs57
-rw-r--r--src/lib/ExtFmt.rs88
2 files changed, 72 insertions, 73 deletions
diff --git a/src/comp/front/extfmt.rs b/src/comp/front/extfmt.rs
index 1884813d..3a12fb82 100644
--- a/src/comp/front/extfmt.rs
+++ b/src/comp/front/extfmt.rs
@@ -21,35 +21,34 @@ import std.option;
import std.option.none;
import std.option.some;
-import std.ExtFmt;
-import std.ExtFmt.signedness;
-import std.ExtFmt.signed;
-import std.ExtFmt.unsigned;
-import std.ExtFmt.caseness;
-import std.ExtFmt.case_upper;
-import std.ExtFmt.case_lower;
-import std.ExtFmt.ty;
-import std.ExtFmt.ty_bool;
-import std.ExtFmt.ty_str;
-import std.ExtFmt.ty_char;
-import std.ExtFmt.ty_int;
-import std.ExtFmt.ty_bits;
-import std.ExtFmt.ty_hex;
-import std.ExtFmt.flag;
-import std.ExtFmt.flag_left_justify;
-import std.ExtFmt.flag_left_zero_pad;
-import std.ExtFmt.flag_left_space_pad;
-import std.ExtFmt.flag_plus_if_positive;
-import std.ExtFmt.flag_alternate;
-import std.ExtFmt.count;
-import std.ExtFmt.count_is;
-import std.ExtFmt.count_is_param;
-import std.ExtFmt.count_is_next_param;
-import std.ExtFmt.count_implied;
-import std.ExtFmt.conv;
-import std.ExtFmt.piece;
-import std.ExtFmt.piece_string;
-import std.ExtFmt.piece_conv;
+import std.ExtFmt.CT.signedness;
+import std.ExtFmt.CT.signed;
+import std.ExtFmt.CT.unsigned;
+import std.ExtFmt.CT.caseness;
+import std.ExtFmt.CT.case_upper;
+import std.ExtFmt.CT.case_lower;
+import std.ExtFmt.CT.ty;
+import std.ExtFmt.CT.ty_bool;
+import std.ExtFmt.CT.ty_str;
+import std.ExtFmt.CT.ty_char;
+import std.ExtFmt.CT.ty_int;
+import std.ExtFmt.CT.ty_bits;
+import std.ExtFmt.CT.ty_hex;
+import std.ExtFmt.CT.flag;
+import std.ExtFmt.CT.flag_left_justify;
+import std.ExtFmt.CT.flag_left_zero_pad;
+import std.ExtFmt.CT.flag_left_space_pad;
+import std.ExtFmt.CT.flag_plus_if_positive;
+import std.ExtFmt.CT.flag_alternate;
+import std.ExtFmt.CT.count;
+import std.ExtFmt.CT.count_is;
+import std.ExtFmt.CT.count_is_param;
+import std.ExtFmt.CT.count_is_next_param;
+import std.ExtFmt.CT.count_implied;
+import std.ExtFmt.CT.conv;
+import std.ExtFmt.CT.piece;
+import std.ExtFmt.CT.piece_string;
+import std.ExtFmt.CT.piece_conv;
import std.ExtFmt.CT.parse_fmt_string;
export expand_syntax_ext;
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);