public override object VisitExpression([NotNull] TinyScriptParser.ExpressionContext context) { var a = VisitAndAndExpression(context.andAndExpression(0)); for (int i = 1; i < context.ChildCount; i += 2) { var b = (bool)VisitAndAndExpression((TinyScriptParser.AndAndExpressionContext)context.GetChild(i + 1)); a = (bool)a || b; } return(a); }
public override object VisitExpression([NotNull] TinyScriptParser.ExpressionContext context) { var ret = VisitAndAndExpression(context.andAndExpression(0)); if (context.ChildCount > 1) { for (int i = 2; i < context.ChildCount; i += 2) { VisitAndAndExpression((TinyScriptParser.AndAndExpressionContext)context.GetChild(i)); _builder.Or(); } return(typeof(bool)); } return(ret); }
/// <summary> /// Visit a parse tree produced by <see cref="TinyScriptParser.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 VisitExpression([NotNull] TinyScriptParser.ExpressionContext context) { return(VisitChildren(context)); }