public void Visit(AdditionExpression obj) { _sb.Append("("); obj.Left.Accept(this); _sb.Append(" + "); obj.Right.Accept(this); _sb.Append(")"); }
public void Test_using_the_print_visitor() { var exp = new AdditionExpression( left: new DoubleExpression(1.0), right: new AdditionExpression( left: new DoubleExpression(2.0), right: new DoubleExpression(3.0)) ); var printer = new ExpressionPrinter(); printer.Visit(exp); string result = printer.ToString(); Assert.False(string.IsNullOrEmpty(result)); }