@@ -122,14 +122,14 @@ def ch_prefix(ix):
122
122
123
123
def emit_bsearch_range_table (f ):
124
124
f .write ("""
125
- pure fn bsearch_range_table(c: char, r: &[(char,char)]) -> bool {
126
- use cmp::{EQ, LT, GT };
125
+ fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
126
+ use cmp::{Equal, Less, Greater };
127
127
use vec::bsearch;
128
128
use option::None;
129
129
(do bsearch(r) |&(lo,hi)| {
130
- if lo <= c && c <= hi { EQ }
131
- else if hi < c { LT }
132
- else { GT }
130
+ if lo <= c && c <= hi { Equal }
131
+ else if hi < c { Less }
132
+ else { Greater }
133
133
}) != None
134
134
}\n \n
135
135
""" );
@@ -140,15 +140,15 @@ def emit_property_module(f, mod, tbl):
140
140
keys .sort ()
141
141
emit_bsearch_range_table (f );
142
142
for cat in keys :
143
- f .write (" const %s_table : &[(char,char)] = &[\n " % cat )
143
+ f .write (" static %s_table : &'static [(char,char)] = &[\n " % cat )
144
144
ix = 0
145
145
for pair in tbl [cat ]:
146
146
f .write (ch_prefix (ix ))
147
147
f .write ("(%s, %s)" % (escape_char (pair [0 ]), escape_char (pair [1 ])))
148
148
ix += 1
149
149
f .write ("\n ];\n \n " )
150
150
151
- f .write (" pub pure fn %s(c: char) -> bool {\n " % cat )
151
+ f .write (" pub fn %s(c: char) -> bool {\n " % cat )
152
152
f .write (" bsearch_range_table(c, %s_table)\n " % cat )
153
153
f .write (" }\n \n " )
154
154
f .write ("}\n " )
@@ -159,7 +159,7 @@ def emit_property_module_old(f, mod, tbl):
159
159
keys = tbl .keys ()
160
160
keys .sort ()
161
161
for cat in keys :
162
- f .write (" pure fn %s(c: char) -> bool {\n " % cat )
162
+ f .write (" fn %s(c: char) -> bool {\n " % cat )
163
163
f .write (" ret alt c {\n " )
164
164
prefix = ' '
165
165
for pair in tbl [cat ]:
@@ -236,8 +236,22 @@ def emit_decomp_module(f, canon, compat):
236
236
237
237
(canon_decomp , compat_decomp , gencats ) = load_unicode_data ("UnicodeData.txt" )
238
238
239
- # Explain that the source code was generated by this script.
240
- rf .write ('// The following code was generated by "src/etc/unicode.py"\n \n ' )
239
+ # Preamble
240
+ rf .write ('''// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
241
+ // file at the top-level directory of this distribution and at
242
+ // http://rust-lang.org/COPYRIGHT.
243
+ //
244
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
245
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
246
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
247
+ // option. This file may not be copied, modified, or distributed
248
+ // except according to those terms.
249
+
250
+ // The following code was generated by "src/etc/unicode.py"
251
+
252
+ #[allow(missing_doc)];
253
+
254
+ ''' )
241
255
242
256
emit_property_module (rf , "general_category" , gencats )
243
257
0 commit comments