Fix parsing of TXT records containing empty-strings
This commit is contained in:
parent
938210c3ad
commit
549ed97be1
|
@ -223,9 +223,11 @@ func endingToTxtSlice(c chan lex, errstr, f string) ([]string, *ParseError, stri
|
||||||
switch l.value == _QUOTE {
|
switch l.value == _QUOTE {
|
||||||
case true: // A number of quoted string
|
case true: // A number of quoted string
|
||||||
s = make([]string, 0)
|
s = make([]string, 0)
|
||||||
|
empty := true
|
||||||
for l.value != _NEWLINE && l.value != _EOF {
|
for l.value != _NEWLINE && l.value != _EOF {
|
||||||
switch l.value {
|
switch l.value {
|
||||||
case _STRING:
|
case _STRING:
|
||||||
|
empty = false
|
||||||
s = append(s, l.token)
|
s = append(s, l.token)
|
||||||
case _BLANK:
|
case _BLANK:
|
||||||
if quote {
|
if quote {
|
||||||
|
@ -233,7 +235,11 @@ func endingToTxtSlice(c chan lex, errstr, f string) ([]string, *ParseError, stri
|
||||||
return nil, &ParseError{f, errstr, l}, ""
|
return nil, &ParseError{f, errstr, l}, ""
|
||||||
}
|
}
|
||||||
case _QUOTE:
|
case _QUOTE:
|
||||||
|
if empty && quote {
|
||||||
|
s = append(s, "")
|
||||||
|
}
|
||||||
quote = !quote
|
quote = !quote
|
||||||
|
empty = quote
|
||||||
default:
|
default:
|
||||||
return nil, &ParseError{f, errstr, l}, ""
|
return nil, &ParseError{f, errstr, l}, ""
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue