public override SqlObject VisitBinary_scalar_expression([NotNull] sqlParser.Binary_scalar_expressionContext context) { Contract.Requires(context != null); SqlObject sqlObject; if (context.unary_scalar_expression() != null) { sqlObject = (SqlScalarExpression)this.Visit(context.unary_scalar_expression()); } else { // scalar_expression binary_operator scalar_expression Contract.Requires(context.ChildCount == 3); SqlScalarExpression left = (SqlScalarExpression)this.Visit(context.binary_scalar_expression(0)); if (!CstToAstVisitor.binaryOperatorKindLookup.TryGetValue( context.children[1].GetText(), out SqlBinaryScalarOperatorKind operatorKind)) { throw new ArgumentOutOfRangeException($"Unknown binary operator: {context.children[1].GetText()}."); } SqlScalarExpression right = (SqlScalarExpression)this.Visit(context.binary_scalar_expression(1)); sqlObject = SqlBinaryScalarExpression.Create(operatorKind, left, right); } return(sqlObject); }
/// <summary> /// Visit a parse tree produced by <see cref="sqlParser.binary_scalar_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 VisitBinary_scalar_expression([NotNull] sqlParser.Binary_scalar_expressionContext context) { return(VisitChildren(context)); }
/// <summary> /// Exit a parse tree produced by <see cref="sqlParser.binary_scalar_expression"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitBinary_scalar_expression([NotNull] sqlParser.Binary_scalar_expressionContext context) { }