// this won't appear in the overall AST, but in the course of debugging it may be worthwhile to print out a partial node public override string ToString() { StringBuilder sb = new StringBuilder("GPARTIAL<<"); if (NumTimes != null) { if (NumTimes is LiteralNode || NumTimes is MacroNode) { sb.Append(NumTimes.ToString()); } else { sb.AppendFormat("({0})", NumTimes.ToString()); } } sb.Append("{"); sb.Append(String.Join(", ", GroupExpressions.Select(o => o.ToString()))); sb.Append("}"); if (RerollNode != null) { sb.Append(RerollNode.ToString()); } foreach (var k in Keep) { sb.Append(k.ToString()); } if (Sort != null) { sb.Append(Sort.ToString()); } if (Success != null) { sb.Append(Success.ToString()); } foreach (var f in Functions) { sb.Append(f.ToString()); } sb.Append(">>"); return(sb.ToString()); }
internal void AddReroll(RerollNode reroll) { if (RerollNode != null && RerollNode.MaxRerolls != reroll.MaxRerolls) { throw new DiceException(DiceErrorCode.MixedReroll); } if (RerollNode == null) { RerollNode = reroll; } else { RerollNode.Comparison.Add(reroll.Comparison); } }
// this won't appear in the overall AST, but in the course of debugging it may be worthwhile to print out a partial node public override string ToString() { StringBuilder sb = new StringBuilder("RPARTIAL<<"); sb.Append(Roll.ToString()); if (RerollNode != null) { sb.Append(RerollNode.ToString()); } if (Explode != null) { sb.Append(Explode.ToString()); } if (Success != null) { sb.Append(Success.ToString()); } foreach (var k in Keep) { sb.Append(k.ToString()); } if (Critical != null) { sb.Append(Critical.ToString()); } if (Sort != null) { sb.Append(Sort.ToString()); } foreach (var f in Functions) { sb.Append(f.ToString()); } sb.Append(">>"); return(sb.ToString()); }