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 };
105 bool qmlMode()
const;
110 void setCode(
const QString &code,
int lineno,
bool qmlMode =
true,
111 CodeContinuation codeContinuation = CodeContinuation::Reset);
115 bool scanRegExp(RegExpBodyPrefix prefix = NoPrefix);
122 int tokenOffset()
const {
return _currentOffset + _tokenStartPtr - _code.unicode(); }
133 Error errorCode()
const;
136 bool canInsertAutomaticSemicolon(
int token)
const;
154 double tokenValue = 0;
158 int parenthesesCount = 0;
162 int bracesCount = -1;
166 int patternFlags = 0;
170 bool validTokenText =
false;
171 bool prohibitAutomaticSemicolon =
false;
172 bool restrictedKeyword =
false;
173 bool terminator =
false;
174 bool followsClosingBrace =
false;
175 bool delimited =
true;
176 bool handlingDirectives =
false;
178 int generatorLevel = 0;
182 if (
s1.errorCode !=
s2.errorCode)
184 if (
s1.currentChar !=
s2.currentChar)
186 if (
s1.tokenValue !=
s2.tokenValue)
188 if (
s1.parenthesesState !=
s2.parenthesesState)
190 if (
s1.parenthesesCount !=
s2.parenthesesCount)
192 if (
s1.outerTemplateBraceCount !=
s2.outerTemplateBraceCount)
194 if (
s1.bracesCount !=
s2.bracesCount)
196 if (
s1.stackToken !=
s2.stackToken)
198 if (
s1.patternFlags !=
s2.patternFlags)
200 if (
s1.tokenKind !=
s2.tokenKind)
202 if (
s1.importState !=
s2.importState)
204 if (
s1.validTokenText !=
s2.validTokenText)
206 if (
s1.prohibitAutomaticSemicolon !=
s2.prohibitAutomaticSemicolon)
208 if (
s1.restrictedKeyword !=
s2.restrictedKeyword)
210 if (
s1.terminator !=
s2.terminator)
212 if (
s1.followsClosingBrace !=
s2.followsClosingBrace)
214 if (
s1.delimited !=
s2.delimited)
216 if (
s1.handlingDirectives !=
s2.handlingDirectives)
218 if (
s1.generatorLevel !=
s2.generatorLevel)
232 static int classify(
const QChar *
s,
int n,
int parseModeFlags);
235 int parseModeFlags()
const;
236 bool prevTerminator()
const;
237 bool followsClosingBrace()
const;
238 inline void scanChar();
239 inline QChar peekChar();
242 int scanVersionNumber(
QChar ch);
243 enum ScanStringMode :
char16_t {
247 TemplateContinuation = 0
249 int scanString(ScanStringMode
mode);
251 bool isLineTerminator()
const;
252 unsigned isLineTerminatorSequence()
const;
253 static bool isIdentLetter(
QChar c);
254 static bool isDecimalDigit(
ushort c);
256 static bool isOctalDigit(
ushort c);
258 void syncProhibitAutomaticSemicolon();
259 uint decodeUnicodeEscapeCharacter(
bool *
ok);
260 QChar decodeHexEscapeCharacter(
bool *
ok);
267 LexMode _lexMode = LexMode::WholeCode;
269 const QChar *_endPtr;
271 bool _staticIsKeyword =
false;
273 bool _skipLinefeed =
false;
275 int _currentLineNumber = 0;
276 int _currentColumnNumber = 0;
277 int _currentOffset = 0;
279 int _tokenLength = 0;
281 int _tokenColumn = 0;
288 const QChar *_codePtr =
nullptr;
289 const QChar *_tokenStartPtr =
nullptr;