1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 15:29:55 +00:00
openmw/components/compiler/context.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

44 lines
1.2 KiB
C++
Raw Normal View History

2010-06-27 17:20:21 +00:00
#ifndef COMPILER_CONTEXT_H_INCLUDED
#define COMPILER_CONTEXT_H_INCLUDED
#include <string>
2010-06-27 17:20:21 +00:00
namespace Compiler
{
2010-07-03 07:54:01 +00:00
class Extensions;
2010-06-27 17:20:21 +00:00
class Context
{
2010-07-03 07:54:01 +00:00
const Extensions* mExtensions;
public:
2020-11-13 07:39:47 +00:00
Context()
: mExtensions(nullptr)
2022-09-22 18:26:05 +00:00
{
}
2020-11-13 07:39:47 +00:00
virtual ~Context() = default;
virtual bool canDeclareLocals() const = 0;
///< Is the compiler allowed to declare local variables?
void setExtensions(const Extensions* extensions = nullptr) { mExtensions = extensions; }
2020-11-13 07:39:47 +00:00
const Extensions* getExtensions() const { return mExtensions; }
virtual char getGlobalType(const std::string& name) const = 0;
///< 'l: long, 's': short, 'f': float, ' ': does not exist.
virtual std::pair<char, bool> getMemberType(const std::string& name, const std::string& id) const = 0;
///< Return type of member variable \a name in script \a id or in script of reference of
/// \a id
/// \return first: 'l: long, 's': short, 'f': float, ' ': does not exist.
/// second: true: script of reference
virtual bool isId(const std::string& name) const = 0;
///< Does \a name match an ID, that can be referenced?
2010-06-27 17:20:21 +00:00
};
}
#endif