+const Color &Interpreter::GetColor(const std::string &name) const {
+ map<string, ParsedDefinition>::const_iterator i(parsedDefinitions.find(name));
+ if (i != parsedDefinitions.end()) {
+ if (i->second.type == COLOR) {
+ return colors[i->second.index];
+ } else {
+ throw Error("cannot cast " + i->second.dfn->TypeName() + " to Color");
+ }
+ } else {
+ throw Error("access to undefined Color " + name);
+ }
+}
+