From 4d5f6d66e235b25336009d4b05257a94983117ba Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Fri, 16 Dec 2011 10:48:33 +0100 Subject: [PATCH] More tweaks for parsing --- zscan.go | 10 +++++----- zscan_rr.go | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/zscan.go b/zscan.go index dce52dd7..4508c29f 100644 --- a/zscan.go +++ b/zscan.go @@ -9,9 +9,7 @@ import ( ) // Only used when debugging the parser itself. -var _DEBUG = false - - +var _DEBUG = true // Tokinize a RFC 1035 zone file. The tokenizer will normalize it: // * Add ownernames if they are left blank; @@ -51,8 +49,10 @@ type ParseError struct { } func (e *ParseError) Error() string { - s := e.err + ": `" + e.lex.token + "' at line: " + strconv.Itoa(e.lex.line) + - " and column: " + strconv.Itoa(e.lex.column) + va := strconv.Itoa(e.lex.value) + s := e.err + ": `" + e.lex.token + "' (value: " + va + ") at line: " + + strconv.Itoa(e.lex.line) + " and column: " + + strconv.Itoa(e.lex.column) return s } diff --git a/zscan_rr.go b/zscan_rr.go index 1d111eb1..bbeea6ea 100644 --- a/zscan_rr.go +++ b/zscan_rr.go @@ -88,24 +88,24 @@ func setRR(h RR_Header, c chan Lex) (RR, *ParseError) { func slurpRemainder(c chan Lex) *ParseError { l := <-c if _DEBUG { - fmt.Printf("%\v", l) + fmt.Printf("%v\n", l) } switch l.value { case _BLANK: l = <-c if _DEBUG { - fmt.Printf("%\v", l) + fmt.Printf("%v\n", l) } if l.value != _NEWLINE && l.value != _EOF { return &ParseError{"garbage after rdata", l} } // Ok case _NEWLINE: - // Ok + // Ok case _EOF: // Ok default: - return &ParseError{"garbage after rdata", l} + return &ParseError{"garbage after directly rdata", l} } return nil }