mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 03:36:42 +01:00
input: better dsl error handling
This commit is contained in:
parent
8bfd1a23a1
commit
496a9202d5
2 changed files with 6 additions and 6 deletions
|
|
@ -51,19 +51,19 @@ impl<'state, S, C: DslCommand<'state, S>, I: DslInput> KeyMap<'state, S, C, I> f
|
|||
while let Some(next) = iter.next() {
|
||||
match next {
|
||||
Token { value: Value::Exp(0, exp_iter), .. } => {
|
||||
let mut exp_iter = exp_iter.clone();
|
||||
match exp_iter.next() {
|
||||
let mut e = exp_iter.clone();
|
||||
match e.next() {
|
||||
Some(Token { value: Value::Sym(binding), .. }) => {
|
||||
if input.matches_dsl(binding) {
|
||||
if let Some(command) = C::try_from_expr(state, &mut exp_iter) {
|
||||
if let Some(command) = C::try_from_expr(state, &mut e) {
|
||||
return Some(command)
|
||||
}
|
||||
}
|
||||
},
|
||||
_ => panic!("invalid config (expected symbol)")
|
||||
_ => panic!("invalid config (expected symbol, got: {exp_iter:?})")
|
||||
}
|
||||
},
|
||||
_ => panic!("invalid config (expected expression)")
|
||||
_ => panic!("invalid config (expected expression, got: {next:?})")
|
||||
}
|
||||
}
|
||||
None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue