1// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#ifndef GNUMAKEPARSER_H
6#define GNUMAKEPARSER_H
7
8#include "services/builder/ioutputparser.h"
9
10#include <QRegularExpression>
11#include <QStringList>
12
13class GnuMakeParser : public IOutputParser
14{
15 Q_OBJECT
16
17public:
18 explicit GnuMakeParser();
19
20 void stdOutput(const QString &line, OutputPane::OutputFormat format) override;
21 void stdError(const QString &line) override;
22
23 void setWorkingDirectory(const QString &workingDirectory) override;
24
25 QStringList searchDirectories() const;
26
27 bool hasFatalErrors() const override;
28
29 void taskAdded(const Task &task, int linkedLines, int skippedLines) override;
30
31private:
32 void addDirectory(const QString &dir);
33 void removeDirectory(const QString &dir);
34
35 QRegularExpression makeDir;
36 QRegularExpression makeLine;
37 QRegularExpression threeStarError;
38 QRegularExpression errorInMakefile;
39
40 QStringList directories;
41
42 bool suppressIssues = false;
43
44 int fatalErrorCount = 0;
45};
46
47#endif // GNUMAKEPARSER_H
48