diff options
| author | Adam Scarr <adam@vektah.net> | 2017-08-07 22:57:06 +1000 | 
|---|---|---|
| committer | Adam Scarr <adam@vektah.net> | 2017-08-07 22:57:06 +1000 | 
| commit | 6e1c004fea8d841f554c2e94ff39e1fcee94b4e3 (patch) | |
| tree | 5ee131da4ca938fc30d59ba7c6dc402a77fefe07 /json | |
| parent | 4594587e3b7d1b474ce2444e821294c63cabe3da (diff) | |
Add Bind for constants
Diffstat (limited to 'json')
| -rw-r--r-- | json/json.go | 20 | 
1 files changed, 4 insertions, 16 deletions
diff --git a/json/json.go b/json/json.go index 28889bd..13db8a5 100644 --- a/json/json.go +++ b/json/json.go @@ -27,25 +27,13 @@ var (  		return Node{Result: ret}  	}) -	_null = Map("null", func(n Node) Node { -		return Node{Result: nil} -	}) - -	_true = Map("true", func(n Node) Node { -		return Node{Result: true} -	}) - -	_false = Map("false", func(n Node) Node { -		return Node{Result: false} -	}) +	_null  = Bind("null", nil) +	_true  = Bind("true", true) +	_false = Bind("false", false)  	_string = Map(String('"'), func(n Node) Node {  		return Node{Result: n.Token}  	}) - -	Y = Map(&value, func(n Node) Node { -		return Node{Result: n.Result} -	})  )  func init() { @@ -53,7 +41,7 @@ func init() {  }  func Unmarshal(input string) (interface{}, error) { -	result, remaining, err := ParseString(Y, input) +	result, remaining, err := ParseString(value, input)  	if err != nil {  		return result, err  | 
