<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/subex
diff options
context:
space:
mode:
authorCharlie Stanton <charlie@shtanton.xyz>2023-04-20 13:57:09 +0100
committerCharlie Stanton <charlie@shtanton.xyz>2023-04-20 13:57:09 +0100
commit44c5809b8c3af1be85d97673cc5a9585a65ef8f0 (patch)
treeca082b60a4c57d43226e37cab6f6c19b543f0472 /subex
parentdb8800dcdac60a48ef4a4f084940581222e643ad (diff)
downloadstred-go-44c5809b8c3af1be85d97673cc5a9585a65ef8f0.tar
Remove the @, ~ and # syntax for terminal literals
Diffstat (limited to 'subex')
-rw-r--r--subex/parse.go30
1 files changed, 0 insertions, 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{}