2 * Copyright 2013-2014, Rene Gollent, rene@gollent.com.
3 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
4 * Distributed under the terms of the MIT License.
7 #include "CLanguageFamily.h"
13 #include "CLanguageExpressionEvaluator.h"
14 #include "CLanguageFamilySyntaxHighlighter.h"
15 #include "CLanguageTokenizer.h"
16 #include "ExpressionInfo.h"
17 #include "TeamTypeInformation.h"
18 #include "StringValue.h"
20 #include "TypeLookupConstraints.h"
23 using CLanguage::ParseException
;
26 CLanguageFamily::CLanguageFamily()
31 CLanguageFamily::~CLanguageFamily()
37 CLanguageFamily::GetSyntaxHighlighter() const
39 return new(std::nothrow
) CLanguageFamilySyntaxHighlighter();
44 CLanguageFamily::EvaluateExpression(const BString
& expression
,
45 ValueNodeManager
* manager
, TeamTypeInformation
* info
,
46 ExpressionResult
*& _output
, ValueNode
*& _neededNode
)
50 CLanguageExpressionEvaluator evaluator
;
52 _output
= evaluator
.Evaluate(expression
, manager
, info
);
54 } catch (ParseException ex
) {
56 error
.SetToFormat("Parse error at position %" B_PRId32
": %s",
57 ex
.position
, ex
.message
.String());
58 StringValue
* value
= new(std::nothrow
) StringValue(error
.String());
61 BReference
<Value
> valueReference(value
, true);
62 _output
= new(std::nothrow
) ExpressionResult();
65 _output
->SetToPrimitive(value
);
67 } catch (ValueNeededException ex
) {
68 _neededNode
= ex
.value
;