File tree Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -287,12 +287,12 @@ impl Executor {
287
287
_ => {
288
288
if parentheses == 0 && brackets == 0 && !hash {
289
289
if escape {
290
- buffer . push ( match c {
291
- 'n' => '\n' ,
292
- 't' => '\t' ,
293
- 'r' => '\r' ,
294
- _ => c ,
295
- } )
290
+ match c {
291
+ 'n' => buffer . push_str ( " \\ n" ) ,
292
+ 't' => buffer . push_str ( " \\ t" ) ,
293
+ 'r' => buffer . push_str ( " \\ r" ) ,
294
+ _ => buffer . push ( c ) ,
295
+ }
296
296
} else {
297
297
buffer. push ( c) ;
298
298
}
@@ -374,12 +374,12 @@ impl Executor {
374
374
_ => {
375
375
if parentheses == 0 && brackets == 0 && !hash {
376
376
if escape {
377
- buffer . push ( match c {
378
- 'n' => '\n' ,
379
- 't' => '\t' ,
380
- 'r' => '\r' ,
381
- _ => c ,
382
- } )
377
+ match c {
378
+ 'n' => buffer . push_str ( " \\ n" ) ,
379
+ 't' => buffer . push_str ( " \\ t" ) ,
380
+ 'r' => buffer . push_str ( " \\ r" ) ,
381
+ _ => buffer . push ( c ) ,
382
+ }
383
383
} else {
384
384
buffer. push ( c) ;
385
385
}
@@ -700,6 +700,11 @@ impl Executor {
700
700
// Standard output
701
701
"print" => {
702
702
let a = self . pop_stack ( ) . get_string ( ) ;
703
+
704
+ let a = a. replace ( "\\ n" , "\n " ) ;
705
+ let a = a. replace ( "\\ t" , "\t " ) ;
706
+ let a = a. replace ( "\\ r" , "\r " ) ;
707
+
703
708
if let Mode :: Debug = self . mode {
704
709
println ! ( "[Output]: {a}" ) ;
705
710
} else {
You can’t perform that action at this time.
0 commit comments