File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed
Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -180,15 +180,12 @@ impl Executor {
180180
181181 /// メモリの変数を表示
182182 fn show_variables ( & mut self ) {
183- self . log_print ( format ! (
184- "メモリ内部の変数 {{ {} }}\n " ,
185- self . memory
186- . clone( )
187- . iter( )
188- . map( |( name, value) | { format!( "'{name}': {}" , value. display( ) ) } )
189- . collect:: <Vec <String >>( )
190- . join( ", " )
191- ) ) ;
183+ self . log_print ( "メモリ内部の変数 {\n " . to_string ( ) ) ;
184+ let max = self . memory . keys ( ) . map ( |s| s. len ( ) ) . max ( ) . unwrap_or ( 0 ) ;
185+ for ( name, value) in self . memory . clone ( ) {
186+ self . log_print ( format ! ( " {:>width$}: {}\n " , name, value. display( ) , width=max) )
187+ }
188+ self . log_print ( "}\n " . to_string ( ) )
192189 }
193190
194191 // スタック内部を表示
@@ -212,7 +209,7 @@ impl Executor {
212209 let mut buffer = String :: new ( ) ; //トークンの仮保存
213210 let mut in_brackets = 0 ; // 文字列のネスト構造
214211 let mut in_parentheses = 0 ; // リストのネスト構造
215- let mut in_hash = false ; // コメントか否か
212+ let mut in_hash = false ; // コメントか否か
216213
217214 for c in code. chars ( ) {
218215 match c {
You can’t perform that action at this time.
0 commit comments