コード例 #1
0
ファイル: Program.cs プロジェクト: LexouDuck/Event-Assembler
        // Used by Emblem Magic (and could potentially be used by other external software)
        public static void Assemble(EACodeLanguage language,
                                    TextReader input, BinaryWriter output, ILog log)
        {
            List <string> stringList = new List <string>();

            stringList.Add("_" + language.Name + "_");
            stringList.Add("_EA_");
            using (IPreprocessor preprocessor = new Preprocessor(log))
            {
                preprocessor.AddReserved(language.GetCodeNames());
                preprocessor.AddDefined(stringList.ToArray());
                using (IInputStream inputStream = new PreprocessingInputStream(input, preprocessor))
                {
                    new EAExpressionAssembler(language.CodeStorage,
                                              new TokenParser <int>(new Func <string, int>(StringExtensions.GetValue))).Assemble(inputStream, output, log);
                }
            }
        }