Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
|
#include <qqmljslexer_p.h>
Classes | |
struct | State |
Public Member Functions | |
Lexer (Engine *engine, LexMode lexMode=LexMode::WholeCode) | |
bool | qmlMode () const |
bool | yieldIsKeyWord () const |
void | setStaticIsKeyword (bool b) |
QString | code () const |
void | setCode (const QString &code, int lineno, bool qmlMode=true, CodeContinuation codeContinuation=CodeContinuation::Reset) |
int | lex () |
bool | scanRegExp (RegExpBodyPrefix prefix=NoPrefix) |
bool | scanDirectives (Directives *directives, DiagnosticMessage *error) |
int | regExpFlags () const |
QString | regExpPattern () const |
int | tokenKind () const |
int | tokenOffset () const |
int | tokenLength () const |
int | tokenStartLine () const |
int | tokenStartColumn () const |
QStringView | tokenSpell () const |
QStringView | rawString () const |
double | tokenValue () const |
QString | tokenText () const |
Error | errorCode () const |
QString | errorMessage () const |
bool | canInsertAutomaticSemicolon (int token) const |
void | enterGeneratorBody () |
void | leaveGeneratorBody () |
const State & | state () const |
void | setState (const State &state) |
Static Protected Member Functions | |
static int | classify (const QChar *s, int n, int parseModeFlags) |
Friends | |
QML_PARSER_EXPORT QDebug | operator<< (QDebug dbg, const Lexer &l) |
Definition at line 34 of file qqmljslexer_p.h.
anonymous enum |
Definition at line 37 of file qqmljslexer_p.h.
|
strong |
Enumerator | |
---|---|
Reset | |
Continue |
Definition at line 100 of file qqmljslexer_p.h.
|
strong |
Enumerator | |
---|---|
NoComment | |
HadComment | |
InMultilineComment |
Definition at line 144 of file qqmljslexer_p.h.
enum QQmlJS::Lexer::Error |
Definition at line 61 of file qqmljslexer_p.h.
|
strong |
Enumerator | |
---|---|
SawImport | |
NoQmlImport |
Definition at line 93 of file qqmljslexer_p.h.
|
strong |
Enumerator | |
---|---|
WholeCode | |
LineByLine |
Definition at line 98 of file qqmljslexer_p.h.
Enumerator | |
---|---|
IgnoreParentheses | |
CountParentheses | |
BalancedParentheses |
Definition at line 138 of file qqmljslexer_p.h.
Enumerator | |
---|---|
QmlMode | |
YieldIsKeyword | |
StaticIsKeyword |
Definition at line 87 of file qqmljslexer_p.h.
Enumerator | |
---|---|
NoPrefix | |
EqualPrefix |
Definition at line 74 of file qqmljslexer_p.h.
Enumerator | |
---|---|
RegExp_Global | |
RegExp_IgnoreCase | |
RegExp_Multiline | |
RegExp_Unicode | |
RegExp_Sticky |
Definition at line 79 of file qqmljslexer_p.h.
Lexer::Lexer | ( | Engine * | engine, |
LexMode | lexMode = LexMode::WholeCode ) |
Definition at line 50 of file qqmljslexer.cpp.
References engine.
bool Lexer::canInsertAutomaticSemicolon | ( | int | token | ) | const |
Definition at line 1583 of file qqmljslexer.cpp.
References QQmlJS::Lexer::State::followsClosingBrace, QQmlJS::Lexer::State::terminator, and token.
|
staticprotected |
Definition at line 898 of file qqmljskeywords_p.h.
References QQmlJS::classify10(), QQmlJS::classify12(), QQmlJS::classify2(), QQmlJS::classify3(), QQmlJS::classify4(), QQmlJS::classify5(), QQmlJS::classify6(), QQmlJS::classify7(), QQmlJS::classify8(), and QQmlJS::classify9().
QString Lexer::code | ( | ) | const |
Definition at line 62 of file qqmljslexer.cpp.
Referenced by addLexToken(), and setCode().
|
inline |
Definition at line 146 of file qqmljslexer_p.h.
Lexer::Error Lexer::errorCode | ( | ) | const |
Definition at line 1550 of file qqmljslexer.cpp.
References QQmlJS::Lexer::State::errorCode.
Referenced by addLexToken().
QString Lexer::errorMessage | ( | ) | const |
Definition at line 1555 of file qqmljslexer.cpp.
Referenced by addLexToken().
|
inline |
Definition at line 147 of file qqmljslexer_p.h.
int Lexer::lex | ( | ) |
Definition at line 196 of file qqmljslexer.cpp.
References QQmlJS::Engine::addComment(), BalancedParentheses, QQmlJS::Lexer::State::bracesCount, QQmlJS::Lexer::State::comments, CountParentheses, QQmlJS::Lexer::State::currentChar, QQmlJS::Lexer::State::delimited, QQmlJS::Lexer::State::followsClosingBrace, HadComment, QQmlJS::Lexer::State::handlingDirectives, IgnoreParentheses, QQmlJS::Lexer::State::importState, InMultilineComment, QString::isEmpty(), LineByLine, NoComment, NoQmlImport, QQmlJS::Lexer::State::parenthesesCount, QQmlJS::Lexer::State::parenthesesState, Q_FALLTHROUGH, qmlMode(), QQmlJS::Lexer::State::restrictedKeyword, SawImport, QQmlJS::Lexer::State::stackToken, tokenKind(), QQmlJS::Lexer::State::tokenKind, tokenOffset(), tokenStartColumn(), and tokenStartLine().
Referenced by addLexToken(), QQmlLSUtils::isValidEcmaScriptIdentifier(), QQmlJS::Dom::Scanner::operator()(), and scanDirectives().
bool Lexer::qmlMode | ( | ) | const |
Definition at line 57 of file qqmljslexer.cpp.
Referenced by lex(), and setCode().
|
inline |
Definition at line 129 of file qqmljslexer_p.h.
|
inline |
Definition at line 118 of file qqmljslexer_p.h.
|
inline |
Definition at line 119 of file qqmljslexer_p.h.
bool Lexer::scanDirectives | ( | Directives * | directives, |
DiagnosticMessage * | error ) |
Definition at line 1642 of file qqmljslexer.cpp.
References error, QQmlJS::Lexer::State::handlingDirectives, QQmlJS::Directives::importFile(), QQmlJS::Directives::importModule(), isUriToken(), lex(), QQmlJS::Directives::pragmaLibrary(), Q_ASSERT, setError(), QQmlJS::Lexer::State::tokenKind, tokenStartColumn(), tokenStartLine(), tokenText(), and QCoreApplication::translate().
bool Lexer::scanRegExp | ( | RegExpBodyPrefix | prefix = NoPrefix | ) |
Definition at line 1385 of file qqmljslexer.cpp.
References QQmlJS::Lexer::State::currentChar, EqualPrefix, QQmlJS::Lexer::State::patternFlags, regExpFlagFromChar(), QString::resize(), QCoreApplication::translate(), and QQmlJS::Lexer::State::validTokenText.
Referenced by addLexToken().
void Lexer::setCode | ( | const QString & | code, |
int | lineno, | ||
bool | qmlMode = true, | ||
Lexer::CodeContinuation | codeContinuation = CodeContinuation::Reset ) |
Definition at line 67 of file qqmljslexer.cpp.
References QString::clear(), code(), Continue, qmlMode(), QString::reserve(), Reset, QQmlJS::Engine::setCode(), QString::size(), and QString::unicode().
Referenced by QQmlJS::Dom::JsFile::JsFile(), QQmlJS::Dom::QmlFile::QmlFile(), QQmlJSLinter::applyFixes(), QV4::Compiler::Codegen::compileModule(), QmlIR::IRBuilder::generateFromQml(), QQmlLSUtils::isValidEcmaScriptIdentifier(), QQmlJSLinter::lintFile(), QQmlJSTypeReader::operator()(), QQmlJSTypeDescriptionReader::operator()(), QQmlJS::Dom::Scanner::operator()(), QV4::Script::parse(), QV4::FunctionCtor::parse(), QV4::Script::precompile(), and qCompileJSFile().
Definition at line 1801 of file qqmljslexer.cpp.
References state().
Referenced by QQmlJS::Dom::Scanner::operator()().
|
inline |
Definition at line 107 of file qqmljslexer_p.h.
const Lexer::State & Lexer::state | ( | ) | const |
Definition at line 1797 of file qqmljslexer.cpp.
Referenced by addLexToken(), QQmlJS::Dom::Scanner::operator()(), and setState().
|
inline |
Definition at line 121 of file qqmljslexer_p.h.
Referenced by lex().
|
inline |
Definition at line 123 of file qqmljslexer_p.h.
Referenced by addLexToken().
|
inline |
Definition at line 122 of file qqmljslexer_p.h.
Referenced by lex().
|
inline |
Definition at line 128 of file qqmljslexer_p.h.
|
inline |
Definition at line 126 of file qqmljslexer_p.h.
Referenced by addLexToken(), lex(), and scanDirectives().
|
inline |
Definition at line 125 of file qqmljslexer_p.h.
Referenced by lex(), and scanDirectives().
QString Lexer::tokenText | ( | ) | const |
Definition at line 1539 of file qqmljslexer.cpp.
References QQmlJS::Lexer::State::tokenKind, and QQmlJS::Lexer::State::validTokenText.
Referenced by addLexToken(), and scanDirectives().
|
inline |
Definition at line 130 of file qqmljslexer_p.h.
|
inline |
Definition at line 106 of file qqmljslexer_p.h.
|
friend |
Definition at line 443 of file qqmljslexer.cpp.