aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/pelletier/go-toml/keysparsing.go
diff options
context:
space:
mode:
authorNiall Sheridan <nsheridan@gmail.com>2016-10-08 16:02:50 -0500
committerNiall Sheridan <nsheridan@gmail.com>2016-10-08 16:02:50 -0500
commitbaf7141d1dd0f99d561a2197a909c66dd389809d (patch)
tree92c176f713b0b28893344261b1e567db5e30ba79 /vendor/github.com/pelletier/go-toml/keysparsing.go
parent696aebffe56853345d679d4d2b3051236423c6db (diff)
Update dependencies
Diffstat (limited to 'vendor/github.com/pelletier/go-toml/keysparsing.go')
-rw-r--r--vendor/github.com/pelletier/go-toml/keysparsing.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/vendor/github.com/pelletier/go-toml/keysparsing.go b/vendor/github.com/pelletier/go-toml/keysparsing.go
index 4deed81..b67664f 100644
--- a/vendor/github.com/pelletier/go-toml/keysparsing.go
+++ b/vendor/github.com/pelletier/go-toml/keysparsing.go
@@ -12,6 +12,7 @@ func parseKey(key string) ([]string, error) {
groups := []string{}
var buffer bytes.Buffer
inQuotes := false
+ wasInQuotes := false
escapeNext := false
ignoreSpace := true
expectDot := false
@@ -33,16 +34,27 @@ func parseKey(key string) ([]string, error) {
escapeNext = true
continue
case '"':
+ if inQuotes {
+ groups = append(groups, buffer.String())
+ buffer.Reset()
+ wasInQuotes = true
+ }
inQuotes = !inQuotes
expectDot = false
case '.':
if inQuotes {
buffer.WriteRune(char)
} else {
- groups = append(groups, buffer.String())
- buffer.Reset()
+ if !wasInQuotes {
+ if buffer.Len() == 0 {
+ return nil, fmt.Errorf("empty key group")
+ }
+ groups = append(groups, buffer.String())
+ buffer.Reset()
+ }
ignoreSpace = true
expectDot = false
+ wasInQuotes = false
}
case ' ':
if inQuotes {