<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/subex/parse.go
diff options
context:
space:
mode:
authorCharlie Stanton <charlie@shtanton.xyz>2023-04-25 09:26:34 +0100
committerCharlie Stanton <charlie@shtanton.xyz>2023-04-25 09:26:34 +0100
commit9b26559c8273fd4de6aa6a740d6472a665446274 (patch)
treebeba05acff8ef35438ecd2fc8ee5f910ecdc9a5d /subex/parse.go
parentfa750707cd3dd44bcbf59d9271d389c92b293621 (diff)
downloadstred-go-9b26559c8273fd4de6aa6a740d6472a665446274.tar
Refines storing and loading to use ids generated when the subex is compiled instead of the runes
Diffstat (limited to 'subex/parse.go')
-rw-r--r--subex/parse.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/subex/parse.go b/subex/parse.go
index de53e2a..746217b 100644
--- a/subex/parse.go
+++ b/subex/parse.go
@@ -159,7 +159,7 @@ func parseRepeatRange(l RuneReader) (output []ConvexRange) {
return output
}
-func parseReplacement(l RuneReader) (output []OutputContent) {
+func parseReplacement(l RuneReader) (output []OutputContentAST) {
// TODO escaping
loop: for {
r := l.Next()
@@ -173,16 +173,16 @@ func parseReplacement(l RuneReader) (output []OutputContent) {
if slot == eof {
panic("Missing slot character")
}
- output = append(output, OutputLoad{slot: slot})
+ output = append(output, OutputLoadAST{slot: slot})
case '`':
literals := parseNonStringLiteral(l)
for _, literal := range literals {
- output = append(output, OutputAtomLiteral {literal})
+ output = append(output, OutputAtomLiteralAST {literal})
}
case '"':
- output = append(output, OutputAtomLiteral {walk.NewAtomStringTerminal()})
+ output = append(output, OutputAtomLiteralAST {walk.NewAtomStringTerminal()})
default:
- output = append(output, OutputAtomLiteral{atom: walk.NewAtomStringRune(r)})
+ output = append(output, OutputAtomLiteralAST{atom: walk.NewAtomStringRune(r)})
}
}
return output
@@ -296,12 +296,12 @@ func parseSubex(l RuneReader, minPower int) SubexAST {
case '^':
replacement := parseReplacement(l)
replacement = append(
- []OutputContent{OutputAtomLiteral {walk.NewAtomStringTerminal()}},
+ []OutputContentAST{OutputAtomLiteralAST {walk.NewAtomStringTerminal()}},
replacement...
)
replacement = append(
replacement,
- OutputAtomLiteral {walk.NewAtomStringTerminal()},
+ OutputAtomLiteralAST {walk.NewAtomStringTerminal()},
)
lhs = SubexASTOutput {replacement}
case '.':
@@ -320,9 +320,9 @@ func parseSubex(l RuneReader, minPower int) SubexAST {
lhs = SubexASTCopyAtom {walk.NewAtomStringTerminal()}
case '~':
literals := parseNonStringLiteral(l)
- var replacement []OutputContent
+ var replacement []OutputContentAST
for _, literal := range literals {
- replacement = append(replacement, OutputAtomLiteral {literal})
+ replacement = append(replacement, OutputAtomLiteralAST {literal})
}
lhs = SubexASTOutput {replacement}
default: