]> git.localhorst.tv Git - l2e.git/blobdiff - src/loader/ParsedSource.cpp
added hard support for path names in source files
[l2e.git] / src / loader / ParsedSource.cpp
index 2075828e19b707b28e0afac8e77ca811da588a47..bceed089f0377f4a4678edc84414afa4d7c3084b 100644 (file)
@@ -7,6 +7,8 @@
 
 #include "ParsedSource.h"
 
+#include "utility.h"
+
 #include <ostream>
 #include <stdexcept>
 
@@ -147,6 +149,8 @@ PropertyList *Definition::GetProperties() {
 const PropertyList *Definition::GetProperties() const {
        if (!isLiteral) {
                return reinterpret_cast<PropertyList *>(value);
+       } else if (GetLiteral()->GetType() == Literal::OBJECT) {
+               return GetLiteral()->GetProperties();
        } else {
                throw runtime_error("tried to access literal value as property list");
        }
@@ -207,6 +211,16 @@ Literal::Literal(int number)
 
 }
 
+Literal::Literal(const string &dir, const string &path)
+: props(0)
+, str(CatPath(dir, path))
+, i1(0), i2(0)
+, i3(0), i4(0)
+, b(false)
+, type(STRING) {
+
+}
+
 Literal::Literal(const string &str)
 : props(0)
 , str(str)
@@ -426,6 +440,9 @@ ostream &operator <<(ostream &out, const loader::Literal &l) {
                case loader::Literal::NUMBER:
                        out << "number, " << l.GetNumber();
                        break;
+               case loader::Literal::PATH:
+                       out << "path, \"" << l.GetString() << '"';
+                       break;
                case loader::Literal::STRING:
                        out << "string, \"" << l.GetString() << '"';
                        break;