private void WriteSide(DecompileRule decompiler, ITTEExpression expression)
 {
     if (expression is TernaryExpression || (expression is BinaryOperatorExpression bop && bop.Operator.Precedence < Operator.Precedence))
     {
         decompiler.Append("(");
         expression.Decompile(decompiler);
         decompiler.Append(")");
     }
        public void Decompile(DecompileRule decompiler)
        {
            decompiler.NewLine();

            // Make the condition a comment if it is disabled.
            if (Disabled)
            {
                decompiler.Append("// ");
            }

            // Add the condition.
            decompiler.Append("if (");
            Expression.Decompile(decompiler);
            decompiler.Append(")");
        }
        public void Default(DecompileRule decompiler, bool end)
        {
            decompiler.Append(Function.Name + "(");

            for (int i = 0; i < Values.Length; i++)
            {
                Values[i].Decompile(decompiler);
                if (i < Values.Length - 1)
                    decompiler.Append(", ");
            }

            decompiler.Append(")");

            // Finished
            if (end)
                decompiler.EndAction();
        }
 private void WriteSide(DecompileRule decompiler, ITTEExpression expression, bool left)
 {
     if (expression is TernaryExpression || (
             expression is BinaryOperatorExpression bop &&
             (
                 bop.Operator.Precedence < Operator.Precedence ||
                 (
                     bop.Operator == Operator && (
                         bop.Operator.Contain != ContainGroup.None &&
                         left == (Operator.Contain == ContainGroup.Left)
                         )
                 )
             )
             ))
     {
         decompiler.Append("(");
         expression.Decompile(decompiler);
         decompiler.Append(")");
     }
        public void Decompile(DecompileRule decompiler, bool end)
        {
            if (Disabled)
                decompiler.Append("// ");

            if (WorkshopFunctionDecompileHook.Convert.TryGetValue(Function.WorkshopName, out var action))
                action.Invoke(decompiler, this);
            else
                Default(decompiler, end);
        }
Exemple #6
0
        public void Decompile(DecompileRule decompiler)
        {
            decompiler.AddComment(this);

            switch (Parallel)
            {
            case Parse.CallParallel.NoParallel:
                decompiler.Append(SubroutineName + "()");
                break;

            case Parse.CallParallel.AlreadyRunning_DoNothing:
                decompiler.Append("async! " + SubroutineName + "()");
                break;

            case Parse.CallParallel.AlreadyRunning_RestartRule:
                decompiler.Append("async " + SubroutineName + "()");
                break;
            }
            decompiler.EndAction();
        }
Exemple #7
0
        public void Decompile(DecompileRule decompiler)
        {
            decompiler.AddComment(this);

            if (Disabled)
            {
                decompiler.Append("// ");
            }
            Variable.Decompile(decompiler);

            if (Index != null)
            {
                decompiler.Append("[");
                Index.Decompile(decompiler);
                decompiler.Append("]");
            }

            decompiler.Append(" " + Operator + " ");
            Value.Decompile(decompiler);
            decompiler.EndAction();
        }
 public void Decompile(DecompileRule decompiler)
 {
     WriteSide(decompiler, Left, true);
     decompiler.Append(" " + Operator.Operator + " ");
     WriteSide(decompiler, Right, false);
 }
 public void Decompile(DecompileRule decompiler)
 {
     Player.WritePlayerSeperator(decompiler);
     decompiler.Append(decompiler.Decompiler.GetVariableName(Name, false));
 }
 public void Decompile(DecompileRule decompiler) => decompiler.Append(decompiler.Decompiler.GetVariableName(Name, IsGlobal));