void ZendParser::replaceTypesGlobal(File &file) { PreparedType typeCopy; vector<PreparedType>::iterator type = typesRegistry->begin(); string replaceFormat; char out[250]; for (; type != typesRegistry->end(); ++type) { typeCopy = *type; if (file.content.find(typeCopy.type) == string::npos || this->builtInTypes->find(typeCopy.type) != this->builtInTypes->end()) { continue; } sprintf(out, RGX_BUILTIN_TYPE, typeCopy.type.c_str()); string regexSearch(out); replaceFormat = "$1" + typeCopy.alias + "$3"; strings->regexReplace(file.content, regexSearch, replaceFormat); // strings->regexReplace(file.firstMainTypeFull, regexSearch, // replaceFormat); // strings->regexReplace(val.replace, regexSearch, replaceFormat); // // strings->regexReplace(file.content, val.raw, val.replace); // this->strings->replace(file.content, typeCopy.type, typeCopy.alias); } }
void ZendParser::replaceType(PreparedType &type, File &file) { string replaceFormat; char out[250]; // regexSearch = "([^'\"])(" + type.type + ")([^'\"])"; // replaceFormat = "$1 " + type.alias + " $3"; sprintf(out, RGX_BUILTIN_TYPE, type.type.c_str()); string regexSearch(out); replaceFormat = "$1" + type.alias + "$3"; // cout << regexSearch + "-"+ // replaceFormat + "\n"; strings->regexReplace(file.content, regexSearch, replaceFormat); // strings->regexReplace(file.content, regexSearch, replaceFormat); }
void ZendParser::replaceTypesBuiltIn(File &file) { string replaceFormat, builtInType, fileName, className; char out[250]; vector<string> tmp; this->strings->split(tmp, ".", file.name); fileName = tmp[0]; for (set<string>::iterator it = builtInTypes->begin(); it != builtInTypes->end(); ++it) { builtInType = *it; if (builtInType.empty() || file.content.find(builtInType) == string::npos) continue; this->strings->split(tmp, "_", builtInType); className = tmp[tmp.size() - 1]; // if (className.compare(builtInType) == 0 // || builtInType.compare(fileName) == 0 // ) // { // continue; // } // for (PreparedType val : file.prepTypes) { // // if ((!val.isMain && val.type.compare(builtInType) != 0) // && this->builtInTypes->find(builtInType) // != this->builtInTypes->end()) { sprintf(out, RGX_BUILTIN_TYPE, builtInType.c_str()); string regexSearch(out); replaceFormat = "$1\\\\" + builtInType + "$3"; // strings->regexReplace(val.replace, regexSearch, replaceFormat); // // strings->regexReplace(file.content, val.raw, val.replace); strings->regexReplace(file.content, regexSearch, replaceFormat); strings->regexReplace(file.firstMainTypeFull, regexSearch, replaceFormat); // } // } } }
bool Scrollpad::setProperties(Format begin, const std::string &s, Format end, size_t flags, size_t id) { return regexSearch(m_buffer, begin, s, end, flags, id); }
bool Scrollpad::setProperties(Color begin, const std::string &s, Color end, size_t flags, size_t id) { return regexSearch(m_buffer, std::move(begin), s, std::move(end), id, flags); }
bool Scrollpad::setProperties(Color begin, const std::string &s, Color end, size_t id) { return regexSearch(m_buffer, begin, s, end, id); }
bool Scrollpad::setProperties(Format begin, const std::string &s, Format end, size_t id, boost::regex::flag_type flags) { return regexSearch(m_buffer, begin, s, end, id, flags); }