Exemple #1
0
        public override string ToCode()
        {
            var sb = new StringBuilder("if(");

            if (IfCondition != null)
            {
                sb.Append(IfCondition.ToString());
            }
            else if (IfVariable != null)
            {
                sb.Append(IfVariable.ToString(true, false, true));
            }

            sb.AppendLine(")");

            if (ScopedStatement != null)
            {
                sb.Append(ScopedStatement.ToCode());
            }

            if (ElseStatement != null)
            {
                sb.AppendLine().Append("else ").Append(ElseStatement.ToCode());
            }

            return(sb.ToString());
        }
Exemple #2
0
        public static string GeneratePrototype(DVariable dv)
        {
            var sb = new StringBuilder("Variable in ");

            sb.Append(AbstractNode.GetNodePath(dv, false));
            sb.Append(": ");

            sb.Append(dv.ToString(false));
            return(sb.ToString());
        }
Exemple #3
0
 public override ISymbolValue this[DVariable variable]
 {
     get
     {
         ISymbolValue v;
         if (Locals.TryGetValue(variable, out v))
         {
             return(v);
         }
         throw new CtfeException("Variable " + variable.ToString() + " not set yet!");
     }
     set
     {
         if (variable == null)
         {
             throw new CtfeException("Can't set non-existent variable");
         }
         Locals[variable] = value;
     }
 }
Exemple #4
0
 public override string ToCode()
 {
     return("catch" + (CatchParameter != null ? ('(' + CatchParameter.ToString() + ')') : "")
            + (ScopedStatement != null ? (' ' + ScopedStatement.ToCode()) : ""));
 }
Exemple #5
0
 public override string ToCode()
 {
     return(Variable == null ?"null":Variable.ToString(false));
 }
Exemple #6
0
 public override string ToCode()
 {
     return(Definition.ToString(false, true));
 }
Exemple #7
0
 public override string ToCode()
 {
     return(BaseExpression == null ? (Variable == null ?"null":Variable.ToString(false)) : BaseExpression.ToString());
 }