@@ -39,14 +39,6 @@ use cmp::Eq;
39
39
Cn Unassigned a reserved unassigned code point or a noncharacter
40
40
*/
41
41
42
- export is_alphabetic,
43
- is_XID_start, is_XID_continue,
44
- is_lowercase, is_uppercase,
45
- is_whitespace, is_alphanumeric,
46
- is_ascii, is_digit,
47
- to_digit, cmp,
48
- escape_default, escape_unicode;
49
-
50
42
pub use is_alphabetic = unicode:: derived_property:: Alphabetic ;
51
43
pub use is_XID_start = unicode:: derived_property:: XID_Start ;
52
44
pub use is_XID_continue = unicode:: derived_property:: XID_Continue ;
@@ -56,15 +48,15 @@ pub use is_XID_continue = unicode::derived_property::XID_Continue;
56
48
* Indicates whether a character is in lower case, defined
57
49
* in terms of the Unicode General Category 'Ll'
58
50
*/
59
- pure fn is_lowercase ( c : char ) -> bool {
51
+ pub pure fn is_lowercase ( c : char ) -> bool {
60
52
return unicode:: general_category:: Ll ( c) ;
61
53
}
62
54
63
55
/**
64
56
* Indicates whether a character is in upper case, defined
65
57
* in terms of the Unicode General Category 'Lu'.
66
58
*/
67
- pure fn is_uppercase ( c : char ) -> bool {
59
+ pub pure fn is_uppercase ( c : char ) -> bool {
68
60
return unicode:: general_category:: Lu ( c) ;
69
61
}
70
62
@@ -73,7 +65,7 @@ pure fn is_uppercase(c: char) -> bool {
73
65
* terms of the Unicode General Categories 'Zs', 'Zl', 'Zp'
74
66
* additional 'Cc'-category control codes in the range [0x09, 0x0d]
75
67
*/
76
- pure fn is_whitespace ( c : char ) -> bool {
68
+ pub pure fn is_whitespace ( c : char ) -> bool {
77
69
return ( '\x09' <= c && c <= '\x0d' )
78
70
|| unicode:: general_category:: Zs ( c)
79
71
|| unicode:: general_category:: Zl ( c)
@@ -85,20 +77,20 @@ pure fn is_whitespace(c: char) -> bool {
85
77
* defined in terms of the Unicode General Categories 'Nd', 'Nl', 'No'
86
78
* and the Derived Core Property 'Alphabetic'.
87
79
*/
88
- pure fn is_alphanumeric ( c : char ) -> bool {
80
+ pub pure fn is_alphanumeric ( c : char ) -> bool {
89
81
return unicode:: derived_property:: Alphabetic ( c) ||
90
82
unicode:: general_category:: Nd ( c) ||
91
83
unicode:: general_category:: Nl ( c) ||
92
84
unicode:: general_category:: No ( c) ;
93
85
}
94
86
95
87
/// Indicates whether the character is an ASCII character
96
- pure fn is_ascii ( c : char ) -> bool {
88
+ pub pure fn is_ascii ( c : char ) -> bool {
97
89
c - ( '\x7F' & c) == '\x00'
98
90
}
99
91
100
92
/// Indicates whether the character is numeric (Nd, Nl, or No)
101
- pure fn is_digit ( c : char ) -> bool {
93
+ pub pure fn is_digit ( c : char ) -> bool {
102
94
return unicode:: general_category:: Nd ( c) ||
103
95
unicode:: general_category:: Nl ( c) ||
104
96
unicode:: general_category:: No ( c) ;
@@ -114,7 +106,7 @@ pure fn is_digit(c: char) -> bool {
114
106
* 'b' or 'B', 11, etc. Returns none if the char does not
115
107
* refer to a digit in the given radix.
116
108
*/
117
- pure fn to_digit ( c : char , radix : uint ) -> Option < uint > {
109
+ pub pure fn to_digit ( c : char , radix : uint ) -> Option < uint > {
118
110
let val = match c {
119
111
'0' .. '9' => c as uint - ( '0' as uint ) ,
120
112
'a' .. 'z' => c as uint + 10 u - ( 'a' as uint ) ,
@@ -134,7 +126,7 @@ pure fn to_digit(c: char, radix: uint) -> Option<uint> {
134
126
* - chars in [0x100,0xffff] get 4-digit escapes: `\\uNNNN`
135
127
* - chars above 0x10000 get 8-digit escapes: `\\UNNNNNNNN`
136
128
*/
137
- fn escape_unicode ( c : char ) -> ~str {
129
+ pub fn escape_unicode ( c : char ) -> ~str {
138
130
let s = u32:: to_str ( c as u32 , 16 u) ;
139
131
let ( c, pad) = ( if c <= '\xff' { ( 'x' , 2 u) }
140
132
else if c <= '\uffff' { ( 'u' , 4 u) }
@@ -159,7 +151,7 @@ fn escape_unicode(c: char) -> ~str {
159
151
* - Any other chars in the range [0x20,0x7e] are not escaped.
160
152
* - Any other chars are given hex unicode escapes; see `escape_unicode`.
161
153
*/
162
- fn escape_default ( c : char ) -> ~str {
154
+ pub fn escape_default ( c : char ) -> ~str {
163
155
match c {
164
156
'\t' => ~"\\ t",
165
157
'\r' => ~"\\ r",
@@ -179,7 +171,7 @@ fn escape_default(c: char) -> ~str {
179
171
*
180
172
* -1 if a < b, 0 if a == b, +1 if a > b
181
173
*/
182
- pure fn cmp ( a : char , b : char ) -> int {
174
+ pub pure fn cmp ( a : char , b : char ) -> int {
183
175
return if b > a { -1 }
184
176
else if b < a { 1 }
185
177
else { 0 }
0 commit comments