public override object VisitJudgeCaseStatement([NotNull] JudgeCaseStatementContext context) { var obj = ""; var expr = (Result)Visit(context.expression()); obj += $"switch ({expr.text}) {Wrap} {{ {Wrap}"; foreach (var item in context.caseStatement()) { var r = (string)Visit(item); obj += r + Wrap; } obj += $"}} {Wrap}"; return(obj); }
public override object VisitJudgeCaseStatement(JudgeCaseStatementContext context) { var obj = ""; var expr = (Result)(Visit(context.expression())); obj += (new System.Text.StringBuilder().Append("switch (").Append(expr.text).Append(") ").Append(BlockLeft).Append(Wrap)).to_str(); foreach (var item in context.caseStatement()) { var r = (string)(Visit(item)); obj += r + Wrap; } if (context.caseElseStatement() != null) { obj += (string)(Visit(context.caseElseStatement())) + Wrap; } obj += BlockRight + Wrap; return(obj); }