private static void Finish(Lut values, string data, int index, int line, ref double key, ref int started, ref int malformed) {
if (started != -1) {
if (double.IsNaN(key)) {
if (malformed == -1) malformed = line;
} else {
double value;
if (FlexibleParser.TryParseDouble(data.Substring(started, index - started), out value)) {
values.Add(new LutPoint(key, value));
} else {
if (malformed == -1) malformed = line;
}
key = double.NaN;
}
started = -1;
} else if (!double.IsNaN(key)) {
key = double.NaN;
}
}