X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Floader%2FParsedSource.h;h=c843de1889add9c37d22247ced22477533c37af1;hb=06db9f596cd1c5aa4c0832b387882f7c74c1b4c0;hp=9ba52972a4b5bcf797fc32fc62d80db9f183553e;hpb=3a30342daecdb9ee050ab20fcb50819a599d6343;p=l2e.git diff --git a/src/loader/ParsedSource.h b/src/loader/ParsedSource.h index 9ba5297..c843de1 100644 --- a/src/loader/ParsedSource.h +++ b/src/loader/ParsedSource.h @@ -1,10 +1,3 @@ -/* - * ParsedSource.h - * - * Created on: Aug 26, 2012 - * Author: holy - */ - #ifndef LOADER_PARSEDSOURCE_H_ #define LOADER_PARSEDSOURCE_H_ @@ -26,6 +19,7 @@ public: REGISTER, IDENTIFIER, LITERAL, + LABEL, }; ScriptToken(const std::string &, Type); @@ -39,7 +33,8 @@ public: Type GetType() const { return type; } const std::string &RegisterName() const; const std::string &CommandName() const; - const std::string &GetIdentifier() const; + const std::string &Identifier() const; + const std::string &Label() const; const Literal *GetLiteral() const; private: @@ -56,6 +51,7 @@ public: enum Type { ARRAY_VALUES, ARRAY_PROPS, + ARRAY_IDENTS, BOOLEAN, COLOR, NUMBER, @@ -67,15 +63,27 @@ public: }; public: + /// array of values explicit Literal(const std::vector &); + /// array of objects Literal(const std::string &, const std::vector &); + /// array of identifiers + Literal(const std::string &, const std::vector &); + /// boolean explicit Literal(bool); + /// color Literal(int r, int g, int b, int a = 255); + /// number explicit Literal(int number); + /// path string Literal(const std::string &dir, const std::string &path); + /// string Literal(const std::string &); + /// vector Literal(int x, int y); + /// object Literal(const std::string &typeName, PropertyList *properties); + /// script explicit Literal(const std::vector &); ~Literal(); private: @@ -84,12 +92,14 @@ private: public: Type GetType() const { return type; } - bool IsArray() const { return GetType() == ARRAY_VALUES || GetType() == ARRAY_PROPS; } + bool IsArray() const { return GetType() == ARRAY_VALUES || GetType() == ARRAY_PROPS || GetType() == ARRAY_IDENTS; } bool IsObject() const { return GetType() == OBJECT; } - int ArraySize() const { return GetType() == ARRAY_VALUES ? GetValues().size() : GetPropertyLists().size(); } + int ArraySize() const { return GetType() == ARRAY_VALUES ? GetValues().size() + : (GetType() == ARRAY_PROPS ? GetPropertyLists().size() : GetIdentifiers().size()); } const std::vector &GetValues() const; const std::vector &GetPropertyLists() const; + const std::vector &GetIdentifiers() const; bool GetBoolean() const; int GetRed() const; int GetGreen() const; @@ -108,6 +118,7 @@ private: std::string typeName, str; std::vector values; std::vector propertyLists; + std::vector identifiers; std::vector script; int i1, i2, i3, i4; bool b;