diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2024-05-30 06:59:27 -0700 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2024-05-30 06:59:27 -0700 |
| commit | fde7d934187f2919a3cf08b6361885951dad6e3e (patch) | |
| tree | 833e5a9dd5e4fdc6edd9d465279c8fcfa13b227a | |
| parent | 60055a7d863a2ae476dc02ac77b3ee66429aaa39 (diff) | |
| download | qc-fde7d934187f2919a3cf08b6361885951dad6e3e.tar.zst | |
Fix unary minus.
Unary minus needs to bind more closely than ^, in order to
parse -2^2 correctly.
| -rw-r--r-- | src/parser.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/parser.rs b/src/parser.rs index 4a87fda..badf286 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -72,7 +72,7 @@ impl<'a> Parser<'a> { fn parse_fun(&mut self) -> bool { if self.symbol("-") { self.stack.push(Op::Op { - prec: 0, + prec: 3, eval: Box::new(|n| eval::int(0).sub(n)), }); return true; |
