summaryrefslogtreecommitdiff
path: root/conf
diff options
context:
space:
mode:
Diffstat (limited to 'conf')
-rw-r--r--conf/parser.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/conf/parser.go b/conf/parser.go
index 26784f4..cc85054 100644
--- a/conf/parser.go
+++ b/conf/parser.go
@@ -127,9 +127,21 @@ func (p *parser) keyvalue() bool {
}
p.advanceOneToken("keyvalue")
- if p.cur.Type != Literal || p.cur.Type != Literal {
+ if p.cur.Type != Literal && p.cur.Type != Name {
fmt.Fprintf(os.Stderr, "error when parsing keyvalue. Was expecting a literal or a name but got %q at line %d offset %d.\n", p.cur.Lit, p.cur.LineNr, p.cur.Offset)
}
- return false
+ tok, err := p.s.Peek()
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "error when parsing keyvalue. Got an error when checking if there are more keyvalues: %v.\n", err)
+ return false
+ }
+
+ fmt.Fprintf(os.Stderr, "peeked %q (type %d) at line %d offset %d.\n", tok.Lit, tok.Type, tok.LineNr, tok.Offset)
+ if tok.Type == ObjectDelimiter {
+ p.advanceOneToken("keyvaluelast")
+ return false
+ }
+
+ return true
}