File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -205,15 +205,15 @@ impl Executor {
205
205
}
206
206
207
207
/// Show inside the stack
208
- fn show_stack ( & mut self ) {
209
- self . log_print ( format ! (
208
+ fn show_stack ( & mut self ) -> String {
209
+ format ! (
210
210
"Stack〔 {} 〕" ,
211
211
self . stack
212
212
. iter( )
213
213
. map( |x| x. display( ) )
214
214
. collect:: <Vec <_>>( )
215
215
. join( " | " )
216
- ) )
216
+ )
217
217
}
218
218
219
219
/// Parse token by analyzing syntax
@@ -277,8 +277,9 @@ impl Executor {
277
277
let syntax: Vec < String > = self . analyze_syntax ( code) ;
278
278
279
279
for token in syntax {
280
- self . show_stack ( ) ; // Show inside stack to debug
281
- self . log_print ( format ! ( " ← {}\n " , token) ) ;
280
+ // Show inside stack to debug
281
+ let stack = self . show_stack ( ) ;
282
+ self . log_print ( format ! ( "{stack} ← {token}\n " ) ) ;
282
283
283
284
// Character vector for token processing
284
285
let chars: Vec < char > = token. chars ( ) . collect ( ) ;
@@ -322,8 +323,8 @@ impl Executor {
322
323
}
323
324
324
325
// Show inside stack, after execution
325
- self . show_stack ( ) ;
326
- self . log_print ( " \n ". to_string ( ) ) ;
326
+ let stack = self . show_stack ( ) ;
327
+ self . log_print ( format ! ( "{stack} \n ") ) ;
327
328
}
328
329
329
330
/// execute string as commands
You can’t perform that action at this time.
0 commit comments