public ParseTreeValue(TypeTokenPair valuePair) { _typeTokenPair = valuePair; ParsesToConstantValue = false; _exceedsValueTypeRange = null; _hashCode = valuePair.Token.GetHashCode(); _dateValue = null; _stringConstant = null; IsMismatchExpression = false; if (valuePair.ValueType.Equals(Tokens.Date)) { ParsesToConstantValue = LetCoerce.TryCoerce(_typeTokenPair.Token, out _dateValue); } else if (valuePair.ValueType.Equals(Tokens.String) && IsStringConstant(valuePair.Token)) { _stringConstant = new StringLiteralExpression(new ConstantExpression(new StringValue(_typeTokenPair.Token))); ParsesToConstantValue = true; } else if (valuePair.ValueType.Equals(Tokens.String) && TryGetNonPrintingControlCharCompareToken(valuePair.Token, out _)) { ParsesToConstantValue = true; } }
private static bool TryParseAsDateLiteral(string valueString, out ComparableDateValue value) { value = default; if (IsDateLiteral(valueString)) { return(LetCoerce.TryCoerce(valueString, out value)); } return(false); }