@@ -50,10 +50,10 @@ impl Encoder for EUCJPEncoder {
5050
5151 for ( ( i, j) , ch) in input. index_iter ( ) {
5252 match ch {
53- '\u0000' ..'\u007f' => { output. write_byte ( ch as u8 ) ; }
53+ '\u0000' ... '\u007f' => { output. write_byte ( ch as u8 ) ; }
5454 '\u00a5' => { output. write_byte ( 0x5c ) ; }
5555 '\u203e' => { output. write_byte ( 0x7e ) ; }
56- '\uff61' ..'\uff9f' => {
56+ '\uff61' ... '\uff9f' => {
5757 output. write_byte ( 0x8e ) ;
5858 output. write_byte ( ( ch as uint - 0xff61 + 0xa1 ) as u8 ) ;
5959 }
@@ -93,7 +93,7 @@ ascii_compatible_stateful_decoder! {
9393 let lead = lead as uint;
9494 let trail = trail as uint;
9595 let index = match ( lead, trail) {
96- ( 0xa1 ..0xfe , 0xa1 ..0xfe ) => ( lead - 0xa1 ) * 94 + trail - 0xa1 ,
96+ ( 0xa1 ... 0xfe , 0xa1 . ..0xfe ) => ( lead - 0xa1 ) * 94 + trail - 0xa1 ,
9797 _ => 0xffff ,
9898 } ;
9999 index:: jis0208:: forward( index as u16 )
@@ -105,39 +105,39 @@ ascii_compatible_stateful_decoder! {
105105 let lead = lead as uint;
106106 let trail = trail as uint;
107107 let index = match ( lead, trail) {
108- ( 0xa1 ..0xfe , 0xa1 ..0xfe ) => ( lead - 0xa1 ) * 94 + trail - 0xa1 ,
108+ ( 0xa1 ... 0xfe , 0xa1 . ..0xfe ) => ( lead - 0xa1 ) * 94 + trail - 0xa1 ,
109109 _ => 0xffff ,
110110 } ;
111111 index:: jis0212:: forward( index as u16 )
112112 }
113113
114114 // euc-jp lead = 0x00
115115 initial state S0 ( ctx) {
116- case b @ 0x00 ..0x7f => ctx. emit( b as u32 ) ;
116+ case b @ 0x00 ... 0x7f => ctx. emit( b as u32 ) ;
117117 case 0x8e => S1 ( ctx) ;
118118 case 0x8f => S2 ( ctx) ;
119- case b @ 0xa1 ..0xfe => S3 ( ctx, b) ;
119+ case b @ 0xa1 ... 0xfe => S3 ( ctx, b) ;
120120 case _ => ctx. err( "invalid sequence" ) ;
121121 }
122122
123123 // euc-jp lead = 0x8e
124124 state S1 ( ctx) {
125- case b @ 0xa1 ..0xdf => ctx. emit( 0xff61 + b as u32 - 0xa1 ) ;
126- case 0xa1 ..0xfe => ctx. err( "invalid sequence" ) ;
125+ case b @ 0xa1 ... 0xdf => ctx. emit( 0xff61 + b as u32 - 0xa1 ) ;
126+ case 0xa1 ... 0xfe => ctx. err( "invalid sequence" ) ;
127127 case _ => ctx. backup_and_err( 1 , "invalid sequence" ) ;
128128 }
129129
130130 // euc-jp lead = 0x8f
131131 // JIS X 0201 half-width katakana
132132 state S2 ( ctx) {
133- case b @ 0xa1 ..0xfe => S4 ( ctx, b) ;
133+ case b @ 0xa1 ... 0xfe => S4 ( ctx, b) ;
134134 case _ => ctx. backup_and_err( 1 , "invalid sequence" ) ;
135135 }
136136
137137 // euc-jp lead != 0x00, euc-jp jis0212 flag = unset
138138 // JIS X 0208 two-byte sequence
139139 state S3 ( ctx, lead: u8 ) {
140- case b @ 0xa1 ..0xfe => match map_two_0208_bytes( lead, b) {
140+ case b @ 0xa1 ... 0xfe => match map_two_0208_bytes( lead, b) {
141141 // do NOT backup, we only backup for out-of-range trails.
142142 0xffff => ctx. err( "invalid sequence" ) ,
143143 ch => ctx. emit( ch as u32 )
@@ -148,7 +148,7 @@ ascii_compatible_stateful_decoder! {
148148 // euc-jp lead != 0x00, euc-jp jis0212 flag = set
149149 // JIS X 0212 three-byte sequence
150150 state S4 ( ctx, lead: u8 ) {
151- case b @ 0xa1 ..0xfe => match map_two_0212_bytes( lead, b) {
151+ case b @ 0xa1 ... 0xfe => match map_two_0212_bytes( lead, b) {
152152 // do NOT backup, we only backup for out-of-range trails.
153153 0xffff => ctx. err( "invalid sequence" ) ,
154154 ch => ctx. emit( ch as u32 )
@@ -443,10 +443,10 @@ impl Encoder for Windows31JEncoder {
443443
444444 for ( ( i, j) , ch) in input. index_iter ( ) {
445445 match ch {
446- '\u0000' ..'\u0080' => { output. write_byte ( ch as u8 ) ; }
446+ '\u0000' ... '\u0080' => { output. write_byte ( ch as u8 ) ; }
447447 '\u00a5' => { output. write_byte ( 0x5c ) ; }
448448 '\u203e' => { output. write_byte ( 0x7e ) ; }
449- '\uff61' ..'\uff9f' => { output. write_byte ( ( ch as uint - 0xff61 + 0xa1 ) as u8 ) ; }
449+ '\uff61' ... '\uff9f' => { output. write_byte ( ( ch as uint - 0xff61 + 0xa1 ) as u8 ) ; }
450450 _ => {
451451 // corresponds to the "index shift_jis pointer" in the WHATWG spec
452452 let ptr = index:: jis0208:: backward_remapped ( ch as u32 ) ;
@@ -488,10 +488,10 @@ ascii_compatible_stateful_decoder! {
488488 let leadoffset = if lead < 0xa0 { 0x81 } else { 0xc1 } ;
489489 let trailoffset = if trail < 0x7f { 0x40 } else { 0x41 } ;
490490 let index = match ( lead, trail) {
491- ( 0xf0 ..0xf9 , 0x40 ..0x7e ) | ( 0xf0 ..0xf9 , 0x80 ..0xfc ) =>
491+ ( 0xf0 ... 0xf9 , 0x40 ... 0x7e ) | ( 0xf0 ... 0xf9 , 0x80 . ..0xfc ) =>
492492 return ( 0xe000 + ( lead - 0xf0 ) * 188 + trail - trailoffset) as u32 ,
493- ( 0x81 ..0x9f , 0x40 ..0x7e ) | ( 0x81 ..0x9f , 0x80 ..0xfc ) |
494- ( 0xe0 ..0xfc , 0x40 ..0x7e ) | ( 0xe0 ..0xfc , 0x80 ..0xfc ) =>
493+ ( 0x81 ... 0x9f , 0x40 ... 0x7e ) | ( 0x81 ... 0x9f , 0x80 . ..0xfc ) |
494+ ( 0xe0 ... 0xfc , 0x40 ... 0x7e ) | ( 0xe0 ... 0xfc , 0x80 . ..0xfc ) =>
495495 ( lead - leadoffset) * 188 + trail - trailoffset,
496496 _ => 0xffff ,
497497 } ;
@@ -500,9 +500,9 @@ ascii_compatible_stateful_decoder! {
500500
501501 // shift_jis lead = 0x00
502502 initial state S0 ( ctx) {
503- case b @ 0x00 ..0x80 => ctx. emit( b as u32 ) ;
504- case b @ 0xa1 ..0xdf => ctx. emit( 0xff61 + b as u32 - 0xa1 ) ;
505- case b @ 0x81 ..0x9f | b @ 0xe0 ..0xfc => S1 ( ctx, b) ;
503+ case b @ 0x00 ... 0x80 => ctx. emit( b as u32 ) ;
504+ case b @ 0xa1 ... 0xdf => ctx. emit( 0xff61 + b as u32 - 0xa1 ) ;
505+ case b @ 0x81 ... 0x9f | b @ 0xe0 . ..0xfc => S1 ( ctx, b) ;
506506 case _ => ctx. err( "invalid sequence" ) ;
507507 }
508508
@@ -758,10 +758,10 @@ impl Encoder for ISO2022JPEncoder {
758758
759759 for ( ( i, j) , ch) in input. index_iter ( ) {
760760 match ch {
761- '\u0000' ..'\u007f' => { ensure_ASCII ! ( ) ; output. write_byte ( ch as u8 ) ; }
761+ '\u0000' ... '\u007f' => { ensure_ASCII ! ( ) ; output. write_byte ( ch as u8 ) ; }
762762 '\u00a5' => { ensure_ASCII ! ( ) ; output. write_byte ( 0x5c ) ; }
763763 '\u203e' => { ensure_ASCII ! ( ) ; output. write_byte ( 0x7e ) ; }
764- '\uff61' ..'\uff9f' => {
764+ '\uff61' ... '\uff9f' => {
765765 ensure_Katakana ! ( ) ;
766766 output. write_byte ( ( ch as uint - 0xff61 + 0x21 ) as u8 ) ;
767767 }
@@ -807,7 +807,7 @@ stateful_decoder! {
807807 let lead = lead as uint;
808808 let trail = trail as uint;
809809 let index = match ( lead, trail) {
810- ( 0x21 ..0x7e , 0x21 ..0x7e ) => ( lead - 0x21 ) * 94 + trail - 0x21 ,
810+ ( 0x21 ... 0x7e , 0x21 . ..0x7e ) => ( lead - 0x21 ) * 94 + trail - 0x21 ,
811811 _ => 0xffff ,
812812 } ;
813813 index:: jis0208:: forward( index as u16 )
@@ -819,7 +819,7 @@ stateful_decoder! {
819819 let lead = lead as uint;
820820 let trail = trail as uint;
821821 let index = match ( lead, trail) {
822- ( 0x21 ..0x7e , 0x21 ..0x7e ) => ( lead - 0x21 ) * 94 + trail - 0x21 ,
822+ ( 0x21 ... 0x7e , 0x21 . ..0x7e ) => ( lead - 0x21 ) * 94 + trail - 0x21 ,
823823 _ => 0xffff ,
824824 } ;
825825 index:: jis0212:: forward( index as u16 )
@@ -828,7 +828,7 @@ stateful_decoder! {
828828 // iso-2022-jp state = ASCII, iso-2022-jp jis0212 flag = unset, iso-2022-jp lead = 0x00
829829 initial state ASCII ( ctx) {
830830 case 0x1b => EscapeStart ( ctx) ;
831- case b @ 0x00 ..0x7f => ctx. emit( b as u32 ) , ASCII ( ctx) ;
831+ case b @ 0x00 ... 0x7f => ctx. emit( b as u32 ) , ASCII ( ctx) ;
832832 case _ => ctx. err( "invalid sequence" ) , ASCII ( ctx) ;
833833 final => ctx. reset( ) ;
834834 }
@@ -852,7 +852,7 @@ stateful_decoder! {
852852 // iso-2022-jp state = Katakana
853853 checkpoint state Katakana ( ctx) {
854854 case 0x1b => EscapeStart ( ctx) ;
855- case b @ 0x21 ..0x5f => ctx. emit( 0xff61 + b as u32 - 0x21 ) , Katakana ( ctx) ;
855+ case b @ 0x21 ... 0x5f => ctx. emit( 0xff61 + b as u32 - 0x21 ) , Katakana ( ctx) ;
856856 case _ => ctx. err( "invalid sequence" ) , Katakana ( ctx) ;
857857 final => ctx. reset( ) ;
858858 }
0 commit comments