public override object VisitCon_diff([NotNull] StringGrammarParser.Con_diffContext context) { string result = "..."; string left = Visit(context.expression(0)).ToString(); string right = Visit(context.expression(1)).ToString(); switch (context.op.Type) { case CONCANTENATE: result = left + right; break; case DIFFERENCE: result = diff(left, right); break; } return(result); }
/// <summary> /// Exit a parse tree produced by the <c>con_diff</c> /// labeled alternative in <see cref="StringGrammarParser.expression"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitCon_diff([NotNull] StringGrammarParser.Con_diffContext context) { }
/// <summary> /// Visit a parse tree produced by the <c>con_diff</c> /// labeled alternative in <see cref="StringGrammarParser.expression"/>. /// <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 VisitCon_diff([NotNull] StringGrammarParser.Con_diffContext context) { return(VisitChildren(context)); }