Beispiel #1
0
 public EocIfStatement(CodeConverter c, EocExpression condition, EocStatementBlock block, bool mask, string comment) : base(c)
 {
     Condition = condition;
     Block     = block;
     Comment   = comment;
     Mask      = mask;
 }
 public EocDoWhileStatement(CodeConverter c, EocExpression condition, EocStatementBlock block, bool mask, string commentOnStart, string commentOnEnd) : base(c)
 {
     Condition      = condition;
     Block          = block;
     Mask           = mask;
     CommentOnStart = commentOnStart;
     CommentOnEnd   = commentOnEnd;
 }
 public EocIfElseStatement(CodeConverter c, EocExpression condition, EocStatementBlock blockOnTrue, EocStatementBlock blockOnFalse, bool mask, string comment) : base(c)
 {
     Condition    = condition;
     BlockOnTrue  = blockOnTrue;
     BlockOnFalse = blockOnFalse;
     Comment      = comment;
     Mask         = mask;
 }
 public EocCounterStatement(CodeConverter c, EocExpression count, EocExpression var, EocStatementBlock block, bool mask, string commentOnStart, string commentOnEnd) : base(c)
 {
     Count          = count;
     Var            = var;
     Block          = block;
     Mask           = mask;
     CommentOnStart = commentOnStart;
     CommentOnEnd   = commentOnEnd;
 }
Beispiel #5
0
 public static CaseInfo Translate(CodeConverter C, SwitchStatement.CaseInfo info)
 {
     return(new CaseInfo()
     {
         Condition = EocExpression.Translate(C, info.Condition),
         UnexaminedCode = info.UnexaminedCode,
         Block = EocStatementBlock.Translate(C, info.Block),
         Comment = info.Comment,
         Mask = info.Mask
     });
 }
Beispiel #6
0
 public EocForStatement(CodeConverter c, EocExpression start, EocExpression end, EocExpression step, EocExpression var, EocStatementBlock block, bool mask, string commentOnStart, string commentOnEnd) : base(c)
 {
     Start          = start;
     End            = end;
     Step           = step;
     Var            = var;
     Block          = block;
     Mask           = mask;
     CommentOnStart = commentOnStart;
     CommentOnEnd   = commentOnEnd;
 }
Beispiel #7
0
 public static EocIfStatement Translate(CodeConverter C, IfStatement stat)
 {
     if (stat == null)
     {
         return(null);
     }
     return(new EocIfStatement(
                C,
                EocExpression.Translate(C, stat.Condition),
                EocStatementBlock.Translate(C, stat.Block),
                stat.Mask,
                stat.Comment));
 }
 public static EocDoWhileStatement Translate(CodeConverter C, DoWhileStatement stat)
 {
     if (stat == null)
     {
         return(null);
     }
     return(new EocDoWhileStatement(
                C,
                EocExpression.Translate(C, stat.Condition),
                EocStatementBlock.Translate(C, stat.Block),
                stat.MaskOnStart || stat.MaskOnEnd,
                stat.CommentOnStart,
                stat.CommentOnEnd));
 }
Beispiel #9
0
 public void WriteLetExpression(CodeWriter writer, EocExpression target, Action writeValue)
 {
     if (target is EocAccessMemberExpression expr && expr.MemberInfo.Setter != null)
     {
         expr.Target.WriteTo(writer);
         writer.Write("->");
         writer.Write(expr.MemberInfo.Setter);
         writer.Write("(");
         writeValue();
         writer.Write(")");
         return;
     }
     target.WriteTo(writer);
     writer.Write(" = ");
     writeValue();
 }
Beispiel #10
0
 public static EocForStatement Translate(CodeConverter C, ForStatement stat)
 {
     if (stat == null)
     {
         return(null);
     }
     return(new EocForStatement(
                C,
                EocExpression.Translate(C, stat.Start),
                EocExpression.Translate(C, stat.End),
                EocExpression.Translate(C, stat.Step),
                EocExpression.Translate(C, stat.Var),
                EocStatementBlock.Translate(C, stat.Block),
                stat.MaskOnStart || stat.MaskOnEnd,
                stat.CommentOnStart,
                stat.CommentOnEnd));
 }
 public static EocExpressionStatement Translate(CodeConverter C, ExpressionStatement stat)
 {
     if (stat == null)
     {
         return(null);
     }
     if (stat.Mask)
     {
         return(new EocExpressionStatement(
                    C,
                    null,
                    stat.Expression.ToTextCode(C.P.IdToNameMap) + " '" + stat.Comment));
     }
     else
     {
         return(new EocExpressionStatement(
                    C,
                    EocExpression.Translate(C, stat.Expression),
                    stat.Comment));
     }
 }
 public EocExpressionStatement(CodeConverter c, EocExpression expr, string comment) : base(c)
 {
     Expr    = expr;
     Comment = comment;
 }