public ForStatement(BasicExpression v, BasicExpression start, BasicExpression end, BasicExpression step) { this.v = v; this.start = start; this.end = end; this.step = step; }
public void IfThen(BasicExpression cond, BasicStatement[] ifTrue) { this.sb.Append("If(").Append(cond); foreach (BasicStatement stmt in ifTrue) { this.sb.Append(", "); this.sb.Append(stmt); } this.sb.Append(")"); }
public static BasicOperator Ternary(string name, BasicType type, BasicExpression x, BasicExpression y, BasicExpression z) { return(new BasicOperator(name, type, new BasicExpression[] { x, y, z })); }
public static BasicOperator Unary(string name, BasicType type, BasicExpression x) { return(new BasicOperator(name, type, new BasicExpression[] { x })); }
public static void Bad(string input) { Action act = () => BasicExpression.FromString(input); act.Should().Throw <FormatException>("[{0}]", input).WithMessage("*'" + input + "'*").WithInnerException <Exception>(); }
public static void Good(string input, string output) { BasicExpression.FromString(input).ToString().Should().Be(output, "[{0}]", input); }
public void Input(string prompt, BasicExpression v) { this.sb.Append("Input(\"").Append(prompt).Append("\", ").Append(v).Append(")"); }
public void For(BasicExpression v, BasicExpression start, BasicExpression end, BasicExpression step) { this.Write("For", v, start, end, step); }
public void Assign(BasicExpression left, BasicExpression right) { this.Write("Assign", left, right); }
public IfThenStatement(BasicExpression cond, IEnumerable <BasicStatement> ifTrue) { this.cond = cond; this.ifTrue = ifTrue.ToArray(); }
public AssignmentStatement(BasicExpression left, BasicExpression right) { this.left = left; this.right = right; }
public InputStatement(string prompt, BasicExpression v) { this.prompt = prompt; this.v = v; }