<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/subex/parse.go
diff options
context:
space:
mode:
authorCharlie Stanton <charlie@shtanton.xyz>2023-04-19 13:23:47 +0100
committerCharlie Stanton <charlie@shtanton.xyz>2023-04-19 13:27:38 +0100
commitaea1a08d6a9d378137d467d3e1f1ccc40232b725 (patch)
tree680e7c913b3ea782557d51968e24d7fa5c4d450a /subex/parse.go
parentb48dcb0d37bd3db854927df25e6ff41d07501026 (diff)
downloadstred-go-aea1a08d6a9d378137d467d3e1f1ccc40232b725.tar
Adds the negate operator
Negates all of the numbers produced by its content subex
Diffstat (limited to 'subex/parse.go')
-rw-r--r--subex/parse.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/subex/parse.go b/subex/parse.go
index f73d060..8635186 100644
--- a/subex/parse.go
+++ b/subex/parse.go
@@ -238,6 +238,8 @@ func parseSubex(l *RuneReader, minPower int) SubexAST {
lhs = SubexASTSum {lhs}
case r == '*' && minPower <= 8:
lhs = SubexASTProduct {lhs}
+ case r == '-' && minPower <= 8:
+ lhs = SubexASTNegate {lhs}
case r == '$' && minPower <= 8:
slot := l.next()
if slot == eof {