Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qmlcodeparser.cpp File Reference

(0d2f52a766a9837a64b433523c2a08bd7a1cc935)

#include "qmlcodeparser.h"
#include "node.h"
#include "qmlvisitor.h"
#include "utilities.h"
#include <private/qqmljsast_p.h>
#include <QtCore/qstringview.h>
#include <qdebug.h>
#include <optional>
Include dependency graph for qmlcodeparser.cpp:

Go to the source code of this file.

Classes

struct  PragmaInfo
 Container for the result of processing a pragma declaration. More...

Functions

void replaceWithSpace (QString &str, int idx, int n)
 Copy and paste from src/declarative/qml/qdeclarativescriptparser.cpp.
static std::optional< PragmaInfoprocessDotPragma (QQmlJS::Lexer &lexer, const QStringView script)
 Processes a ".pragma <value>" declaration (JavaScript syntax).
static std::optional< PragmaInfoprocessPragma (QQmlJS::Lexer &lexer, const QStringView script)
 Processes a "pragma <value>" declaration (QML syntax).

Function Documentation

◆ processDotPragma()

std::optional< PragmaInfo > processDotPragma ( QQmlJS::Lexer & lexer,
const QStringView script )
static

Processes a ".pragma <value>" declaration (JavaScript syntax).

Returns pragma information if successfully processed, std::nullopt otherwise. Advances the lexer position but does not modify the script content.

Definition at line 125 of file qmlcodeparser.cpp.

◆ processPragma()

std::optional< PragmaInfo > processPragma ( QQmlJS::Lexer & lexer,
const QStringView script )
static

Processes a "pragma <value>" declaration (QML syntax).

Returns pragma information if successfully processed, std::nullopt otherwise. Advances the lexer position but does not modify the script content.

Definition at line 167 of file qmlcodeparser.cpp.

◆ replaceWithSpace()

void replaceWithSpace ( QString & str,
int idx,
int n )

Copy and paste from src/declarative/qml/qdeclarativescriptparser.cpp.

This function blanks out the section of the str beginning at idx and running for n characters.

Definition at line 93 of file qmlcodeparser.cpp.