// Parses a text-based expression for evaluation. // The engine sample only supports locals and parameters so the only task here is to check the names in those collections. int IDebugExpressionContext2.ParseText(string pszCode, enum_PARSEFLAGS dwFlags, uint nRadix, out IDebugExpression2 ppExpr, out string pbstrError, out uint pichError) { // pbstrError = ""; // pichError = 0; // ppExpr = null; // return VSConstants.E_NOTIMPL; pbstrError = ""; pichError = 0; ppExpr = null; // Parse here, if needed: verify if it is a valid expression, and store the parsed results into VariableInfo, or create another object. // if not: send a GDB command to evaluate the expression pszCode. It should return the result or an error message. // This object is indirectly sent to IDebugExpression2.EvaluateAsync // if pszCode is a variable, it must be found in Locals. // VariableInfo vi = new VariableInfo(pszCode,"",""); ppExpr = new AD7Expression(pszCode, this, m_engine.eDispatcher); return VSConstants.S_OK; }
/// <summary> /// Parses a text-based expression for evaluation. (http://msdn.microsoft.com/en-ca/library/bb162304.aspx). /// GDB will parse and evaluate the expression, returning the result or an error in the expression. So, the only task for this /// method is to create the IDebugExpression2 object that will be sent indirectly to the methods responsible for the evaluation. /// </summary> /// <param name="pszCode"> The expression to be parsed. </param> /// <param name="dwFlags"> A combination of flags from the PARSEFLAGS enumeration that controls parsing. </param> /// <param name="nRadix"> The radix to be used in parsing any numerical information in pszCode. </param> /// <param name="ppExpr"> Returns the IDebugExpression2 object that represents the parsed expression, which is ready for /// binding and evaluation. </param> /// <param name="pbstrError"> Returns the error message if the expression contains an error. </param> /// <param name="pichError"> Returns the character index of the error in pszCode if the expression contains an error. </param> /// <returns> VSConstants.S_OK. </returns> int IDebugExpressionContext2.ParseText(string pszCode, enum_PARSEFLAGS dwFlags, uint nRadix, out IDebugExpression2 ppExpr, out string pbstrError, out uint pichError) { pbstrError = ""; pichError = 0; ppExpr = null; ppExpr = new AD7Expression(pszCode, this, m_engine.eDispatcher); return VSConstants.S_OK; }