summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--conf/parser.go14
1 files changed, 5 insertions, 9 deletions
diff --git a/conf/parser.go b/conf/parser.go
index 3d584f6..b22e6aa 100644
--- a/conf/parser.go
+++ b/conf/parser.go
@@ -59,19 +59,15 @@ func (p *parser) advanceOneToken(place string) {
p.last = p.cur
p.cur, err = p.s.Scan()
- for err == nil {
- fmt.Fprintf(os.Stderr, "tokentype: %v, token: %q offset: %d, line: %d\n", p.cur.Type, p.cur.Lit, p.cur.Offset, p.cur.LineNr)
- p.last = p.cur
- p.cur, err = p.s.Scan()
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "Error: tokentype: %v, token: %q, err: %v\n", p.cur.Type, p.cur.Lit, err)
}
- fmt.Fprintf(os.Stderr, "Error: tokentype: %v, token: %q, err: %v\n", p.cur.Type, p.cur.Lit, err)
+ fmt.Fprintf(os.Stderr, "tokentype: %v, token: %q\n", p.cur.Type, p.cur.Lit)
}
func (p *parser) module(firstname string) {
p.advanceOneToken("module")
- fmt.Fprintf(os.Stderr, "tokentype: %d, token: %q\n", p.cur.Type, p.cur.Lit)
-
if p.cur.Lit != firstname {
fmt.Fprintf(os.Stderr, "error when parsing module. We were expecting name %q but got %q at line %d offset %d.\n", firstname, p.cur.Lit, p.cur.LineNr, p.cur.Offset)
}
@@ -117,7 +113,7 @@ func (p *parser) object() {
func (p *parser) keyvalue() bool {
p.advanceOneToken("keyvalue")
- fmt.Fprintf(os.Stderr, "keyvalue: tokentype: %d, token: %q\n", p.cur.Type, p.cur.Lit)
+ fmt.Fprintf(os.Stderr, "keyvalue: tokentype: %v, token: %q\n", p.cur.Type, p.cur.Lit)
if p.cur.Type != Literal {
fmt.Fprintf(os.Stderr, "error when parsing keyvalue. Was expecting a name but got %q at line %d offset %d.\n", p.cur.Lit, p.cur.LineNr, p.cur.Offset)
}
@@ -138,7 +134,7 @@ func (p *parser) keyvalue() bool {
return false
}
- fmt.Fprintf(os.Stderr, "peeked %q (type %d) at line %d offset %d.\n", tok.Lit, tok.Type, tok.LineNr, tok.Offset)
+ fmt.Fprintf(os.Stderr, "peeked %q (type %v) at line %d offset %d.\n", tok.Lit, tok.Type, tok.LineNr, tok.Offset)
if tok.Type == ObjectClose {
p.advanceOneToken("keyvaluelast")
return false