mirror of
https://github.com/uutils/coreutils
synced 2024-12-14 07:12:44 +00:00
expr: check prefix operation
This commit is contained in:
parent
a0ac3dd229
commit
17d21d2d9c
1 changed files with 6 additions and 2 deletions
|
@ -332,8 +332,12 @@ fn push_token_to_either_stack(
|
|||
}
|
||||
|
||||
Token::PrefixOp { .. } | Token::ParOpen => {
|
||||
op_stack.push((token_idx, token.clone()));
|
||||
Ok(())
|
||||
if out_stack.is_empty() {
|
||||
op_stack.push((token_idx, token.clone()));
|
||||
Ok(())
|
||||
} else {
|
||||
Err(String::from("syntax error (operation should be prefix)"))
|
||||
}
|
||||
}
|
||||
|
||||
Token::ParClose => move_till_match_paren(out_stack, op_stack),
|
||||
|
|
Loading…
Reference in a new issue