Files
haiku-beta6/src/apps/debugger/source_language/SourceLanguage.cpp
T
Rene Gollent af76b51633 Debugger: Add basic support for types in expressions.
SourceLanguage/CLanguageFamily/ExpressionEvaluationJob:
- Add TeamTypeInformation parameter to EvaluateExpression() hook. Adjust
  implementing subclasses and callers accordingly.

CLanguageExpressionEvaluator:
- Add class InternalVariableID for representing intermediate variables
  generated while parsing an expression.
- When parsing an identifier, if we were passed in a type information object,
  then first attempt to resolve the name as a type. If not matched, then fall
  through to attempting to match it to a value node as before.
- When parsing an atom, check if it resulted in a type. If it did, and there
  still remains more of the expression to parse, then parse the result to see
  what value/variable to try to apply the typecast to. If the result is a
  primitive, generate an appropriate internal variable + value node child for
  it, otherwise use the target variable's child. Then, attempt to typecast it
  as requested.
- Simplify _EatToken().
- If the final result of an expression is a type, configure the result object
  accordingly.

As a result of all the above, an expression can now resolve to a type, allowing
the evaluator to take over the duties of parsing the desired type for a typecast
request in the variables view, and in addition, expressions themselves can now
contain typecasts, which opens up quite a few new possibilities.
2014-12-11 22:17:33 -05:00

38 lines
692 B
C++

/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2014, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#include "SourceLanguage.h"
SourceLanguage::~SourceLanguage()
{
}
SyntaxHighlighter*
SourceLanguage::GetSyntaxHighlighter() const
{
return NULL;
}
status_t
SourceLanguage::ParseTypeExpression(const BString& expression,
TeamTypeInformation* info, Type*& _resultType) const
{
return B_NOT_SUPPORTED;
}
status_t
SourceLanguage::EvaluateExpression(const BString& expression,
ValueNodeManager* manager, TeamTypeInformation* info,
ExpressionResult*& _resultValue, ValueNode*& _neededNode)
{
return B_NOT_SUPPORTED;
}