}
+Literal::Literal(const string &typeName, const vector<string> &ids)
+: props(0)
+, typeName(typeName)
+, identifiers(ids)
+, i1(0), i2(0)
+, i3(0), i4(0)
+, b(false)
+, type(ARRAY_IDENTS) {
+
+}
+
Literal::Literal(bool b)
: props(0)
, typeName("Boolean")
}
}
+const vector<string> &Literal::GetIdentifiers() const {
+ if (type == ARRAY_IDENTS) {
+ return identifiers;
+ } else {
+ throw runtime_error("tried to access identifiers of non-array literal");
+ }
+}
+
bool Literal::GetBoolean() const {
if (type == BOOLEAN) {
return b;
namespace std {
ostream &operator <<(ostream &out, const loader::ParsedSource &source) {
- out << "parsed source file" << endl;
+ out << "parsed sources" << endl;
+ out << "==============" << endl;
out << "declared objects: " << endl;
for (map<string, loader::Declaration *>::const_iterator i(source.Declarations().begin()), end(source.Declarations().end()); i != end; ++i) {
out << " - " << i->first << " of type " << i->second->TypeName() << endl;
for (set<string>::const_iterator i(source.Exports().begin()), end(source.Exports().end()); i != end; ++i) {
out << " - " << *i << endl;
}
+ out << endl;
return out;
}
case loader::Literal::ARRAY_PROPS:
out << "array of property lists";
break;
+ case loader::Literal::ARRAY_IDENTS:
+ out << "array of identifiers";
+ break;
case loader::Literal::BOOLEAN:
out << "boolean, " << (l.GetBoolean() ? "true" : "false");
break;