public override StatementNode VisitCaseStatement([NotNull] CoronaParser.CaseStatementContext context) { BuildValueAst valueVisitor = new BuildValueAst(); CoronaParser.CaseValueContext[] caseValues = context.caseValue(); // Extract all caseValues List <ValueNode> values = new List <ValueNode>(); try { foreach (var value in caseValues) { values.Add(valueVisitor.Visit(value)); } } catch (TheLanguageErrorException e) { throw new TheLanguageErrorException("Case statement value", e); } return(new CaseStatementNode(values, Visit(context.statement()))); }
/// <summary> /// Visit a parse tree produced by <see cref="CoronaParser.caseStatement"/>. /// <para> /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/> /// on <paramref name="context"/>. /// </para> /// </summary> /// <param name="context">The parse tree.</param> /// <return>The visitor result.</return> public virtual Result VisitCaseStatement([NotNull] CoronaParser.CaseStatementContext context) { return(VisitChildren(context)); }
/// <summary> /// Exit a parse tree produced by <see cref="CoronaParser.caseStatement"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitCaseStatement([NotNull] CoronaParser.CaseStatementContext context) { }