File tree 2 files changed +33
-5
lines changed
2 files changed +33
-5
lines changed Original file line number Diff line number Diff line change @@ -201,12 +201,30 @@ where
201
201
let mut found_end = false ;
202
202
203
203
for ( _, & ch) in self . iter . by_ref ( ) {
204
- if ch == stop_ch && last_ch != b'\\' {
205
- found_end = true ;
206
- break ;
207
- } else if ch != b'\\' || last_ch == b'\\' {
208
- buf. push ( ch) ;
204
+ if last_ch != b'\\' {
205
+ if ch != stop_ch {
206
+ buf. push ( ch) ;
207
+ } else {
208
+ found_end = true ;
209
+ break ;
210
+ }
211
+ } else {
212
+ match ch {
213
+ b'n' => {
214
+ buf. push ( b'\n' ) ;
215
+ }
216
+ b'r' => {
217
+ buf. push ( b'\r' ) ;
218
+ }
219
+ b't' => {
220
+ buf. push ( b'\t' ) ;
221
+ }
222
+ _ => {
223
+ buf. push ( ch) ;
224
+ }
225
+ }
209
226
}
227
+
210
228
last_ch = ch;
211
229
}
212
230
Original file line number Diff line number Diff line change @@ -496,6 +496,16 @@ impl<'x> Iterator for Tokenizer<'x> {
496
496
self . push_byte ( ch) ;
497
497
}
498
498
_ => {
499
+ let ch = if last_ch == b'\\' {
500
+ match ch {
501
+ b'n' => b'\n' ,
502
+ b'r' => b'\r' ,
503
+ b't' => b'\t' ,
504
+ _ => ch,
505
+ }
506
+ } else {
507
+ ch
508
+ } ;
499
509
if !str_type. has_other && ch != b'-' {
500
510
str_type. has_other = true ;
501
511
self . state = State :: QuotedString ( str_type) ;
You can’t perform that action at this time.
0 commit comments