public int ParseText(string pszCode, enum_PARSEFLAGS dwFlags, uint nRadix, out IDebugExpression2 ppExpr,
                             out string pbstrError, out uint pichError)
        {
            pbstrError = "";
            pichError  = 0;
            ppExpr     = null;
            ILProperty prop;

            if (propertyMapping.TryGetValue(pszCode, out prop))
            {
                ppExpr = new AD7Expression(prop);
                return(Constants.S_OK);
            }

            /*string lookup = pszCode;
             *
             *
             * LocalVariable result = ThreadContext.GetVisibleVariableByName(lookup);
             * if (result != null)
             * {
             *  ppExpr = new AD7Expression(new MonoProperty(ThreadContext, result));
             *  return VSConstants.S_OK;
             * }
             */
            pbstrError = "Unsupported Expression";
            pichError  = (uint)pbstrError.Length;
            return(Constants.S_FALSE);
        }
Exemple #2
0
        public int ParseText(string pszCode, enum_PARSEFLAGS dwFlags, uint nRadix, out IDebugExpression2 ppExpr,
                             out string pbstrError, out uint pichError)
        {
            pbstrError = "";
            pichError  = 0;
            ppExpr     = null;

            Parser         parser = new Parser(pszCode);
            EvalExpression exp    = null;

            try
            {
                exp = parser.Parse();
            }
            catch (Exception ex)
            {
                pbstrError = ex.Message;
                pichError  = (uint)pbstrError.Length;
                return(Constants.S_FALSE);
            }
            ppExpr = new AD7Expression(this, exp, pszCode);
            return(Constants.S_OK);

            /*string[] names = pszCode.Split('.');
             * ILProperty root = null;
             * if(!propertyMapping.TryGetValue(names[0], out root))
             * {
             *  if (!propertyMapping.TryGetValue("this", out root))
             *  {
             *      pbstrError = "Unsupported Expression";
             *      pichError = (uint)pbstrError.Length;
             *      return Constants.S_FALSE;
             *  }
             * }
             *
             * if (names.Length < 2)
             * {
             *  ppExpr = new AD7Expression(root);
             *  return Constants.S_OK;
             * }
             * else
             * {
             *  ppExpr = new AD7Expression(Engine, Thread, root, names);
             *  return Constants.S_OK;
             * }*/
            /*string lookup = pszCode;
             *
             *
             * LocalVariable result = ThreadContext.GetVisibleVariableByName(lookup);
             * if (result != null)
             * {
             *  ppExpr = new AD7Expression(new MonoProperty(ThreadContext, result));
             *  return VSConstants.S_OK;
             * }
             */
        }
Exemple #3
0
        public int ParseText(string pszCode, enum_PARSEFLAGS dwFlags, uint nRadix, out IDebugExpression2 ppExpr,
                             out string pbstrError, out uint pichError)
        {
            pbstrError = "";
            pichError  = 0;
            ppExpr     = null;
            string[]   names = pszCode.Split('.');
            ILProperty root  = null;

            if (!propertyMapping.TryGetValue(names[0], out root))
            {
                if (!propertyMapping.TryGetValue("this", out root))
                {
                    pbstrError = "Unsupported Expression";
                    pichError  = (uint)pbstrError.Length;
                    return(Constants.S_FALSE);
                }
            }

            if (names.Length < 2)
            {
                ppExpr = new AD7Expression(root);
                return(Constants.S_OK);
            }
            else
            {
                ppExpr = new AD7Expression(Engine, root, names);
                return(Constants.S_OK);
            }

            /*string lookup = pszCode;
             *
             *
             * LocalVariable result = ThreadContext.GetVisibleVariableByName(lookup);
             * if (result != null)
             * {
             *  ppExpr = new AD7Expression(new MonoProperty(ThreadContext, result));
             *  return VSConstants.S_OK;
             * }
             */
        }