func nextNonSpaceValue()

in lunes.go [366:391]


func nextNonSpaceValue(value string, offset int, max int) (newOffset, skippedSpaces int, val string, err error) {
	newOffset = offset
	for newOffset < len(value) && unicode.IsSpace(rune(value[newOffset])) {
		newOffset++
	}

	skippedSpaces = newOffset - offset
	if newOffset > len(value) {
		return offset, skippedSpaces, "", errors.New("next non-space value not found")
	}

	for newOffset < len(value) {
		if !unicode.IsSpace(rune(value[newOffset])) {
			val += string(value[newOffset])
			newOffset++
		} else {
			return newOffset, skippedSpaces, val, nil
		}

		if len(val) == max {
			return newOffset, skippedSpaces, val, nil
		}
	}

	return newOffset, skippedSpaces, val, nil
}