void PhpPlugin::PhpLintDone(const wxString& lintOutput, const wxString& filename) { // Find the editor CL_DEBUG("PHPLint: searching editor for file: %s", filename); IEditor* editor = m_mgr->FindEditor(filename); CHECK_PTR_RET(editor); wxRegEx reLine("[ \t]*on line ([0-9]+)"); wxArrayString lines = ::wxStringTokenize(lintOutput, "\n", wxTOKEN_STRTOK); for(size_t i = 0; i < lines.GetCount(); ++i) { wxString errorString = lines.Item(i); errorString.Trim().Trim(false); if(errorString.Contains("syntax error")) { // get the line number if(reLine.Matches(errorString)) { wxString strLine = reLine.GetMatch(errorString, 1); int where = errorString.Find(" in "); if(where != wxNOT_FOUND) { errorString.Truncate(where); } long nLine(wxNOT_FOUND); if(strLine.ToCLong(&nLine)) { CL_DEBUG("PHPLint: adding error marker @%d", (int)nLine - 1); editor->SetErrorMarker(nLine - 1, errorString); } } } } }
/*! \brief Disable assertions for device model/name in updater-script \param lines Container holding strings of lines in updater-script file */ void StandardPatcher::removeDeviceChecks(std::vector<std::string> *lines) { std::regex reLine("assert\\s*\\(.*getprop\\s*\\(.*(ro.product.device|ro.build.product)"); std::regex reReplace("^(\\s*assert\\s*\\()"); for (auto &line : *lines) { if (std::regex_search(line, reLine)) { line = std::regex_replace(line, reReplace, "$1\"true\" == \"true\" || "); } } }