Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,25 @@ func parseBytes(src []byte, out map[string]string) error {
//
// It skips any comment line or non-whitespace character.
func getStatementStart(src []byte) []byte {
pos := indexOfNonSpaceChar(src)
if pos == -1 {
return nil
}
for {
pos := indexOfNonSpaceChar(src)
if pos == -1 {
return nil
}

src = src[pos:]
if src[0] != charComment {
return src
}
src = src[pos:]
if src[0] != charComment {
return src
}

// skip comment section
pos = bytes.IndexFunc(src, isCharFunc('\n'))
if pos == -1 {
return nil
}
// skip comment section
pos = bytes.IndexFunc(src, isCharFunc('\n'))
if pos == -1 {
return nil
}

return getStatementStart(src[pos:])
src = src[pos:]
}
}

// locateKeyName locates and parses key name and returns rest of slice
Expand Down
Loading