summaryrefslogtreecommitdiff
path: root/conf
diff options
context:
space:
mode:
authorSilvan Jegen <s.jegen@gmail.com>2016-12-28 20:07:57 +0100
committerSilvan Jegen <s.jegen@gmail.com>2016-12-28 20:07:57 +0100
commitca96c7fd5c43b99873a67eb239176bd7a9e762f0 (patch)
treef73e6175e0c171dbeddd35ecae958f0dc2713749 /conf
parente2fdd3b1b714b9fa896218c68fdfe57d906730ba (diff)
Finish parsing of keyvalues
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
}