/// <summary> /// Visit a parse tree produced by <see cref="Sql92WhereClauseParser.literal_value"/>. /// <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 override IFilterExpression VisitLiteral_value(Sql92WhereClauseParser.Literal_valueContext context) { IComparable constValue = null; Sql92WhereClauseParser.StringLiteralContext c = context.stringLiteral(); if (c != null) { constValue = c.body.GetText(); } else if (context.SIGNED_NUMBER() != null) { string textValue = context.GetText(); bool isFloatingPoint = textValue.Contains(".") || textValue.IndexOf("E", StringComparison.CurrentCultureIgnoreCase) > -1; // ternary operator actually doesn't work here. if (isFloatingPoint) { constValue = double.Parse(textValue); } else { constValue = long.Parse(textValue); } } return(new ConstantExpression(constValue)); }
/// <summary> /// Visit a parse tree produced by <see cref="Sql92WhereClauseParser.stringLiteral"/>. /// <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 override IFilterExpression VisitStringLiteral(Sql92WhereClauseParser.StringLiteralContext context) { return(base.VisitStringLiteral(context)); }