예제 #1
0
        public bool TryParseCode(string code, out DHJassCommand command)
        {
            if (code != "nothing")
            {
                string name = null;
                DHJassGetValueOnDemandCommand value = null;

                DHJassValue   variable;
                List <string> args;

                if (DHJassValue.TryParseDeclaration(code, out variable, out args))
                {
                    name  = args[0];
                    value = new DHJassGetValueOnDemandCommand(args.Count > 1 ? args[1] : string.Empty);
                }
                else
                {
                    variable = new DHJassUnusedType();
                    name     = "error!";
                    value    = null;
                }

                command = new DHJassPassValueCopyCommand(variable, name, value);
                return(true);
            }

            command = null;
            return(false);
        }
예제 #2
0
        void parse(string name, List <string> argList)
        {
            DHJassExecutor.Functions.TryGetValue(name, out this.function);
            if (function == null && DHJassExecutor.ShowMissingFunctions)
            {
                DHJassExecutor.ReportMissingFunction(name);
            }

            //CaptureCollection cc = match.Groups["arg"].Captures;
            args = new DHJassCommand[argList.Count];

            for (int i = 0; i < argList.Count; i++)
            {
                args[i] = new DHJassGetValueOnDemandCommand(argList[i]);
            }
        }
예제 #3
0
 public DHJassReturnOperation(List<string> lines, ref int line, List<string> args)
 {
     //returnValueCode = match.Groups["value"].Value;
     returnCommand = new DHJassGetValueOnDemandCommand(args[0]);
 }
예제 #4
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;
                }
            }
        }
예제 #5
0
 public DHJassExitLoopWhenOperation(List<string> lines, ref int line, List<string> args)
 {
     Condition = new DHJassGetValueOnDemandCommand(args[0]);
     if (DHJassCompiler.Loops.Count != 0)
     {
         DHJassLoopOperation Loop = DHJassCompiler.Loops.Peek();
         LoopEndPoint = Loop.EndPoint;
     }
 }
예제 #6
0
        void parse(string name, List<string> argList)
        {
            DHJassExecutor.Functions.TryGetValue(name, out this.function);
            if (function == null && DHJassExecutor.ShowMissingFunctions)
                DHJassExecutor.ReportMissingFunction(name);

            //CaptureCollection cc = match.Groups["arg"].Captures;
            args = new DHJassCommand[argList.Count];

            for (int i = 0; i < argList.Count; i++)
                args[i] = new DHJassGetValueOnDemandCommand(argList[i]);
        }
예제 #7
0
        public bool TryParseCode(string code, out DHJassCommand command)
        {
            if (code != "nothing")
            {
                string name = null;
                DHJassGetValueOnDemandCommand value = null;

                DHJassValue variable;
                List<string> args;

                if (DHJassValue.TryParseDeclaration(code, out variable, out args))
                {
                    name = args[0];
                    value = new DHJassGetValueOnDemandCommand(args.Count > 1 ? args[1] : string.Empty);
                }
                else
                {
                    variable = new DHJassUnusedType();
                    name = "error!";
                    value = null;
                }

                command = new DHJassPassValueCopyCommand(variable, name, value);
                return true;
            }

            command = null;
            return false;
        }