<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/walk
diff options
context:
space:
mode:
Diffstat (limited to 'walk')
-rw-r--r--walk/walk.go31
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")