override public void Pretty(PrettyBuilder builder) { builder.NewLine(); builder.Append("return "); returnValue.Pretty(builder); builder.Append(";"); }
override public void Pretty(PrettyBuilder builder) { builder.Append(id.id); builder.Append("("); builder.Intersperse(exprList, ", "); builder.Append(")"); }
override public void Pretty(PrettyBuilder builder) { builder.NewLine(); builder.Append("{"); builder.Indent(); builder.PrettyStm(stmList); builder.Unindent(); builder.NewLine(); builder.Append("}"); }
override public void Pretty(PrettyBuilder builder) { builder.NewLine(); builder.Append("if("); exp.Pretty(builder); builder.Append(")"); //builder.Indent(); stm.Pretty(builder); //builder.Unindent(); //builder.NewLine(); }
override public void Pretty(PrettyBuilder builder) { builder.NewLine(); builder.Append(types[type] + " "); builder.Append(id.id); builder.Append("("); builder.Intersperse(arg, ", "); builder.Append(")"); stm.Pretty(builder); //builder.NewLine(); }
// public string Name ; // public Expression Argument; override public void Pretty(PrettyBuilder builder, int outerPrecedence, bool opposite) { if (outerPrecedence >= 4) { builder.Append("("); } builder.Append($"{Name} "); Argument.Pretty(builder, 4, false); if (outerPrecedence >= 4) { builder.Append(")"); } }
override public void Pretty(PrettyBuilder builder, int outerPrecedence, bool opposite) { bool eval = outerPrecedence > precedences[op] || opposite && outerPrecedence == precedences[op]; if (eval) { builder.Append("("); } left.Pretty(builder, precedences[op], false); builder.Append(" " + operators[op] + " "); right.Pretty(builder, precedences[op], true); if (eval) { builder.Append(")"); } }
override public void Pretty(PrettyBuilder builder, int outerPrecedence, bool opposite) { bool eval = outerPrecedence > 1 || opposite && outerPrecedence == 1; if (eval) { builder.Append("("); } lo.Pretty(builder); builder.Append(" = "); ro.Pretty(builder); if (eval) { builder.Append(")"); } }
override public void Pretty(PrettyBuilder builder, int outerPrecedence, bool opposite) { BinaryOperatorExpression tempB; UnaryOperatorExpression tempU; AssignmentExpression tempA; bool eval = false; System.Type type = exp.GetType(); if (type.Name == "UnaryOperatorExpression") { tempU = (UnaryOperatorExpression)exp; eval = outerPrecedence > 8; } if (type.Name == "BinaryOperatorExpression") { tempB = (BinaryOperatorExpression)exp; eval = outerPrecedence > BinaryOperatorExpression.precedences[tempB.op]; } if (type.Name == "AssignmentExpression") { tempA = (AssignmentExpression)exp; eval = outerPrecedence >= 1; } builder.Append(operators[op]); exp.Pretty(builder, 8, false); }
// public string Name; // public string ArgumentName; // public Expression Body; // public Expression Recipient; override public void Pretty(PrettyBuilder builder, int outerPrecedence, bool opposite) { if (outerPrecedence > 1) { builder.Append("("); } builder.Append($"let {Name} {ArgumentName} = "); Body.Pretty(builder, 1, false); builder.Append(" in "); Recipient.Pretty(builder, 1, false); if (outerPrecedence > 1) { builder.Append(")"); } }
override public void Pretty(PrettyBuilder builder, int outerPrecedence, bool opposite) { var precedence = Precedences[Operator]; var associativity = Associativities[Operator]; if (outerPrecedence > precedence || opposite && outerPrecedence == precedence) { builder.Append("("); } Expression1.Pretty(builder, precedence, associativity == Associativity.Right); builder.Append(Strings[Operator]); Expression2.Pretty(builder, precedence, associativity == Associativity.Left); if (outerPrecedence > precedence || opposite && outerPrecedence == precedence) { builder.Append(")"); } }
// public Expression Expression1; // public Expression Expression2; override public void Pretty(PrettyBuilder builder, int outerPrecedence, bool opposite) { if (outerPrecedence > 0) { builder.Append("("); builder.Indent(); builder.NewLine(); } Expression1.Pretty(builder, 0, false); builder.Append(", "); builder.NewLine(); Expression2.Pretty(builder, 0, false); if (outerPrecedence > 0) { builder.Unindent(); builder.NewLine(); builder.Append(")"); builder.NewLine(); } }
override public void Pretty(PrettyBuilder builder) { builder.Append(types[type] + " "); builder.Append(id.id); }
override public void Pretty(PrettyBuilder builder) { builder.NewLine(); builder.Append("return;"); }
override public void Pretty(PrettyBuilder builder) { builder.Append(binvalue.ToString().ToLower()); }
override public void Pretty(PrettyBuilder builder) { lo.Pretty(builder); builder.Append(" = "); ro.Pretty(builder); }
// public string Value; override public void Pretty(PrettyBuilder builder, int outerPrecedence, bool opposite) { builder.Append(Value); }
override public void Pretty(PrettyBuilder builder) { builder.Append(num.ToString()); }
override public void Pretty(PrettyBuilder builder) { builder.Append(id); }
override public void Pretty(PrettyBuilder builder) { builder.NewLine(); decl.Pretty(builder); builder.Append(";"); }