/// <summary>
        /// Gets value as string with resolution.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <returns></returns>
        public string ToString(EvaluationContext context)
        {
            switch (TokenType)
            {
            case ExpressionTokenType.Field:
                if (context == null)
                {
                    throw new ArgumentNullException("context");
                }
                return(context.GetFieldValue(Value).ToString() ?? "");

            default:
                return(Value ?? "");
            }
        }
        /// <summary>
        /// Converts to the decimal value.
        /// </summary>
        /// <returns></returns>
        /// <exception cref="System.NotSupportedException"></exception>
        /// <exception cref="FormatException"></exception>
        public decimal ToDecimal(EvaluationContext context)
        {
            switch (TokenType)
            {
            case ExpressionTokenType.Value:
            case ExpressionTokenType.SingleQuoted:
            case ExpressionTokenType.DoubleQuoted:
                return(decimal.Parse(Value, NumberParseStyle, CultureInfo.CurrentCulture));

            case ExpressionTokenType.Field:
                if (context == null)
                {
                    throw new ArgumentNullException("context");
                }
                return(decimal.Parse(context.GetFieldValue(Value).ToString(), CultureInfo.CurrentCulture));

            default:
                throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, "Cannot convert {0}({1}) to a numeric value.", TokenType, Value));
            }
        }
 /// <summary>
 /// Converts to the decimal value.
 /// </summary>
 /// <returns></returns>
 /// <exception cref="System.NotSupportedException"></exception>
 /// <exception cref="FormatException"></exception>
 public decimal ToDecimal(EvaluationContext context)
 {
     switch (TokenType)
     {
         case ExpressionTokenType.Value:
         case ExpressionTokenType.SingleQuoted:
         case ExpressionTokenType.DoubleQuoted:
             return decimal.Parse(Value, CultureInfo.CurrentCulture);
         case ExpressionTokenType.Field:
             if (context == null) { throw new ArgumentNullException("context"); }
             return decimal.Parse(context.GetFieldValue(Value).ToString(), CultureInfo.CurrentCulture);
         default:
             throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, "Cannot convert {0}({1}) to a numeric value.", TokenType, Value));
     }
 }
 /// <summary>
 /// Gets value as string with resolution.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <returns></returns>
 public string ToString(EvaluationContext context)
 {
     switch (TokenType)
     {
         case ExpressionTokenType.Field:
             if (context == null) { throw new ArgumentNullException("context"); }
             return context.GetFieldValue(Value).ToString();
         default:
             return Value;
     }
 }