Use the new debbugging

This commit is contained in:
Miek Gieben 2013-03-04 09:42:24 +01:00
parent c413442565
commit a5e9f8010d
1 changed files with 11 additions and 36 deletions

View File

@ -1,7 +1,6 @@
package dns
import (
"fmt"
"io"
"log"
"os"
@ -19,8 +18,6 @@ func (d debugging) Printf(format string, args ...interface{}) {
}
}
var _DEBUG = false // Only used when debugging the parser itself.
const maxTok = 2048 // Largest token we can return.
// Tokinize a RFC 1035 zone file. The tokenizer will normalize it:
@ -487,9 +484,7 @@ func zlexer(s *scan, c chan lex) {
if stri > maxTok {
l.token = "tok length insufficient for parsing"
l.err = true
if _DEBUG {
fmt.Printf("[%+v]", l.token)
}
debug.Printf("[%+v]", l.token)
c <- l
return
}
@ -523,9 +518,7 @@ func zlexer(s *scan, c chan lex) {
case "$GENERATE":
l.value = _DIRGENERATE
}
if _DEBUG {
fmt.Printf("[7 %+v]", l.token)
}
debug.Printf("[7 %+v]", l.token)
c <- l
} else {
l.value = _STRING
@ -568,9 +561,7 @@ func zlexer(s *scan, c chan lex) {
}
}
}
if _DEBUG {
fmt.Printf("[6 %+v]", l.token)
}
debug.Printf("[6 %+v]", l.token)
c <- l
}
stri = 0
@ -578,9 +569,7 @@ func zlexer(s *scan, c chan lex) {
if !space && !commt {
l.value = _BLANK
l.token = " "
if _DEBUG {
fmt.Printf("[5 %+v]", l.token)
}
debug.Printf("[5 %+v]", l.token)
c <- l
}
owner = false
@ -601,9 +590,7 @@ func zlexer(s *scan, c chan lex) {
if stri > 0 {
l.value = _STRING
l.token = string(str[:stri])
if _DEBUG {
fmt.Printf("[4 %+v]", l.token)
}
debug.Printf("[4 %+v]", l.token)
c <- l
stri = 0
}
@ -631,9 +618,7 @@ func zlexer(s *scan, c chan lex) {
owner = true
l.value = _NEWLINE
l.token = "\n"
if _DEBUG {
fmt.Printf("[3 %+v]", l.token)
}
debug.Printf("[3 %+v]", l.token)
c <- l
}
break
@ -651,16 +636,12 @@ func zlexer(s *scan, c chan lex) {
rrtype = true
}
}
if _DEBUG {
fmt.Printf("[2 %+v]", l.token)
}
debug.Printf("[2 %+v]", l.token)
c <- l
}
l.value = _NEWLINE
l.token = "\n"
if _DEBUG {
fmt.Printf("[1 %+v]", l.token)
}
debug.Printf("[1 %+v]", l.token)
c <- l
stri = 0
commt = false
@ -696,9 +677,7 @@ func zlexer(s *scan, c chan lex) {
if stri != 0 {
l.value = _STRING
l.token = string(str[:stri])
if _DEBUG {
fmt.Printf("[%+v]", l.token)
}
debug.Printf("[%+v]", l.token)
c <- l
stri = 0
}
@ -727,9 +706,7 @@ func zlexer(s *scan, c chan lex) {
if brace < 0 {
l.token = "extra closing brace"
l.err = true
if _DEBUG {
fmt.Printf("[%+v]", l.token)
}
debug.Printf("[%+v]", l.token)
c <- l
return
}
@ -752,9 +729,7 @@ func zlexer(s *scan, c chan lex) {
// Send remainder
l.token = string(str[:stri])
l.value = _STRING
if _DEBUG {
fmt.Printf("[%+v]", l.token)
}
debug.Printf("[%+v]", l.token)
c <- l
}
}