Beispiel #1
0
        void AddBlock(int index, AsmBlock block)
        {
            Span blockSpan = new Span();

            AsmBlockDecorator decoratedBlock = new AsmBlockDecorator()
            {
                Block        = block,
                Span         = blockSpan,
                Instructions = new List <AsmInstructionDecorator>()
            };

            m_decoratedFunction.Blocks.Add(decoratedBlock);

            foreach (AsmInstruction instruction in block.Instructions)
            {
                AsmInstructionDecorator decoratedInstruction = null;

                if (instruction.IsLabel)
                {
                    AddPadding(blockSpan.Inlines, m_viewOptions.LabelPadding);
                    decoratedInstruction = CreateLabel(instruction);
                }
                else
                {
                    AddPadding(blockSpan.Inlines, m_viewOptions.InstructionPadding);
                    decoratedInstruction = CreateInstruction(instruction);
                }

                decoratedBlock.Instructions.Add(decoratedInstruction);
                blockSpan.Inlines.Add(decoratedInstruction.Span);
                blockSpan.Inlines.Add(new Run(Environment.NewLine));
            }

            m_text.Inlines.Add(blockSpan);
        }
Beispiel #2
0
        AsmBlock ParseBlockWithSource()
        {
            int minLine = ParseSourceLineNumber(CurrentLine);

            string lastSourceLine = null;

            while (CurrentLine[0] == ';')
            {
                lastSourceLine = CurrentLine;
                NextLine();
            }

            int maxLine = ParseSourceLineNumber(lastSourceLine);

            AsmBlock block = new AsmBlock {
                Range = new LineRange(minLine, maxLine)
            };

            SkipEmptyLines();

            Debug.Assert(CurrentLine[0] != ';');
            Debug.Assert(!CurrentLine.Contains(FunctionEndID));

            List <AsmInstruction> assembly = new List <AsmInstruction>();

            while (!IsEndOfBlock(CurrentLine))
            {
                assembly.Add(ParseInstruction(CurrentLine));
                NextLine();
            }

            block.Instructions = assembly.ToArray();
            return(block);
        }
Beispiel #3
0
        AsmBlock ParseBlockAssembly()
        {
            AsmBlock block = new AsmBlock {
                Range = LineRange.InvalidRange
            };

            List <AsmInstruction> assembly = new List <AsmInstruction>();

            while (!CurrentLine.Contains(FunctionEndID))
            {
                assembly.Add(ParseInstruction(CurrentLine));
                NextLine();
            }

            block.Instructions = assembly.ToArray();
            return(block);
        }