<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/subex/subexstate.go
diff options
context:
space:
mode:
Diffstat (limited to 'subex/subexstate.go')
-rw-r--r--subex/subexstate.go27
1 files changed, 25 insertions, 2 deletions
diff --git a/subex/subexstate.go b/subex/subexstate.go
index 4de8ae2..45b5d00 100644
--- a/subex/subexstate.go
+++ b/subex/subexstate.go
@@ -355,6 +355,24 @@ func (state SubexConstructArrayState) epsilon(aux auxiliaryState) []SubexBranch
}}
}
+type SubexConstructArrayValuesState struct {
+ next SubexState
+}
+func (state SubexConstructArrayValuesState) epsilon(aux auxiliaryState) []SubexBranch {
+ values, aux := aux.popOutput()
+ var array walk.ArrayValue
+ for _, v := range values {
+ array = append(array, walk.ArrayElement {
+ Index: 0,
+ Value: v,
+ })
+ }
+ return []SubexBranch {{
+ state: state.next,
+ aux: aux.topAppend([]walk.Value {array}),
+ }}
+}
+
type SubexConstructStringState struct {
next SubexState
}
@@ -377,12 +395,15 @@ func (state SubexConstructStringState) String() string {
}
type SubexIncrementNestState struct {
+ keys bool
next SubexState
}
func (state SubexIncrementNestState) epsilon(aux auxiliaryState) []SubexBranch {
+ aux.nestingLen += 1
+ aux.nestingValue = state.keys
return []SubexBranch {{
state: state.next,
- aux: aux.incNest(),
+ aux: aux,
}}
}
func (state SubexIncrementNestState) String() string {
@@ -393,8 +414,10 @@ type SubexDecrementNestState struct {
next SubexState
}
func (state SubexDecrementNestState) epsilon(aux auxiliaryState) []SubexBranch {
+ aux.nestingLen -= 1
+ // aux.nestingValue will be set in addStates
return []SubexBranch {{
state: state.next,
- aux: aux.decNest(),
+ aux: aux,
}}
}