,
This commit is contained in:
		@@ -9,8 +9,8 @@
 | 
				
			|||||||
namespace Dawn {
 | 
					namespace Dawn {
 | 
				
			||||||
  class FPSLabelComponent : public SceneItemComponent {
 | 
					  class FPSLabelComponent : public SceneItemComponent {
 | 
				
			||||||
    public:
 | 
					    public:
 | 
				
			||||||
      // @optional
 | 
					      /* @optional */
 | 
				
			||||||
      UILabel *label;
 | 
					      UILabel *label = nullptr;
 | 
				
			||||||
      
 | 
					      
 | 
				
			||||||
      FPSLabelComponent(SceneItem *item);
 | 
					      FPSLabelComponent(SceneItem *item);
 | 
				
			||||||
      void onStart() override;
 | 
					      void onStart() override;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -38,7 +38,7 @@ struct PrefabComponentParserRuleset PrefabRegistry::getRuleset(std::string type)
 | 
				
			|||||||
            auto includePath = file.filename.substr(toRemove.size(), file.filename.size() - toRemove.size());
 | 
					            auto includePath = file.filename.substr(toRemove.size(), file.filename.size() - toRemove.size());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Now locate the first subdir since we don't want to include the root path (e.g. dawn, dawnrose, etc)
 | 
					            // Now locate the first subdir since we don't want to include the root path (e.g. dawn, dawnrose, etc)
 | 
				
			||||||
            auto firstSlash = includePath.find("/");
 | 
					            auto firstSlash = includePath.find(FILE_PATH_SEP);
 | 
				
			||||||
            if(firstSlash != std::string::npos) {
 | 
					            if(firstSlash != std::string::npos) {
 | 
				
			||||||
              includePath = includePath.substr(firstSlash + 1, includePath.size() - firstSlash - 1);
 | 
					              includePath = includePath.substr(firstSlash + 1, includePath.size() - firstSlash - 1);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -65,12 +65,11 @@ struct PrefabComponentParserRuleset PrefabRegistry::getRuleset(std::string type)
 | 
				
			|||||||
              auto nextLineStart = data.rfind('\n', match.position() + match.length()) + 1;
 | 
					              auto nextLineStart = data.rfind('\n', match.position() + match.length()) + 1;
 | 
				
			||||||
              auto nextLineEnd = data.find('\n', nextLineStart);
 | 
					              auto nextLineEnd = data.find('\n', nextLineStart);
 | 
				
			||||||
              auto nextLine = data.substr(nextLineStart, nextLineEnd - nextLineStart);
 | 
					              auto nextLine = data.substr(nextLineStart, nextLineEnd - nextLineStart);
 | 
				
			||||||
 | 
					              // ^\s*((?:struct[\s]+|enum[\s]+)?[^\s]+)\s+([^\s;=]+)(?:.*?);$
 | 
				
			||||||
              std::regex regex2("^\\s*([^\\s]+)\\s+([^\\s;]+)\\s*;", std::regex_constants::ECMAScript);
 | 
					              std::regex regex2("(?:struct\\s+|enum\\s+)?(\\w+(?:::\\w+)*(?:\\s*\\*\\s*)?)\\s*(\\*?)\\s*(\\w+)\\s*(?:=\\s*(?:[^;{]+|\\{[^{}]*\\})|(?=;))?", std::regex_constants::ECMAScript);
 | 
				
			||||||
              std::sregex_iterator it2(nextLine.begin(), nextLine.end(), regex2);
 | 
					              std::sregex_iterator it2(nextLine.begin(), nextLine.end(), regex2);
 | 
				
			||||||
              std::sregex_iterator end2;
 | 
					              std::sregex_iterator end2;
 | 
				
			||||||
              while(it2 != end2) {
 | 
					              while(it2 != end2) {
 | 
				
			||||||
                // Log out all matches
 | 
					 | 
				
			||||||
                std::smatch match2 = *it2;
 | 
					                std::smatch match2 = *it2;
 | 
				
			||||||
                std::string type = match2[1].str();
 | 
					                std::string type = match2[1].str();
 | 
				
			||||||
                std::string name = match2[2].str();
 | 
					                std::string name = match2[2].str();
 | 
				
			||||||
@@ -253,6 +252,7 @@ int32_t PrefabComponentParser::onParse(
 | 
				
			|||||||
    return v;
 | 
					    return v;
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  auto colorParser = rawParser;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Iterate all the optional attributes and store within the out if present
 | 
					  // Iterate all the optional attributes and store within the out if present
 | 
				
			||||||
  auto itOptional = ruleset.optional.begin();
 | 
					  auto itOptional = ruleset.optional.begin();
 | 
				
			||||||
@@ -265,6 +265,8 @@ int32_t PrefabComponentParser::onParse(
 | 
				
			|||||||
      parser = stringParser;
 | 
					      parser = stringParser;
 | 
				
			||||||
    } else if(type.find("float") != std::string::npos) {
 | 
					    } else if(type.find("float") != std::string::npos) {
 | 
				
			||||||
      parser = floatParser;
 | 
					      parser = floatParser;
 | 
				
			||||||
 | 
					    } else if(type.find("Color") != std::string::npos) {
 | 
				
			||||||
 | 
					      parser = colorParser;
 | 
				
			||||||
    } else if(type.find("*") == (type.size() - 1)) {
 | 
					    } else if(type.find("*") == (type.size() - 1)) {
 | 
				
			||||||
      type = type.substr(0, type.size() - 1);
 | 
					      type = type.substr(0, type.size() - 1);
 | 
				
			||||||
      parser = rawParser;
 | 
					      parser = rawParser;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user