slight improvement

This commit is contained in:
JT 2021-08-09 09:34:21 +12:00
parent d2577acccd
commit 273f964293
2 changed files with 16 additions and 12 deletions

View File

@ -343,6 +343,22 @@ fn eval_call(state: &State, stack: Stack, call: &Call) -> Result<Value, ShellErr
Ok(Value::Nothing {
span: call.positional[0].span,
})
} else if decl.signature.name == "vars" {
state.parser_state.print_vars();
Ok(Value::Nothing {
span: call.positional[0].span,
})
} else if decl.signature.name == "decls" {
state.parser_state.print_decls();
Ok(Value::Nothing { span: call.head })
} else if decl.signature.name == "blocks" {
state.parser_state.print_blocks();
Ok(Value::Nothing { span: call.head })
} else if decl.signature.name == "stack" {
stack.print_stack();
Ok(Value::Nothing { span: call.head })
} else if decl.signature.name == "def" {
Ok(Value::Nothing { span: call.head })
} else {
Err(ShellError::Unsupported(call.head))
}

View File

@ -177,18 +177,6 @@ fn main() -> std::io::Result<()> {
Signal::Success(s) => {
if s.trim() == "exit" {
break;
} else if s.trim() == "vars" {
parser_state.borrow().print_vars();
continue;
} else if s.trim() == "decls" {
parser_state.borrow().print_decls();
continue;
} else if s.trim() == "blocks" {
parser_state.borrow().print_blocks();
continue;
} else if s.trim() == "stack" {
stack.print_stack();
continue;
}
// println!("input: '{}'", s);