summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--conf/parser.go4
-rw-r--r--conf/scanner.go8
2 files changed, 10 insertions, 2 deletions
diff --git a/conf/parser.go b/conf/parser.go
index 75f610c..4f58713 100644
--- a/conf/parser.go
+++ b/conf/parser.go
@@ -49,11 +49,11 @@ func (p *parser) startparsing() {
p.last = p.cur
p.cur, err = p.s.Scan()
for err == nil {
- fmt.Fprintf(os.Stderr, "tokentype: %d, token: %q offset: %d, line: %d\n", p.cur.Type, p.cur.Lit, p.cur.Offset, p.cur.LineNr)
+ 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()
}
- fmt.Fprintf(os.Stderr, "Error: tokentype: %d, 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)
}
func (p *parser) module(name string) {
diff --git a/conf/scanner.go b/conf/scanner.go
index 9bd7a4b..54546aa 100644
--- a/conf/scanner.go
+++ b/conf/scanner.go
@@ -20,6 +20,14 @@ const (
IfStatement
)
+var tokentypestrings []string = []string{Name: "Name", Literal: "Literal",
+ DeliOpen: "Opening delimiter", DeliClose: "Closing delimiter",
+ Nothing: "Nothing", IfStatement: "If statement"}
+
+func (tt tokentype) String() string {
+ return tokentypestrings[tt]
+}
+
type token struct {
Type tokentype
Offset int