Ejemplo n.º 1
0
        private void ProcessMacro(ref int rowIndex, ref int lineNumber, PreprocessorRowTokenizer tokenizer)
        {
            MacroPreprocessor m = new MacroPreprocessor(m_IncludeDirectories, m_FileName, m_Defines);

            if (!m.PreprocessMacro(ref rowIndex, ref lineNumber, m_ProgramLines, tokenizer))
            {
                throw new Z80AssemblerException(m.StatusMessage);
            }

            if (!m_Macros.ContainsKey(m.Name))
            {
                m_Macros.Add(m.Name, m);
            }
            else
            {
                throw new Z80AssemblerException($"A '{m.Name}' nevű makró már definiálva van!");
            }
        }
Ejemplo n.º 2
0
        private bool TryDetectMacroCall(string token, out MacroPreprocessor macroPreprocessor)
        {
            macroPreprocessor = null;
            string macroNameSearchString = string.Empty;

            foreach (char c in token)
            {
                macroNameSearchString += c;
                var searchString = macroNameSearchString;
                macroPreprocessor = m_Macros.Where(kvp => kvp.Key.Equals(searchString)).Select(kvp => kvp.Value)
                                    .FirstOrDefault();
                if (macroPreprocessor != null)
                {
                    return(true);
                }
            }
            return(false);
        }