public void Visit(FunctionExpression expression)
 {
     throw new NotImplementedException();
 }
 public void Visit(FunctionExpression expression)
 {
     throw new NotImplementedException();
 }
        /// <summary>
        /// Visit a function expression
        /// </summary>
        /// <param name="expression">The expression</param>
        /// <exception cref="ArgumentNullException">Thrown when the input parameter is null</exception>
        public void Visit(FunctionExpression expression)
        {
            if (expression == null)
            {
                throw new ArgumentNullException("expression");
            }

            expression.Expression.Accept(this);
            object param = result;

            if (expression.FunctionName == "sizeof")
            {
                string customTypeName;
                int    symbolValue;
                if (param is string)
                {
                    if ((context.TryResolveCustomType((string)param, out customTypeName) &&
                         !DatatypeInfoProvider.IsPredefinedDatatype(customTypeName)) ||
                        param.ToString().StartsWith("enum", StringComparison.OrdinalIgnoreCase) ||
                        param.ToString().StartsWith("struct", StringComparison.OrdinalIgnoreCase) ||
                        param.ToString().StartsWith("union", StringComparison.OrdinalIgnoreCase))
                    {
                        result = "sizeof(" + param.ToString() + ")";
                    }
                    else
                    {
                        result = DatatypeInfoProvider.GetRpcDatatypeLength((string)param);
                    }
                }
                else if (context.TryResolveSymbol(expression.Text, out symbolValue))
                {
                    Type   value    = param.GetType();
                    string typeName = String.Empty;
                    switch (value.ToString())
                    {
                    case "System.Char":
                        typeName = "char";
                        break;

                    case "System.Byte":
                        typeName = "byte";
                        break;

                    case "System.Int16":
                        typeName = "short";
                        break;

                    case "System.Int32":
                        typeName = "int";
                        break;

                    case "System.Boolean":
                        typeName = "boolean";
                        break;

                    default:
                        break;
                    }

                    result = DatatypeInfoProvider.GetRpcDatatypeLength(typeName);
                }
                if (result is int &&
                    (int)result <= 0)
                {
                    throw new ExpressionEvaluatorException(
                              string.Format(CultureInfo.InvariantCulture, "cannot get the datatype length for the datatype '{0}'", param));
                }
            }
        }
        /// <summary>
        /// Visit a function expression
        /// </summary>
        /// <param name="expression">The expression</param>
        /// <exception cref="ArgumentNullException">Thrown when the input parameter is null</exception>        
        public void Visit(FunctionExpression expression)
        {
            if (expression == null)
            {
                throw new ArgumentNullException("expression");
            }

            expression.Expression.Accept(this);
            object param = result;
            if (expression.FunctionName == "sizeof")
            {
                string customTypeName;
                int symbolValue;
                if (param is string)
                {
                    if ((context.TryResolveCustomType((string)param, out customTypeName)
                        && !DatatypeInfoProvider.IsPredefinedDatatype(customTypeName))
                        || param.ToString().StartsWith("enum", StringComparison.OrdinalIgnoreCase)
                        || param.ToString().StartsWith("struct", StringComparison.OrdinalIgnoreCase)
                        || param.ToString().StartsWith("union", StringComparison.OrdinalIgnoreCase))
                    {
                        result = "sizeof(" + param.ToString() + ")";
                    }
                    else
                    {
                        result = DatatypeInfoProvider.GetRpcDatatypeLength((string)param);
                    }
                }
                else if (context.TryResolveSymbol(expression.Text, out symbolValue))
                {
                    Type value = param.GetType();
                    string typeName = String.Empty;
                    switch (value.ToString())
                    {
                        case "System.Char":
                            typeName = "char";
                            break;
                        case "System.Byte":
                            typeName = "byte";
                            break;
                        case "System.Int16":
                            typeName = "short";
                            break;
                        case "System.Int32":
                            typeName = "int";
                            break;
                        case "System.Boolean":
                            typeName = "boolean";
                            break;
                        default:
                            break;
                    }

                    result = DatatypeInfoProvider.GetRpcDatatypeLength(typeName);
                }
                if (result is int
                    && (int)result <= 0)
                {
                    throw new ExpressionEvaluatorException(
                        string.Format(CultureInfo.InvariantCulture, "cannot get the datatype length for the datatype '{0}'", param));
                }
            }
        }