public override Calc_node VisitLog_exp([NotNull] CalcParser.Log_expContext context) { // 生成 log 节点 Binary_node node = new Binary_node(); node.op = Binary_node.Operator.LOG; if (context.children[2] is CalcParser.ExpContext) { node.node1 = Visit(context.children[2]); if (context.children[4] is CalcParser.ExpContext) { node.node2 = Visit(context.children[4]); } else { node.node2 = null; } } else { node.node1 = null; if (context.exp(0) != null) { node.node2 = Visit(context.exp(0)); } else { node.node2 = null; } } //node.node1 = Visit(context.exp(0)), //node.node2 = Visit(context.exp(1)) return(node); }
/// <summary> /// Visit a parse tree produced by <see cref="CalcParser.log_exp"/>. /// <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 VisitLog_exp([NotNull] CalcParser.Log_expContext context) { return(VisitChildren(context)); }
/// <summary> /// Enter a parse tree produced by <see cref="CalcParser.log_exp"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void EnterLog_exp([NotNull] CalcParser.Log_expContext context) { }