BuildLineInfo* NewBuildTab::DoProcessLine(const wxString& line) { BuildLineInfo* buildLineInfo = new BuildLineInfo(); LINE_SEVERITY severity; // Get the matching regex for this line CmpPatternPtr cmpPatterPtr = GetMatchingRegex(line, severity); buildLineInfo->SetSeverity(severity); BuildLineInfo bli; if(cmpPatterPtr && cmpPatterPtr->Matches(line, bli)) { buildLineInfo->SetFilename(bli.GetFilename()); buildLineInfo->SetSeverity(bli.GetSeverity()); buildLineInfo->SetLineNumber(bli.GetLineNumber()); buildLineInfo->NormalizeFilename(m_directories, m_cygwinRoot); buildLineInfo->SetRegexLineMatch(bli.GetRegexLineMatch()); buildLineInfo->SetColumn(bli.GetColumn()); if(severity == SV_WARNING) { // Warning m_errorsAndWarningsList.push_back(buildLineInfo); m_warnCount++; } else { // Error m_errorsAndWarningsList.push_back(buildLineInfo); m_errorsList.push_back(buildLineInfo); m_errorCount++; } } return buildLineInfo; }
bool CmpPattern::Matches(const wxString& line, BuildLineInfo& lineInfo) { long fidx, lidx; if ( !m_fileIndex.ToLong ( &fidx ) || !m_lineIndex.ToLong ( &lidx ) ) return false; if ( !m_regex || !m_regex->IsValid() ) return false; if ( !m_regex->Matches( line ) ) return false; lineInfo.SetSeverity(m_severity); if ( m_regex->GetMatchCount() > (size_t)fidx ) { lineInfo.SetFilename( m_regex->GetMatch(line, fidx) ); } // keep the match length lineInfo.SetRegexLineMatch( m_regex->GetMatch(line, 0).length() ); if ( m_regex->GetMatchCount() > (size_t)lidx ) { long lineNumber; wxString strLine = m_regex->GetMatch(line, lidx); strLine.ToLong(&lineNumber); lineInfo.SetLineNumber( --lineNumber ); } return true; }
bool CmpPattern::Matches(const wxString& line, BuildLineInfo& lineInfo) { long fidx, lidx; if(!m_fileIndex.ToLong(&fidx) || !m_lineIndex.ToLong(&lidx)) return false; if(!m_regex || !m_regex->IsValid()) return false; if(!m_regex->Matches(line)) return false; long colIndex; if(!m_colIndex.ToLong(&colIndex)) return false; lineInfo.SetSeverity(m_severity); if(m_regex->GetMatchCount() > (size_t)fidx) { lineInfo.SetFilename(m_regex->GetMatch(line, fidx)); } // keep the match length lineInfo.SetRegexLineMatch(m_regex->GetMatch(line, 0).length()); if(m_regex->GetMatchCount() > (size_t)lidx) { long lineNumber; wxString strLine = m_regex->GetMatch(line, lidx); strLine.ToLong(&lineNumber); lineInfo.SetLineNumber(--lineNumber); } if(m_regex->GetMatchCount() > (size_t)colIndex) { long column; wxString strCol = m_regex->GetMatch(line, colIndex); if(strCol.StartsWith(":")) { strCol.Remove(0, 1); } if(!strCol.IsEmpty() && strCol.ToLong(&column)) { lineInfo.SetColumn(column); } } return true; }
BuildLineInfo* NewBuildTab::DoProcessLine(const wxString& line, bool isSummaryLine) { BuildLineInfo *buildLineInfo = new BuildLineInfo(); if ( isSummaryLine ) { // Set the severity if( m_errorCount == 0 && m_warnCount == 0 ) { buildLineInfo->SetSeverity(SV_SUCCESS); } else if ( m_errorCount ) { buildLineInfo->SetSeverity(SV_ERROR); } else { buildLineInfo->SetSeverity(SV_WARNING); } } else { DoUpdateCurrentCompiler(line); // Usering the current line, update the active compiler based on the current project being compiled // Find *warnings* first bool isWarning = false; CmpPatterns cmpPatterns; if(!DoGetCompilerPatterns(m_cmp->GetName(), cmpPatterns)) { return buildLineInfo; } // If it is not an error, maybe it's a warning for(size_t i=0; i<cmpPatterns.warningPatterns.size(); i++) { CmpPatternPtr cmpPatterPtr = cmpPatterns.warningPatterns.at(i); BuildLineInfo bli; if ( cmpPatterPtr->Matches(line, bli) ) { buildLineInfo->SetFilename(bli.GetFilename()); buildLineInfo->SetSeverity(bli.GetSeverity()); buildLineInfo->SetLineNumber(bli.GetLineNumber()); buildLineInfo->NormalizeFilename(m_directories, m_cygwinRoot); buildLineInfo->SetRegexLineMatch(bli.GetRegexLineMatch()); // keep this info in the errors+warnings list only m_errorsAndWarningsList.push_back(buildLineInfo); m_warnCount++; isWarning = true; break; } } if ( !isWarning ) { for(size_t i=0; i<cmpPatterns.errorsPatterns.size(); i++) { BuildLineInfo bli; CmpPatternPtr cmpPatterPtr = cmpPatterns.errorsPatterns.at(i); if ( cmpPatterPtr->Matches(line, bli) ) { buildLineInfo->SetFilename(bli.GetFilename()); buildLineInfo->SetSeverity(bli.GetSeverity()); buildLineInfo->SetLineNumber(bli.GetLineNumber()); buildLineInfo->NormalizeFilename(m_directories, m_cygwinRoot); buildLineInfo->SetRegexLineMatch(bli.GetRegexLineMatch()); // keep this info in both lists (errors+warnings AND errors) m_errorsAndWarningsList.push_back(buildLineInfo); m_errorsList.push_back(buildLineInfo); m_errorCount++; break; } } } } return buildLineInfo; }