Ejemplo n.º 1
0
        public DHJassLoopOperation(List <string> lines, ref int line, List <string> args)
        {
            DHJassCompiler.Loops.Push(this);

            DHJassOperation LoopEndPoint;

            line++;
            if (DHJassFunction.TryCreateBody(lines, ref line, this, out EntryPoint, out LoopEndPoint))
            {
                LoopEndPoint.SetNext(EntryPoint);
            }

            DHJassCompiler.Loops.Pop();
        }
Ejemplo n.º 2
0
        public DHJassIfElseOperation(List <string> lines, ref int line, List <string> args, DHJassEmptyOperation endPoint)
        {
            DHJassOperation StatementEndPoint;

            Condition = new DHJassGetValueOnDemandCommand(args[0]);
            line++;
            if (DHJassFunction.TryCreateBody(lines, ref line, this, out Then, out StatementEndPoint))
            {
                this.EndPoint = endPoint;

                StatementEndPoint.SetNext(EndPoint);

                string currentLine = lines[line].Trim();

                switch (currentLine)
                {
                case "else":
                    line++;
                    if (DHJassFunction.TryCreateBody(lines, ref line, this, out Else, out StatementEndPoint))
                    {
                        StatementEndPoint.SetNext(EndPoint);
                    }
                    break;

                case "endif":
                    Else = EndPoint;
                    break;

                default:
                    if (this.IsSyntaxMatch(currentLine, out args))
                    {
                        Else = new DHJassIfElseOperation(lines, ref line, args, endPoint);
                        //Else.GetLast().SetNext(EndPoint);
                    }
                    break;
                }
            }
        }