public Boolean ParseEntrypoints() { VerifySyntaxToken(TokenType.OpenBlock, "{"); while (true) { if (!Enumerator.HasToken()) { throw new MicroassemblerParseException(Enumerator.Last, "Pair or } expected"); } if (Enumerator.Current.TokenType == TokenType.CloseBlock) { Enumerator.Advance(); break; } if (Enumerator.Current.TokenType == TokenType.Pair) { Object[] pair = Enumerator.Current.Value as Object[]; Enumerator.Advance(); if (!(pair[1] is String)) { throw new MicroassemblerParseException(Enumerator.Last, "Entrypoint pair value must be a symbol"); } String symbol = (String)pair[1]; if (pair[0] is String) { String key = pair[0] as String; switch (key.ToLower()) { case "fetch": Microprogram.FetchEntrypoint = symbol; break; case "interrupt": Microprogram.InterruptEntrypoint = symbol; break; default: throw new MicroassemblerParseException(Enumerator.Last, $"Invalid entrypoint '{key}'"); } } else if (pair[0] is long) { int entryIndex = Convert.ToInt32(pair[0]); if (Microprogram.InstructionEntrypoints.ContainsKey(entryIndex)) { Console.WriteLine($"Warning: Duplicate entrypoint definition on line {Enumerator.Last.Line}, previous value overridden"); } Microprogram.InstructionEntrypoints[entryIndex] = symbol; } else { throw new MicroassemblerParseException(Enumerator.Last, "Invalid Entrypoint"); } if (Enumerator.HasNext() && Enumerator.Next.TokenType == TokenType.Pair) { VerifySyntaxToken(TokenType.ListDelimeter, ","); } if (Enumerator.HasNext() && Enumerator.Next.TokenType == TokenType.CloseBlock) { DiscardOptionalToken(TokenType.ListDelimeter, ","); } } else { throw new MicroassemblerParseException(Enumerator.Current, "Pair expected"); } } return(true); }