public void Visit(SteSwitchCase code) { TextComposer.AppendAtNewLine("switch ("); code.SwitchExpression.AcceptVisitor(this); TextComposer .AppendLine(")") .AppendLine("{") .IncreaseIndentation(); foreach (var item in code.CasesList) { item.AcceptVisitor(this); } if (code.DefaultCode != null) { TextComposer.AppendLineAtNewLine("default:").IncreaseIndentation(); code.DefaultCode.AcceptVisitor(this); TextComposer.AppendLineAtNewLine("break;"); } TextComposer .DecreaseIndentation() .AppendLineAtNewLine("}"); }
internal void GenerateDotCode(DotGraph graph) { switch (graph.GraphType) { case DotGraphType.StrictDirected: TextComposer.Append("strict digraph "); break; case DotGraphType.Directed: TextComposer.Append("digraph "); break; default: TextComposer.Append("graph "); break; } if (String.IsNullOrEmpty(graph.GraphName) == false) { TextComposer.Append(ToDotId(graph.GraphName)); } TextComposer.AppendLine().Append("{").IncreaseIndentation(); foreach (var statement in graph.StatementsList) { GenerateDotCode(statement); } TextComposer .DecreaseIndentation() .AppendLine() .Append("}"); }
public void Visit(SteIfElse code) { TextComposer.AppendAtNewLine("if ("); code.Condition.AcceptVisitor(this); TextComposer .AppendLine(")") .AppendLine("{") .IncreaseIndentation(); code.TrueCode.AcceptVisitor(this); TextComposer .DecreaseIndentation() .AppendLineAtNewLine("}"); if (code.ElseCode == null) { return; } TextComposer.AppendLine("else") .AppendLine("{") .IncreaseIndentation(); code.ElseCode.AcceptVisitor(this); TextComposer .DecreaseIndentation() .AppendLineAtNewLine("}"); }
public void Visit(SteDeclareMethod code) { var modifiersText = code.ModifiersList.Concatenate(" "); TextComposer .Append(modifiersText) .Append(code.ReturnType) .Append(code.MethodName) .Append("("); foreach (var item in code.Parameters) { item.AcceptVisitor(this); } TextComposer .AppendLine(")") .Append("{") .IncreaseIndentation(); code.MethodCode.AcceptVisitor(this); TextComposer .DecreaseIndentation() .AppendAtNewLine("}"); }
internal void GenerateOutermorphismFileFinishCode() { TextComposer .DecreaseIndentation() .AppendLineAtNewLine("}") .DecreaseIndentation() .AppendLineAtNewLine("}"); }
public void Visit(SteSetNamespace code) { TextComposer .Append("namespace ") .Append(code.NamespaceName) .AppendLineAtNewLine("{") .IncreaseIndentation(); code.SubCode.AcceptVisitor(this); TextComposer .DecreaseIndentation() .AppendLineAtNewLine("}"); }
public void Visit(TccTryCatchItem code) { TextComposer.AppendLineAtNewLine("catch ("); code.CatchException.AcceptVisitor(this); TextComposer .AppendLine(")") .AppendLine("{") .IncreaseIndentation(); code.CatchCode.AcceptVisitor(this); TextComposer .DecreaseIndentation() .AppendLineAtNewLine("}"); }
public void Visit(TccSwitchCaseItem code) { TextComposer.AppendAtNewLine("case "); code.CaseValue.AcceptVisitor(this); TextComposer.AppendLine(":").IncreaseIndentation(); code.CaseCode.AcceptVisitor(this); if (code.BreakCase) { TextComposer.AppendLineAtNewLine("break;"); } TextComposer.DecreaseIndentation(); }
public void Visit(SteIf code) { TextComposer.AppendAtNewLine("if ("); code.Condition.AcceptVisitor(this); TextComposer .AppendLine(")") .AppendLine("{") .IncreaseIndentation(); code.TrueCode.AcceptVisitor(this); TextComposer .DecreaseIndentation() .AppendLineAtNewLine("}"); }
public void Visit(SteIfElseIfElse code) { var flag = false; foreach (var item in code.IfList) { if (flag == false) { TextComposer.AppendAtNewLine("if ("); flag = true; } else { TextComposer.AppendAtNewLine("else if ("); } item.Condition.AcceptVisitor(this); TextComposer .AppendLine(")") .AppendLine("{") .IncreaseIndentation(); item.TrueCode.AcceptVisitor(this); TextComposer .DecreaseIndentation() .AppendLineAtNewLine("}"); } if (code.ElseCode == null) { return; } TextComposer.AppendLine("else") .AppendLine("{") .IncreaseIndentation(); code.ElseCode.AcceptVisitor(this); TextComposer .DecreaseIndentation() .AppendLineAtNewLine("}"); }
public void Visit(SteTryCatch code) { TextComposer .AppendLineAtNewLine("try") .AppendLine("{") .IncreaseIndentation(); code.TryCode.AcceptVisitor(this); TextComposer .DecreaseIndentation() .AppendLineAtNewLine("}"); if (code.CatchItems.Count == 0) { TextComposer .AppendLineAtNewLine("catch") .AppendLine("{") .AppendLine("}"); } else { foreach (var item in code.CatchItems) { item.AcceptVisitor(this); } } if (code.FinallyCode != null) { TextComposer .AppendLineAtNewLine("finally") .AppendLine("{") .IncreaseIndentation(); code.FinallyCode.AcceptVisitor(this); TextComposer .DecreaseIndentation() .AppendLineAtNewLine("}"); } }
public void Visit(SteForLoop code) { TextComposer.AppendAtNewLine("for ("); code.LoopInitialization.AcceptVisitor(this); TextComposer.Append("; "); code.LoopCondition.AcceptVisitor(this); TextComposer.Append("; "); code.LoopUpdate.AcceptVisitor(this); TextComposer.AppendLine(")").Append("{").IncreaseIndentation(); code.LoopCode.AcceptVisitor(this); TextComposer.DecreaseIndentation().AppendLineAtNewLine("}"); }
public void Visit(SteForEachLoop code) { TextComposer .AppendAtNewLine("foreach (") .Append(code.LoopVariableType) .Append(code.LoopVariableName) .Append(" in "); code.LoopCollection.AcceptVisitor(this); TextComposer .AppendLine(")") .Append("{") .IncreaseIndentation(); code.LoopCode.AcceptVisitor(this); TextComposer .DecreaseIndentation() .AppendLineAtNewLine("}"); }
internal void GenerateDotCode(DotFixedCode fixedCode) { if (fixedCode.CodeType == DotFixedCodeType.MultiLineComment) { TextComposer.AppendAtNewLine(@"/*"); TextComposer.AppendAtNewLine(fixedCode.Code); TextComposer.AppendAtNewLine(@"*/"); return; } if (fixedCode.CodeType == DotFixedCodeType.SingleLineComment) { TextComposer.IncreaseIndentation("// "); TextComposer.AppendAtNewLine(fixedCode.Code); TextComposer.DecreaseIndentation(); return; } TextComposer.AppendAtNewLine(fixedCode.Code); }
public void Visit(SteWhileLoop code) { if (code.DoLoop) { TextComposer .AppendAtNewLine("do") .AppendLine("{") .IncreaseIndentation(); code.LoopCode.AcceptVisitor(this); TextComposer .DecreaseIndentation() .AppendAtNewLine("} while ("); code.LoopCondition.AcceptVisitor(this); TextComposer.AppendNewLine(");"); return; } TextComposer.AppendAtNewLine("while ("); code.LoopCondition.AcceptVisitor(this); TextComposer .AppendLine(")") .AppendLine("{") .IncreaseIndentation(); code.LoopCode.AcceptVisitor(this); TextComposer .DecreaseIndentation() .AppendLineAtNewLine("}"); }
internal void GenerateDotCode(DotSubGraph graph) { if (String.IsNullOrEmpty(graph.SubGraphName) == false) { TextComposer .Append("subgraph ") .Append(ToDotId(graph.SubGraphName)); } TextComposer .AppendLine() .Append("{") .IncreaseIndentation(); foreach (var statement in graph.StatementsList) { GenerateDotCode(statement); } TextComposer .DecreaseIndentation() .AppendLine() .Append("}"); }