Skip to content

Commit b483eb0

Browse files
committed
[F] 为 ParseHoldNote 实现与 ParseSlideNote 相同的多行跟随消费逻辑(循环读取合法 #…>s/#…>c,跳过 ' 与 @ 行,累加 HoldDuration)。
1 parent ca6db1e commit b483eb0

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

parser/chu/UgcParser.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -312,19 +312,23 @@ private static int ParseHoldNote(string[] lines, int idx, string code, ChuNote n
312312
note.Type = "HLD";
313313
ParseCellWidth(code, 1, note, alerts, idx + 1);
314314

315-
if (idx + 1 < lines.Length)
315+
bool foundFirst = false;
316+
while (idx + 1 < lines.Length)
316317
{
317318
var nextLine = lines[idx + 1].Trim();
318-
if (TryParseFollowerLine(nextLine, out var duration, out _, out _))
319+
if (!TryParseFollowerLine(nextLine, out var duration, out _, out _))
319320
{
320-
note.HoldDuration = duration;
321-
return idx + 1;
321+
if (nextLine.StartsWith('\'') || nextLine.StartsWith('@')) { idx++; continue; }
322+
break;
322323
}
323-
// next line might be a comment or directive, not a warning
324-
if (nextLine.StartsWith('\'') || nextLine.StartsWith('@'))
325-
return idx;
324+
325+
note.HoldDuration += duration;
326+
idx++;
327+
foundFirst = true;
326328
}
327-
alerts.Add(new Alert(Warning, $"HLD 音符缺少时长跟随行") { Line = idx + 1, RelevantNote = FormatNoteRef(note) });
329+
330+
if (!foundFirst)
331+
alerts.Add(new Alert(Warning, $"HLD 音符缺少时长跟随行") { Line = idx + 1, RelevantNote = FormatNoteRef(note) });
328332
return idx;
329333
}
330334

0 commit comments

Comments
 (0)