<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/subex/subexstate.go
diff options
context:
space:
mode:
authorCharlie Stanton <charlie@shtanton.xyz>2024-03-31 21:23:17 +0100
committerCharlie Stanton <charlie@shtanton.xyz>2024-03-31 21:23:17 +0100
commit81925b6ad5212512d27365b8224b76095191431f (patch)
treef625a8eddb556a58c45c7e16a205df1ed6b92d3a /subex/subexstate.go
parent256450cc3dcdd9a9b92a33642739f7143526e9b9 (diff)
downloadstred-go-81925b6ad5212512d27365b8224b76095191431f.tar
Add " shorthand for string destructure
Diffstat (limited to 'subex/subexstate.go')
-rw-r--r--subex/subexstate.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/subex/subexstate.go b/subex/subexstate.go
index 26d7347..4f5dc19 100644
--- a/subex/subexstate.go
+++ b/subex/subexstate.go
@@ -424,8 +424,7 @@ type SubexIncrementNestState struct {
next SubexState
}
func (state SubexIncrementNestState) epsilon(aux auxiliaryState) []SubexBranch {
- aux.nestingLen += 1
- aux.nestingValue = state.keys
+ aux.nesting = append(aux.nesting, state.keys)
return []SubexBranch {{
state: state.next,
aux: aux,
@@ -439,7 +438,7 @@ type SubexDecrementNestState struct {
next SubexState
}
func (state SubexDecrementNestState) epsilon(aux auxiliaryState) []SubexBranch {
- aux.nestingLen -= 1
+ aux.nesting = aux.nesting[:len(aux.nesting) - 1]
// aux.nestingValue will be set in addStates
return []SubexBranch {{
state: state.next,