From e832b30f31c56614afe689035af4e04a29e77896 Mon Sep 17 00:00:00 2001 From: Charlie Stanton Date: Fri, 21 Jul 2023 19:53:14 +0100 Subject: Adds an incredibly simple equality operator --- subex/parse.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'subex/parse.go') diff --git a/subex/parse.go b/subex/parse.go index 2392b22..35baaa2 100644 --- a/subex/parse.go +++ b/subex/parse.go @@ -260,7 +260,7 @@ func parseSubex(l RuneReader, minPower int, runic bool) SubexAST { // case '[': // rangeParts := parseRangeSubex(l) // lhs = SubexASTRange {rangeParts} - case ')', ']', '"', '|', ';', '{', '+', '-', '*', '/', '!', '$': + case ')', ']', '"', '|', ';', '{', '+', '-', '*', '/', '!', '=', '$': l.Rewind() return SubexASTEmpty{} // case '=': @@ -366,6 +366,8 @@ func parseSubex(l RuneReader, minPower int, runic bool) SubexAST { lhs = SubexASTReciprocal {lhs} case r == '!' && minPower <= 4: lhs = SubexASTNot {lhs} + case r == '=' && minPower <= 4: + lhs = SubexASTEqual {lhs} case r == '$' && minPower <= 4: slot := l.Next() if slot == eof { -- cgit v1.2.3