Esempio n. 1
0
        /// <summary>
        /// Asynchronously compiles the given source into a bank.
        /// Each call to MoveNext on the iterator will compile one entry.
        /// </summary>
        /// <param name="inSource">Source for entries.</param>
        /// <param name="inLinks">Optional collection of banks to use when linking.</param>
        /// <param name="outResult">Target for storing compilation results.</param>
        public IEnumerator CompileAsync(IMacroCompilerSource inSource, ICollection <MacroBank> inLinks, MacroCompilerResult outResult)
        {
            ClearOutputState();

            m_LinkedBanks = inLinks;

            if (m_Config != null)
            {
                if (m_Config.RecognizedMacros != null)
                {
                    foreach (var macro in m_Config.RecognizedMacros)
                    {
                        SetMacroKnown(macro);
                    }
                }
            }

            foreach (var kv in inSource.Entries)
            {
                CompileEntry(kv.Key, kv.Value);
                yield return(null);
            }

            outResult.Bank = new CompiledMacroBank(m_MacroDictionary, m_StringTable.ToArray());

            outResult.UnrecognizedMacros   = ToArray(m_UnknownMacros);
            outResult.UnrecognizedMacroIds = ToArray(m_UnknownMacroHashes);
            outResult.MacroNames           = ToArray(m_CompiledMacroNames);

            outResult.MacroCount    = m_MacroDictionary.Count;
            outResult.StringCount   = m_StringTable.Count;
            outResult.ReusedStrings = m_StringReuseCounter;

            ClearOutputState();
        }
Esempio n. 2
0
 /// <summary>
 /// Asynchronously compiles the given source into a bank.
 /// Each call to MoveNext on the iterator will compile one entry.
 /// </summary>
 /// <param name="inSource">Source for entries.</param>
 /// <param name="outResult">Target for storing compilation results.</param>
 public IEnumerator CompileAsync(IMacroCompilerSource inSource, MacroCompilerResult outResult)
 {
     return(CompileAsync(inSource, null, outResult));
 }