public override Object VisitPair([NotNull] KernelParser.PairContext context) { if (context.dot != null) { Object[] expressions = context.expression().Select(VisitExpression).ToArray(); Pair start, pair; start = pair = new Pair(expressions[0]); for (int i = 1; i < expressions.Length - 1; i++) { pair = pair.Append(expressions[i]); } pair.Cdr = expressions[expressions.Length - 1]; return(start); } return(new Pair(context.expression().Select(VisitExpression))); }
/// <summary> /// Exit a parse tree produced by <see cref="KernelParser.pair"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitPair([NotNull] KernelParser.PairContext context) { }
/// <summary> /// Visit a parse tree produced by <see cref="KernelParser.pair"/>. /// <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 VisitPair([NotNull] KernelParser.PairContext context) { return(VisitChildren(context)); }