}
+const Interpreter::ParsedDefinition &Interpreter::GetDefinition(const string &identifier) const {
+ try {
+ return parsedDefinitions.at(identifier);
+ } catch (...) {
+ throw std::runtime_error("cannot find definition for " + identifier);
+ }
+}
+
+
void *Interpreter::GetObject(int typeId, const std::string &name) {
map<string, ParsedDefinition>::const_iterator i(parsedDefinitions.find(name));
if (i != parsedDefinitions.end()) {
};
public:
- Interpreter(const ParsedSource &source) : source(source) { }
+ explicit Interpreter(const ParsedSource &source) : source(source) { }
~Interpreter();
private:
Interpreter(const Interpreter &);
};
const std::set<std::string> &ExportedIdentifiers() const { return source.Exports(); }
- const ParsedDefinition &GetDefinition(const std::string &identifier) const { return parsedDefinitions.at(identifier); }
+ const ParsedDefinition &GetDefinition(const std::string &identifier) const;
const std::map<std::string, SDL_Surface *> &Images() const { return imageCache; }
const std::vector<PostponedDefinition> &PostponedDefinitions() const { return postponedDefinitions; }
const std::map<int, std::vector<void *> > &Values() const { return values; }