commit 61fd31368f26637a353cde6402b9a353b6b82e8b
parent 1c2d7a4e9258ed72f5c8ebecc3d575d065f25c5d
Author: Charlie Stanton <charlie@shtanton.xyz>
Date: Wed, 19 Apr 2023 12:31:07 +0100
Replaces a few instances of SubexStates with pointers as they should be
This potentially avoids bugs/errors and also improves the performance of pruning
Diffstat:
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/subex/main.go b/subex/main.go
@@ -26,7 +26,7 @@ func (store Store) withValue(key rune, value []walk.Atom) Store {
// Compile the SubexAST into a transducer SubexState that can be run
func CompileTransducer(transducerAst SubexAST) SubexState {
- return transducerAst.compileWith(SubexNoneState{})
+ return transducerAst.compileWith(&SubexNoneState{})
}
// An immutable stack for outputting to
diff --git a/subex/subexast.go b/subex/subexast.go
@@ -118,7 +118,7 @@ type SubexASTRepeat struct {
func (ast SubexASTRepeat) compileWith(next SubexState) SubexState {
var state SubexState = &SubexDeadState{}
for _, convex := range ast.acceptable {
- state = SubexGroupState {state, convex.compile(ast.content, next)}
+ state = &SubexGroupState {state, convex.compile(ast.content, next)}
}
return state
}