ProcessDefinitionFile() 공개 메소드

public ProcessDefinitionFile ( string fileName ) : void
fileName string
리턴 void
예제 #1
0
파일: Program.cs 프로젝트: sybila/BCSParser
        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();
            }
        }
예제 #2
0
        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);
            }
        }