static void Main(string[] args) { BcsDefinitionFile document; using (var bcsHandler = new BcsFileHandler()) { bcsHandler.ProcessDefinitionFile("yamada.txt"); document = bcsHandler.DefinitionFile; } //categorize var malformedLines = document.Entities.SelectMany(e => e.MalformedLines).Concat(document.Rules.SelectMany(r => r.MalformedLines)); var equations = document.Rules.Select(r => r.Equation); //write debug output using (var writer = new System.IO.StreamWriter("eq.txt")) { foreach (var equation in equations) { writer.WriteLine(equation.SourceText); var stringifiedTokens = equation.SourceTokens.Select(token => $"[{token.Type.GetDescription()}]"); writer.WriteLine(string.Join("", stringifiedTokens)); } writer.Close(); } }
public void LoadBcsFile(string fileName) { BcsDefinitionFile document; using (var bcsHandler = new BcsFileHandler()) { bcsHandler.ProcessDefinitionFile("yamada.txt"); document = bcsHandler.DefinitionFile; } _reactions = document.Rules.Select(r => r.Equation.ExpressionNode).ToDictionary(reaction => reaction.UniqueId); _document = document; StateNames = new ObservableCollection<string>(); foreach(var state in document.States) { StateNames.Add(state.Name); } }