parser: remove unreachable code (#170)

This commit is contained in:
Unknwon
2018-12-02 19:56:02 -05:00
parent 9c8236e659
commit ffaaebdac6
2 changed files with 3 additions and 11 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ const (
// Maximum allowed depth when recursively substituing variable names.
_DEPTH_VALUES = 99
_VERSION = "1.39.0"
_VERSION = "1.39.1"
)
// Version returns current package version literal.
+2 -10
View File
@@ -273,7 +273,6 @@ func (p *parser) readValue(in []byte,
parserBufferPeekResult, _ := p.buf.Peek(parserBufferSize)
peekBuffer := bytes.NewBuffer(parserBufferPeekResult)
identSize := -1
val := line
for {
@@ -290,12 +289,11 @@ func (p *parser) readValue(in []byte,
return val, nil
}
currentIdentSize := len(peekMatches[1])
// NOTE: Return if not a python-ini multi-line value.
if currentIdentSize < 0 {
currentIdentSize := len(peekMatches[1])
if currentIdentSize <= 0 {
return val, nil
}
identSize = currentIdentSize
// NOTE: Just advance the parser reader (buffer) in-sync with the peek buffer.
_, err := p.readUntil('\n')
@@ -305,12 +303,6 @@ func (p *parser) readValue(in []byte,
val += fmt.Sprintf("\n%s", peekMatches[2])
}
// NOTE: If it was a Python multi-line value,
// return the appended value.
if identSize > 0 {
return val, nil
}
}
return line, nil