示例#1
0
        public override void Assembly(Assembler asm)
        {
            asm.Begin(this);
            asm.AddToken("IF");
            asm.AddSpace();
            asm.Add(Condition);
            asm.AddSpace();
            asm.AddToken("THEN");
            asm.AddSpace();
            asm.IncreaseIndentation();
            asm.NewLine();
            asm.Add(TrueStatement);
            asm.DecreaseIndentation();
            if (FalseStatement.Count() != 0)
            {
                asm.NewLine();
                asm.AddToken("ELSE");
                asm.AddSpace();
                asm.IncreaseIndentation();
                asm.NewLine();
            }

            // This is needed in order to process comments after FalseStatement.
            asm.Add(FalseStatement);

            if (FalseStatement.Count() != 0)
            {
                asm.DecreaseIndentation();
            }
            asm.NewLine();
            asm.AddToken("END IF");
            asm.End(this);
        }
示例#2
0
 public override void Assembly(Assembler asm)
 {
     asm.Begin(this);
     asm.AddToken("WHILE");
     asm.AddSpace();
     asm.Add(Condition);
     asm.AddSpace();
     asm.AddToken("DO");
     asm.AddSpace();
     asm.IncreaseIndentation();
     asm.NewLine();
     asm.Add(Statement);
     asm.DecreaseIndentation();
     asm.NewLine();
     asm.AddToken("END WHILE");
     asm.End(this);
 }