Fix parsing of TXT records containing empty-strings

This commit is contained in:
Andrew Tunnell-Jones 2014-01-11 05:33:23 +00:00
parent 938210c3ad
commit 549ed97be1
1 changed files with 6 additions and 0 deletions

View File

@ -223,9 +223,11 @@ func endingToTxtSlice(c chan lex, errstr, f string) ([]string, *ParseError, stri
switch l.value == _QUOTE {
case true: // A number of quoted string
s = make([]string, 0)
empty := true
for l.value != _NEWLINE && l.value != _EOF {
switch l.value {
case _STRING:
empty = false
s = append(s, l.token)
case _BLANK:
if quote {
@ -233,7 +235,11 @@ func endingToTxtSlice(c chan lex, errstr, f string) ([]string, *ParseError, stri
return nil, &ParseError{f, errstr, l}, ""
}
case _QUOTE:
if empty && quote {
s = append(s, "")
}
quote = !quote
empty = quote
default:
return nil, &ParseError{f, errstr, l}, ""
}