From 44c5809b8c3af1be85d97673cc5a9585a65ef8f0 Mon Sep 17 00:00:00 2001 From: Charlie Stanton Date: Thu, 20 Apr 2023 13:57:09 +0100 Subject: Remove the @, ~ and # syntax for terminal literals --- subex/parse.go | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/subex/parse.go b/subex/parse.go index b1d54ac..1e5e36e 100644 --- a/subex/parse.go +++ b/subex/parse.go @@ -33,20 +33,6 @@ func expectBracket(l RuneReader, ifLeft walk.Atom, ifRight walk.Atom) walk.Atom } } -// Having just read termType, read in a bracket and return the corresponding Atom -func parseTerminatorAtomLiteral(termType rune, l RuneReader) walk.Atom { - switch termType { - case '@': - return expectBracket(l, walk.ArrayBegin, walk.ArrayEnd) - case '~': - return expectBracket(l, walk.StringTerminal{}, walk.StringTerminal{}) - case '#': - return expectBracket(l, walk.MapBegin, walk.MapEnd) - default: - return nil - } -} - func isNumericRune(r rune) bool { return '0' <= r && r <= '9' || r == '.' } @@ -186,8 +172,6 @@ func parseReplacement(l RuneReader) (output []OutputContent) { panic("Missing slot character") } output = append(output, OutputLoad{slot: slot}) - case '@', '~', '#': - output = append(output, OutputAtomLiteral{atom: parseTerminatorAtomLiteral(r, l)}) case '`': literals := parseNonStringLiteral(l) for _, literal := range literals { @@ -223,12 +207,6 @@ func parseRangeSubex(l RuneReader) map[walk.Atom]walk.Atom { } else if fromsStart == '"' { froms = append(froms, walk.StringTerminal{}) continue - } else { - atom := parseTerminatorAtomLiteral(fromsStart, l) - if atom != nil { - froms = append(froms, atom) - continue - } } if accept(l, "-") { fromsEnd := l.Next() @@ -260,12 +238,6 @@ func parseRangeSubex(l RuneReader) map[walk.Atom]walk.Atom { } else if tosStart == '"' { tos = append(tos, walk.StringTerminal{}) continue - } else { - atom := parseTerminatorAtomLiteral(tosStart, l) - if atom != nil { - tos = append(tos, atom) - continue - } } if accept(l, "-") { tosEnd := l.Next() @@ -317,8 +289,6 @@ func parseSubex(l RuneReader, minPower int) SubexAST { lhs = SubexASTCopyAny{} case '"': lhs = SubexASTCopyAtom {walk.StringTerminal{}} - case '@', '#', '~': - lhs = SubexASTCopyAtom{atom: parseTerminatorAtomLiteral(r, l)} case '`': literals := parseNonStringLiteral(l) lhs = SubexASTEmpty{} -- cgit v1.2.3