13#include <QtCore/qregularexpression.h>
17QList<CodeParser *> CodeParser::s_parsers;
20
21
22
26 s_parsers.prepend(
this);
30
31
32
35 s_parsers.removeAll(
this);
39
40
47
48
49
52 for (
const auto &parser : std::as_const(s_parsers))
53 parser->initializeParser();
57
58
61 for (
const auto parser : s_parsers)
62 parser->terminateParser();
67 for (
const auto parser : std::as_const(s_parsers)) {
68 if (parser->language() == language)
76 QString fileName = QFileInfo(filePath).fileName();
78 for (
const auto &parser : s_parsers) {
79 const QStringList sourcePatterns = parser->sourceFileNameFilter();
80 for (
const QString &pattern : sourcePatterns) {
81 auto re = QRegularExpression::fromWildcard(pattern, Qt::CaseInsensitive);
82 if (re.match(fileName).hasMatch())
90
91
92void CodeParser::extractPageLinkAndDesc(QStringView arg, QString *link, QString *desc)
94 static const QRegularExpression bracedRegExp(
95 QRegularExpression::anchoredPattern(QLatin1String(R"(\{([^{}]*)\}(?:\{([^{}]*)\})?)")));
96 auto match = bracedRegExp.matchView(arg);
97 if (match.hasMatch()) {
98 *link = match.captured(1);
99 *desc = match.captured(2);
103 qsizetype spaceAt = arg.indexOf(QLatin1Char(
' '));
104 if (arg.contains(QLatin1String(
".html")) && spaceAt != -1) {
105 *link = arg.left(spaceAt).trimmed().toString();
106 *desc = arg.mid(spaceAt).trimmed().toString();
108 *link = arg.toString();
115
116
121 extractPageLinkAndDesc(arg, &link, &desc);
122 node->setLink(linkType, link, desc);
126
127
128
129
130
131
132
133
134
137 const InclusionPolicy policy = Config::instance().createInclusionPolicy();
139 || !doc.metaCommandsUsed().contains(QStringLiteral(
"internal")));
virtual void terminateParser()
Terminating a code parser is trivial.
CodeParser()
The constructor adds this code parser to the static list of code parsers.
static CodeParser * parserForLanguage(const QString &language)
static CodeParser * parserForSourceFile(const QString &filePath)
static bool isWorthWarningAbout(const Doc &doc)
Test for whether a doc comment warrants warnings.
virtual ~CodeParser()
The destructor removes this code parser from the static list of code parsers.
static void initialize()
All the code parsers in the static list are initialized here, after the qdoc configuration variables ...
static void terminate()
All the code parsers in the static list are terminated here.
static bool processInternalDocs(const InclusionPolicy &policy)
This class provides exclusive access to the qdoc database, which consists of a forrest of trees and a...
static QDocDatabase * qdocDB()
Creates the singleton.
The Node class is the base class for all the nodes in QDoc's parse tree.