summaryrefslogtreecommitdiff
path: root/json/json.go
diff options
context:
space:
mode:
authorAdam Scarr <adam@vektah.net>2017-08-07 21:20:30 +1000
committerAdam Scarr <adam@vektah.net>2017-08-07 21:22:54 +1000
commita656dc0d78c5f51a16dc4c26936d337cdae5105c (patch)
treeabd40ad9b8c6218d61c5dab230ef3712a0fef0b3 /json/json.go
parentcc9d18219af9375ad89eaa8a23f1e0bcffa5734e (diff)
AutoWS
Diffstat (limited to 'json/json.go')
-rw-r--r--json/json.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/json/json.go b/json/json.go
index fbba21c..01d209f 100644
--- a/json/json.go
+++ b/json/json.go
@@ -9,15 +9,15 @@ import (
var (
value Parser
- _array = Map(And(WS, "[", Kleene(&value, And(WS, ",")), "]"), func(n *Node) *Node {
+ _array = Map(And("[", Kleene(&value, ","), "]"), func(n *Node) *Node {
ret := []interface{}{}
for _, child := range n.Children[1].Children {
ret = append(ret, child.Result)
}
return &Node{Result: ret}
})
- properties = Kleene(And(WS, String('"'), WS, ":", WS, &value), ",")
- _object = Map(And(WS, "{", WS, properties, WS, "}"), func(n *Node) *Node {
+ properties = Kleene(And(String('"'), ":", &value), ",")
+ _object = Map(And("{", properties, "}"), func(n *Node) *Node {
ret := map[string]interface{}{}
for _, prop := range n.Children[1].Children {
@@ -27,15 +27,15 @@ var (
return &Node{Result: ret}
})
- _null = Map(And(WS, "null"), func(n *Node) *Node {
+ _null = Map("null", func(n *Node) *Node {
return &Node{Result: nil}
})
- _true = Map(And(WS, "true"), func(n *Node) *Node {
+ _true = Map("true", func(n *Node) *Node {
return &Node{Result: true}
})
- _false = Map(And(WS, "false"), func(n *Node) *Node {
+ _false = Map("false", func(n *Node) *Node {
return &Node{Result: false}
})
@@ -43,8 +43,8 @@ var (
return &Node{Result: n.Token}
})
- Y = Map(And(&value, WS), func(n *Node) *Node {
- return &Node{Result: n.Children[0].Result}
+ Y = Map(&value, func(n *Node) *Node {
+ return &Node{Result: n.Result}
})
)