From aea1a08d6a9d378137d467d3e1f1ccc40232b725 Mon Sep 17 00:00:00 2001 From: Charlie Stanton Date: Wed, 19 Apr 2023 13:23:47 +0100 Subject: Adds the negate operator Negates all of the numbers produced by its content subex --- subex/parse.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'subex/parse.go') 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 { -- cgit v1.2.3