You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
fx/stream.go

29 lines
525 B
Go

package main
import (
"encoding/json"
"fmt"
"io"
. "github.com/antonmedv/fx/pkg/json"
. "github.com/antonmedv/fx/pkg/reducer"
. "github.com/antonmedv/fx/pkg/theme"
)
func stream(dec *json.Decoder, jsonObject interface{}, lang string, args []string, theme Theme) int {
var err error
for {
if jsonObject != nil {
Reduce(jsonObject, lang, args, theme)
}
jsonObject, err = Parse(dec)
if err == io.EOF {
return 0
}
if err != nil {
fmt.Println("JSON Parse Error:", err.Error())
return 1
}
}
}