// ブロック終了まで進める private void SkipUntilBlockEnd(MmlFileReader m) { while (true) { m.SkipSkipable(); var ct = m.FetchType(); if (ct == MmlCharactorType.GeneralChanacter || ct == MmlCharactorType.Separator) { VerboseWriteLine($"{m.GetPosition()} {ct}"); m.SkipType(); continue; } if (ct == MmlCharactorType.Eof) { Error.Add(ErrorData.Type.BlockEndNotFound); return; } if (ct == MmlCharactorType.BlockEnd) { m.SkipType(); m.StepNextLine(); return; } Error.Add(ErrorData.Type.UnknownCharacterUsed); return; } }
// 音色を読み出す private int[] ReadToneParameter(MmlFileReader m) { List <int> Parameter = new List <int>(); bool SkipSeparator = false; while (true) { m.SkipSkipable(); var ct = m.FetchType(); // EOF if (ct == MmlCharactorType.Eof) { Error.Add(ErrorData.Type.BlockEndNotFound); return(null); } // Separator if (ct == MmlCharactorType.Separator) { VerboseWriteLine($"{m.GetPosition()} {ct}"); if (!SkipSeparator) { SkipSeparator = false; Parameter.Add(0); } m.SkipType(); continue; } if (m.IsLineEnd(ct) || m.IsComment(ct)) { m.SkipType(); continue; } if (ct == MmlCharactorType.GeneralChanacter) { SkipSeparator = true; VerboseWriteLine($"{m.GetPosition()} {ct}"); Parameter.Add(ReadParameter(m)); continue; } if (ct == MmlCharactorType.BlockEnd) { m.SkipType(); m.StepNextLine(); return(Parameter.ToArray()); } Error.Add(ErrorData.Type.UnknownCharacterUsed); return(null); } }
// ブロック開始まで進める private bool SkipUntilBlockStart(MmlFileReader m) { m.SkipSkipable(); var ct = m.FetchType(); if (ct != MmlCharactorType.BlockStart) { Error.Add(ErrorData.Type.BlockStartNotFound); return(false); } m.SkipType(); return(true); }