/// <summary>
        /// Converts a string into a ValueType
        /// </summary>
        /// <param name="value">Value to conver</param>
        /// <returns>Wrapped value</returns>
        public ValueTypeResult GetValue(string value)
        {
            var result = new ValueTypeResult();

            if (value == null)
            {
                return new ValueTypeResult
                {
                    Type = ValueType.StringLiteral,
                    Value = null
                };
            }

            if (IsWrappedInQuotes(value))
            {
                result.Type = ValueType.StringLiteral;
                //strip quotes
                result.Value = value.Substring(1, value.Length - 2);
            }
            else
            {
                //check for keywords
                if (KeywordHandlers.Value.ContainsKey(value))
                {
                    result = KeywordHandlers.Value[value](value);
                }
                else
                {
                    result.Type = ValueType.Property;
                    result.Value = value;
                }
            }

            return result;
        }
Exemple #2
0
        /// <summary>
        /// Converts a string into a ValueType
        /// </summary>
        /// <param name="value">Value to conver</param>
        /// <returns>Wrapped value</returns>
        public ValueTypeResult GetValue(string value)
        {
            var result = new ValueTypeResult();

            if (value == null)
            {
                return(new ValueTypeResult
                {
                    Type = ValueType.StringLiteral,
                    Value = null
                });
            }

            if (IsWrappedInQuotes(value))
            {
                result.Type = ValueType.StringLiteral;
                //strip quotes
                result.Value = value.Substring(1, value.Length - 2);
            }
            else
            {
                //check for keywords
                if (KeywordHandlers.Value.ContainsKey(value))
                {
                    result = KeywordHandlers.Value[value](value);
                }
                else
                {
                    result.Type  = ValueType.Property;
                    result.Value = value;
                }
            }

            return(result);
        }