diff options
author | Charlie Stanton <charlie@shtanton.xyz> | 2023-02-22 20:52:20 +0000 |
---|---|---|
committer | Charlie Stanton <charlie@shtanton.xyz> | 2023-02-22 20:52:20 +0000 |
commit | a2636b27fdadb2b7951fa35fe301e8e6b41fc28a (patch) | |
tree | 35561560d067c9987a626c4a77ea3f688547a015 /walk | |
parent | 3bd45dc49a35b82dcc4ae93796c3e152d799bc0b (diff) | |
download | stred-go-a2636b27fdadb2b7951fa35fe301e8e6b41fc28a.tar |
Modify subex to take JSON split into "data"
Currently no way to reassemble the data on the other side
Much of the potential data cannot be interacted with meaningfully, only the string functionality is implemented
Should rename data to something else
Diffstat (limited to 'walk')
-rw-r--r-- | walk/walk.go | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/walk/walk.go b/walk/walk.go index 19180b4..1df7a6e 100644 --- a/walk/walk.go +++ b/walk/walk.go @@ -16,12 +16,39 @@ const ( MapBegin MapEnd ) +func (value TerminalValue) Pieces(out chan<- Datum) { + out<-value +} + type ValueNull struct {} +func (value ValueNull) Pieces(out chan<- Datum) { + out<-value +} type ValueBool bool +func (value ValueBool) Pieces(out chan<- Datum) { + out<-value +} type ValueNumber float64 +func (value ValueNumber) Pieces(out chan<- Datum) { + out<-value +} + +type StartString struct {} +type EndString struct {} type ValueString string +func (value ValueString) Pieces(out chan<- Datum) { + out<-StartString{} + for _, char := range value { + out<-char + } + out<-EndString{} +} -type WalkValue interface {} +type Datum interface {} + +type WalkValue interface { + Pieces(out chan<- Datum) +} type WalkItem struct { Value WalkValue @@ -297,7 +324,7 @@ func jsonOutValue(in *WalkItemStream, indent int, doIndent bool) WalkValue { jsonOutMap(in, indent) return nil default: - return token + return token.Value } default: panic("Invalid WalkValue") |