Ejemplo n.º 1
0
        IEnumerable <SourceLine> ExpandInclude(SourceLine line)
        {
            var expanded = new List <SourceLine>();

            if (!line.OperandHasToken)
            {
                throw new Exception();
            }
            var include = line.Operand.ToString();

            if (!include.EnclosedInDoubleQuotes())
            {
                throw new Exception();
            }

            include = include.TrimOnce('"');

            if (line.InstructionName[1] == 'b')
            {
                expanded.Add(Macro.GetBlockDirectiveLine(include, line.LineNumber, line.LabelName, ".block"));
            }

            expanded.AddRange(PreprocessFile(include));

            if (line.InstructionName[1] == 'b')
            {
                expanded.Add(Macro.GetBlockDirectiveLine(include, line.LineNumber, ".endblock"));
            }

            return(expanded);
        }