aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md4
-rw-r--r--ccl.go14
-rw-r--r--ccl_test.go28
3 files changed, 20 insertions, 26 deletions
diff --git a/README.md b/README.md
index 28ba7fa..9e7cd57 100644
--- a/README.md
+++ b/README.md
@@ -16,8 +16,8 @@ how hard can writing a recursive-descent parser be...
location {
path: "/.well-known/acme-challenge/"
root: "/var/lib/acme/acme-challenge"
- auth_basic: off
- auth_request: off
+ auth_basic: false
+ auth_request: false
}
}
diff --git a/ccl.go b/ccl.go
index eea772c..1333119 100644
--- a/ccl.go
+++ b/ccl.go
@@ -96,23 +96,17 @@
//
// # Bool
//
-// Bool values can be true or false (classic), and are written using one of the
-// below strings.
+// Bool values can be true or false (classic).
//
// true
-// yes
-// on
-//
// false
-// no
-// off
//
// # Lists
//
// Lists are written with square brackets and elements are separated by comma.
//
// [1, 2, 3]
-// [{nested: "messages"}, {are: "also"}, {allowed: yes}]
+// [{nested: "messages"}, {are: "also"}, {allowed: "yep"}]
//
// Trailing comma is allowed
//
@@ -531,9 +525,9 @@ func (p *parser) parseVal(fieldVal reflect.Value, tok, field []byte) error {
return nil
}
switch string(tok) {
- case "true", "yes", "on":
+ case "true":
return p.unpackBool(fieldVal, true, field)
- case "false", "no", "off":
+ case "false":
return p.unpackBool(fieldVal, false, field)
}
if bytes.ContainsAny(tok, ".eE") {
diff --git a/ccl_test.go b/ccl_test.go
index 15d75af..e377306 100644
--- a/ccl_test.go
+++ b/ccl_test.go
@@ -270,8 +270,8 @@ can just span multiple lines"`,
}, {
desc: "Repeated",
msg: `
- repeated: 1
- repeated: 2`,
+ repeated: 1
+ repeated: 2`,
want: message{Repeated: []int64{1, 2}},
}, {
desc: "RepeatedList",
@@ -288,9 +288,9 @@ can just span multiple lines"`,
}, {
desc: "RepeatedListTrailingComma",
msg: `repeated: [
- 1,
- 2,
- ]`,
+ 1,
+ 2,
+ ]`,
want: message{Repeated: []int64{1, 2}},
}, {
desc: "ListOfMessage",
@@ -530,11 +530,11 @@ func TestUnmarshal_InvalidType(t *testing.T) {
out: new(struct{ Field struct{ Field int64 } }),
}, {
desc: "True",
- msg: `F:on`,
+ msg: `F:true`,
out: new(struct{ F string }),
}, {
desc: "False",
- msg: `F:no`,
+ msg: `F:false`,
out: new(struct{ F string }),
}, {
desc: "List",
@@ -542,7 +542,7 @@ func TestUnmarshal_InvalidType(t *testing.T) {
out: new(struct{ F int64 }),
}, {
desc: "RepeatedBool",
- msg: `F:on F:no`,
+ msg: `F:true F:false`,
out: new(struct{ F []string }),
}, {
desc: "String",
@@ -591,25 +591,25 @@ func TestUnmarshal_InvalidType(t *testing.T) {
out: new(struct{ F int }),
}, {
desc: "IntTrue",
- msg: `int:on`,
+ msg: `int:true`,
out: new(struct {
F int `ccl:"int"`
}),
}, {
desc: "IntFalse",
- msg: `int:no`,
+ msg: `int:false`,
out: new(struct {
F int `ccl:"int"`
}),
}, {
desc: "UintTrue",
- msg: `uint:on`,
+ msg: `uint:true`,
out: new(struct {
F uint `ccl:"uint"`
}),
}, {
desc: "UintFalse",
- msg: `uint:no`,
+ msg: `uint:false`,
out: new(struct {
F uint `ccl:"uint"`
}),
@@ -662,8 +662,8 @@ func ExampleUnmarshal() {
location {
path: "/.well-known/acme-challenge/"
root: "/var/lib/acme/acme-challenge"
- auth_basic: off
- auth_request: off
+ auth_basic: false
+ auth_request: false
}
}
`)