18#include <private/qqmljsglobal_p.h>
19#include <private/qqmljsgrammar_p.h>
21#include <QtCore/qstring.h>
22#include <QtCore/qstack.h>
31struct DiagnosticMessage;
38 T_ABSTRACT = T_RESERVED_WORD,
39 T_BOOLEAN = T_RESERVED_WORD,
40 T_BYTE = T_RESERVED_WORD,
41 T_CHAR = T_RESERVED_WORD,
42 T_DOUBLE = T_RESERVED_WORD,
43 T_FINAL = T_RESERVED_WORD,
44 T_FLOAT = T_RESERVED_WORD,
45 T_GOTO = T_RESERVED_WORD,
46 T_IMPLEMENTS = T_RESERVED_WORD,
47 T_INT = T_RESERVED_WORD,
48 T_INTERFACE = T_RESERVED_WORD,
49 T_LONG = T_RESERVED_WORD,
50 T_NATIVE = T_RESERVED_WORD,
51 T_PACKAGE = T_RESERVED_WORD,
52 T_PRIVATE = T_RESERVED_WORD,
53 T_PROTECTED = T_RESERVED_WORD,
54 T_SHORT = T_RESERVED_WORD,
55 T_SYNCHRONIZED = T_RESERVED_WORD,
56 T_THROWS = T_RESERVED_WORD,
57 T_TRANSIENT = T_RESERVED_WORD,
58 T_VOLATILE = T_RESERVED_WORD
71 IllegalHexadecimalEscapeSequence
81 RegExp_IgnoreCase = 0x02,
82 RegExp_Multiline = 0x04,
83 RegExp_Unicode = 0x08,
98 enum class LexMode { WholeCode, LineByLine };
108 flags |= QmlMode|StaticIsKeyword;
109 if (yieldIsKeyWord())
110 flags |= YieldIsKeyword;
111 if (_staticIsKeyword)
112 flags |= StaticIsKeyword;
116 bool qmlMode()
const;
121 void setCode(
const QString &code,
int lineno,
bool qmlMode =
true,
122 CodeContinuation codeContinuation = CodeContinuation::Reset);
126 bool scanRegExp(RegExpBodyPrefix prefix = NoPrefix);
133 int tokenOffset()
const {
return _currentOffset + _tokenStartPtr - _code.unicode(); }
144 Error errorCode()
const;
147 bool prevTerminator()
const;
148 bool followsClosingBrace()
const;
149 bool canInsertAutomaticSemicolon(
int token)
const;
167 double tokenValue = 0;
171 int parenthesesCount = 0;
175 int bracesCount = -1;
179 int patternFlags = 0;
183 bool validTokenText =
false;
184 bool prohibitAutomaticSemicolon =
false;
185 bool restrictedKeyword =
false;
186 bool terminator =
false;
187 bool followsClosingBrace =
false;
188 bool delimited =
true;
189 bool handlingDirectives =
false;
191 int generatorLevel = 0;
195 if (
s1.errorCode !=
s2.errorCode)
197 if (
s1.currentChar !=
s2.currentChar)
199 if (
s1.tokenValue !=
s2.tokenValue)
201 if (
s1.parenthesesState !=
s2.parenthesesState)
203 if (
s1.parenthesesCount !=
s2.parenthesesCount)
205 if (
s1.outerTemplateBraceCount !=
s2.outerTemplateBraceCount)
207 if (
s1.bracesCount !=
s2.bracesCount)
209 if (
s1.stackToken !=
s2.stackToken)
211 if (
s1.patternFlags !=
s2.patternFlags)
213 if (
s1.tokenKind !=
s2.tokenKind)
215 if (
s1.importState !=
s2.importState)
217 if (
s1.validTokenText !=
s2.validTokenText)
219 if (
s1.prohibitAutomaticSemicolon !=
s2.prohibitAutomaticSemicolon)
221 if (
s1.restrictedKeyword !=
s2.restrictedKeyword)
223 if (
s1.terminator !=
s2.terminator)
225 if (
s1.followsClosingBrace !=
s2.followsClosingBrace)
227 if (
s1.delimited !=
s2.delimited)
229 if (
s1.handlingDirectives !=
s2.handlingDirectives)
231 if (
s1.generatorLevel !=
s2.generatorLevel)
245 static int classify(
const QChar *
s,
int n,
int parseModeFlags);
248 inline void scanChar();
249 inline QChar peekChar();
252 int scanVersionNumber(
QChar ch);
253 enum ScanStringMode {
257 TemplateContinuation = 0
259 int scanString(ScanStringMode
mode);
261 bool isLineTerminator()
const;
262 unsigned isLineTerminatorSequence()
const;
263 static bool isIdentLetter(
QChar c);
264 static bool isDecimalDigit(
ushort c);
266 static bool isOctalDigit(
ushort c);
268 void syncProhibitAutomaticSemicolon();
269 uint decodeUnicodeEscapeCharacter(
bool *
ok);
270 QChar decodeHexEscapeCharacter(
bool *
ok);
277 LexMode _lexMode = LexMode::WholeCode;
279 const QChar *_endPtr;
281 bool _staticIsKeyword =
false;
283 bool _skipLinefeed =
false;
285 int _currentLineNumber = 0;
286 int _currentColumnNumber = 0;
287 int _currentOffset = 0;
289 int _tokenLength = 0;
291 int _tokenColumn = 0;
298 const QChar *_codePtr =
nullptr;
299 const QChar *_tokenStartPtr =
nullptr;
void setStaticIsKeyword(bool b)
int tokenStartColumn() const
@ IllegalUnicodeEscapeSequence
@ IllegalExponentIndicator
void leaveGeneratorBody()
QString regExpPattern() const
QStringView rawString() const
bool yieldIsKeyWord() const
int tokenStartLine() const
int parseModeFlags() const
double tokenValue() const
void enterGeneratorBody()
QStringView tokenSpell() const
\macro QT_RESTRICTED_CAST_FROM_ASCII
Combined button and popup list for selecting options.
static bool isHexDigit(const char c)
DBusConnection const char DBusError * error
GLboolean GLboolean GLboolean b
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s1
#define QML_PARSER_EXPORT
static QString errorMessage(QUrlPrivate::ErrorCode errorCode, const QString &errorSource, qsizetype errorPosition)
friend bool operator==(State const &s1, State const &s2)
friend bool operator!=(State const &s1, State const &s2)
QStack< int > outerTemplateBraceCount