vfs: check userland buffers before reading them.
[haiku.git] / src / kits / debugger / source_language / c_family / CLanguageExpressionEvaluator.h
blobd75a2a32033a656baae8c41e4122148bbbe61f9f
1 /*
2 * Copyright 2006-2014 Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Stephan Aßmus <superstippi@gmx.de>
7 * Rene Gollent <rene@gollent.com>
8 * John Scipione <jscipione@gmail.com>
9 * Ingo Weinhold <bonefish@cs.tu-berlin.de>
11 #ifndef C_LANGUAGE_EXPRESSION_EVALUATOR_H
12 #define C_LANGUAGE_EXPRESSION_EVALUATOR_H
15 #include <String.h>
18 namespace CLanguage {
19 struct Token;
20 class Tokenizer;
23 class BVariant;
24 class TeamTypeInformation;
25 class Type;
26 class ValueNode;
27 class ValueNodeChild;
28 class ValueNodeManager;
29 class Variable;
32 class ValueNeededException {
33 public:
34 ValueNeededException(ValueNode* node)
36 value(node)
40 ValueNode* value;
44 class ExpressionResult;
45 class Number;
48 class CLanguageExpressionEvaluator {
50 public:
51 CLanguageExpressionEvaluator();
52 ~CLanguageExpressionEvaluator();
54 ExpressionResult* Evaluate(const char* expressionString,
55 ValueNodeManager* manager,
56 TeamTypeInformation* info);
58 private:
59 class InternalVariableID;
60 class Operand;
62 private:
63 Operand _ParseSum();
64 Operand _ParseProduct();
65 Operand _ParseUnary();
66 Operand _ParseIdentifier(ValueNode* parentNode = NULL);
67 Operand _ParseAtom();
69 void _EatToken(int32 type);
71 Operand _ParseType(Type* baseType);
72 // the passed in Type object
73 // is expected to be the initial
74 // base type that was recognized by
75 // e.g. ParseIdentifier. This function then
76 // takes care of handling any modifiers
77 // that go with it, and returns a
78 // corresponding final type.
80 void _RequestValueIfNeeded(
81 const CLanguage::Token& token,
82 ValueNodeChild* child);
84 void _GetNodeChildForPrimitive(
85 const CLanguage::Token& token,
86 const BVariant& value,
87 ValueNodeChild*& _output) const;
89 private:
90 CLanguage::Tokenizer* fTokenizer;
91 TeamTypeInformation* fTypeInfo;
92 ValueNodeManager* fNodeManager;
95 #endif // C_LANGUAGE_EXPRESSION_EVALUATOR_H