<- Back to shtanton's homepage
summaryrefslogtreecommitdiff
path: root/main/subexast.go
diff options
context:
space:
mode:
Diffstat (limited to 'main/subexast.go')
-rw-r--r--main/subexast.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/main/subexast.go b/main/subexast.go
index 510335f..040bc9d 100644
--- a/main/subexast.go
+++ b/main/subexast.go
@@ -23,8 +23,8 @@ type SubexASTStore struct {
slot rune
}
func (ast SubexASTStore) compileWith(next SubexState) SubexState {
- return SubexStoreState {
- match: ast.match.compileWith(SubexNoneState{}),
+ return &SubexStoreState {
+ match: ast.match.compileWith(&SubexNoneState{}),
slot: ast.slot,
next: next,
}
@@ -37,7 +37,7 @@ type SubexASTOr struct {
first, second SubexAST
}
func (ast SubexASTOr) compileWith(next SubexState) SubexState {
- return SubexGroupState {
+ return &SubexGroupState {
ast.first.compileWith(next),
ast.second.compileWith(next),
}
@@ -79,7 +79,7 @@ type SubexASTRepeat struct {
}
func (ast SubexASTRepeat) compileWith(next SubexState) SubexState {
for i := ast.min; i < ast.max; i += 1 {
- next = SubexGroupState {
+ next = &SubexGroupState {
ast.content.compileWith(next),
next,
}
@@ -92,7 +92,7 @@ func (ast SubexASTRepeat) compileWith(next SubexState) SubexState {
type SubexASTCopyRune rune
func (ast SubexASTCopyRune) compileWith(next SubexState) SubexState {
- return SubexCopyRuneState{
+ return &SubexCopyRuneState{
rune: rune(ast),
next: next,
}
@@ -100,7 +100,7 @@ func (ast SubexASTCopyRune) compileWith(next SubexState) SubexState {
type SubexASTCopyAny struct {}
func (ast SubexASTCopyAny) compileWith(next SubexState) SubexState {
- return SubexCopyAnyState{next}
+ return &SubexCopyAnyState{next}
}
func (ast SubexASTCopyAny) String() string {
return "."
@@ -110,7 +110,7 @@ type SubexASTOutput struct {
replacement []TransducerOutput
}
func (ast SubexASTOutput) compileWith(next SubexState) SubexState {
- return SubexOutputState{
+ return &SubexOutputState{
content: ast.replacement,
next: next,
}
@@ -120,7 +120,7 @@ type SubexASTTry struct {
content SubexAST
}
func (ast SubexASTTry) compileWith(next SubexState) SubexState {
- return SubexGroupState {
+ return &SubexGroupState {
ast.content.compileWith(next),
next,
}
@@ -130,7 +130,7 @@ type SubexASTMaybe struct {
content SubexAST
}
func (ast SubexASTMaybe) compileWith(next SubexState) SubexState {
- return SubexGroupState {
+ return &SubexGroupState {
next,
ast.content.compileWith(next),
}
@@ -146,7 +146,7 @@ func (ast SubexASTJoin) compileWith(next SubexState) SubexState {
}
manyContentsState := ast.content.compileWith(afterContentState)
afterContentState.first = ast.delimiter.compileWith(manyContentsState)
- return SubexGroupState {
+ return &SubexGroupState {
manyContentsState,
next,
}