From 9b26559c8273fd4de6aa6a740d6472a665446274 Mon Sep 17 00:00:00 2001 From: Charlie Stanton Date: Tue, 25 Apr 2023 09:26:34 +0100 Subject: Refines storing and loading to use ids generated when the subex is compiled instead of the runes --- subex/parse.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'subex/parse.go') 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: -- cgit v1.2.3