public override Result VisitExpr_unary([NotNull] STGrammerParser.Expr_unaryContext context) { string str = Visit(context.expr()).Info as string; switch (context.op.Type) { case STGrammerParser.PLUS: return(new Result(true, "+" + str)); case STGrammerParser.MINUS: return(new Result(true, "-" + str)); default: return(DefaultResult); } }
/// <summary> /// Visit a parse tree produced by the <c>expr_unary</c> /// labeled alternative in <see cref="STGrammerParser.expr"/>. /// <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 VisitExpr_unary([NotNull] STGrammerParser.Expr_unaryContext context) { return(VisitChildren(context)); }