Skip to content

Commit 62a4a54

Browse files
author
梶塚太智
committed
Update main.rs
Implement command `size-stack` can get length of stack
1 parent 99745cf commit 62a4a54

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/main.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,12 @@ impl Executor {
729729
self.pop_stack();
730730
}
731731

732+
// スタックのサイズを取得
733+
"size-stack" => {
734+
let len: f64 = self.stack.len() as f64;
735+
self.stack.push(Type::Number(len));
736+
}
737+
732738
// 変数の定義
733739
"var" => {
734740
let name = self.pop_stack().get_string(); // 変数名

0 commit comments

Comments
 (0)