10#include <QtCore/qstring.h>
12#include <private/qqmljsastvisitor_p.h>
13#include <private/qqmljsengine_p.h>
22 QmlDocVisitor(
const QString &filePath,
const QString &code, QQmlJS::Engine *engine,
23 const QSet<QString> &commands,
const QSet<QString> &topics);
26 bool visit(QQmlJS::AST::UiImport *import)
override;
27 void endVisit(QQmlJS::AST::UiImport *definition)
override;
29 bool visit(QQmlJS::AST::UiObjectDefinition *definition)
override;
30 void endVisit(QQmlJS::AST::UiObjectDefinition *definition)
override;
32 bool visit(QQmlJS::AST::UiPublicMember *member)
override;
33 void endVisit(QQmlJS::AST::UiPublicMember *definition)
override;
35 bool visit(QQmlJS::AST::UiObjectBinding *)
override;
36 void endVisit(QQmlJS::AST::UiObjectBinding *)
override;
37 void endVisit(QQmlJS::AST::UiArrayBinding *)
override;
38 bool visit(QQmlJS::AST::UiArrayBinding *)
override;
40 bool visit(QQmlJS::AST::IdentifierPropertyName *idproperty)
override;
42 bool visit(QQmlJS::AST::FunctionDeclaration *)
override;
43 void endVisit(QQmlJS::AST::FunctionDeclaration *)
override;
45 bool visit(QQmlJS::AST::UiScriptBinding *)
override;
46 void endVisit(QQmlJS::AST::UiScriptBinding *)
override;
48 bool visit(QQmlJS::AST::UiQualifiedId *)
override;
49 void endVisit(QQmlJS::AST::UiQualifiedId *)
override;
57 QString getFullyQualifiedId(QQmlJS::AST::UiQualifiedId *id);
58 [[
nodiscard]] QQmlJS::SourceLocation precedingComment(quint32 offset)
const;
59 Node *applyDocumentation(QQmlJS::SourceLocation location,
Node *node);
60 void applyMetacommands(QQmlJS::SourceLocation location,
Node *node,
Doc &doc);
62 QQmlJS::Engine *m_engine {
nullptr };
63 quint32 m_lastEndOffset {};
64 quint32 m_nestingLevel {};
65 QString m_filePath {};
67 QString m_document {};
69 QSet<QString> m_commands {};
70 QSet<QString> m_topics {};
71 QSet<quint32> m_usedComments {};
73 bool hasRecursionDepthError {
false };
74 bool m_singletonPragmaFound {
false };
The Location class provides a way to mark a location in a file.
QStringList sourceFileNameFilter() override
Returns a string list containing "*.qml".
void parseSourceFile(const Location &location, const QString &filePath, CppCodeParser &) override
Parses the source file at filePath and inserts the contents into the database.
QStringList extractPragmas(QString &script) const
Copy & paste from src/declarative/qml/qdeclarativescriptparser.cpp, then modified to return pragma in...
bool visit(QQmlJS::AST::UiImport *import) override
void throwRecursionDepthError() final
void endVisit(QQmlJS::AST::UiImport *definition) override
QmlDocVisitor(const QString &filePath, const QString &code, QQmlJS::Engine *engine, const QSet< QString > &commands, const QSet< QString > &topics)
The constructor stores all the parameters in local data members.
void setSingletonPragmaFound(bool found)
~QmlDocVisitor() override=default
#define COMMAND_QMLSIGNAL
#define COMMAND_QMLSINGLETONTYPE
#define COMMAND_QMLPROPERTYGROUP
#define COMMAND_QMLPROPERTY
#define COMMAND_QMLATTACHEDPROPERTY
#define COMMAND_QMLBASICTYPE
#define COMMAND_QMLMETHOD
#define COMMAND_QMLVALUETYPE
#define COMMAND_QMLATTACHEDMETHOD
#define COMMAND_QMLATTACHEDSIGNAL
static std::optional< PragmaInfo > processPragma(QQmlJS::Lexer &lexer, const QStringView script)
Processes a "pragma <value>" declaration (QML syntax).
static std::optional< PragmaInfo > processDotPragma(QQmlJS::Lexer &lexer, const QStringView script)
Processes a ".pragma <value>" declaration (JavaScript syntax).
void replaceWithSpace(QString &str, int idx, int n)
Copy and paste from src/declarative/qml/qdeclarativescriptparser.cpp.
QList< ImportRec > ImportList
The Node class is the base class for all the nodes in QDoc's parse tree.
Container for the result of processing a pragma declaration.