mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37: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 => {
|
Token::PrefixOp { .. } | Token::ParOpen => {
|
||||||
op_stack.push((token_idx, token.clone()));
|
if out_stack.is_empty() {
|
||||||
Ok(())
|
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),
|
Token::ParClose => move_till_match_paren(out_stack, op_stack),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue