forked from qt-creator/qt-creator
QmlJS: Update QML parser using the one from qtdeclarative 5.15
We need to do this because the new "required" keyword should be recognized by Qt Creator. This is not a verbatim copy of the QML parser from qtdeclarative. A few data structures have changed that would require large scale changes in otherwise unrelated parts of the code. For example, all Visitors need to handle recursion depth errors now and the DiagnosticMessage only has line and column now, no longer begin and legth. Change-Id: Iea5b04e27b07e0cba55d64b844315af9828acbf7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -109,6 +109,11 @@ public:
|
||||
StaticIsKeyword = 0x4
|
||||
};
|
||||
|
||||
enum class ImportState {
|
||||
SawImport,
|
||||
NoQmlImport
|
||||
};
|
||||
|
||||
public:
|
||||
Lexer(Engine *engine);
|
||||
|
||||
@@ -173,6 +178,7 @@ private:
|
||||
inline void scanChar();
|
||||
int scanToken();
|
||||
int scanNumber(QChar ch);
|
||||
int scanVersionNumber(QChar ch);
|
||||
enum ScanStringMode {
|
||||
SingleQuote = '\'',
|
||||
DoubleQuote = '"',
|
||||
@@ -227,6 +233,7 @@ private:
|
||||
int _tokenLength;
|
||||
int _tokenLine;
|
||||
int _tokenColumn;
|
||||
ImportState _importState = ImportState::NoQmlImport;
|
||||
|
||||
bool _validTokenText;
|
||||
bool _prohibitAutomaticSemicolon;
|
||||
@@ -238,6 +245,7 @@ private:
|
||||
bool _skipLinefeed = false;
|
||||
int _generatorLevel = 0;
|
||||
bool _staticIsKeyword = false;
|
||||
bool _handlingDirectives = false;
|
||||
};
|
||||
|
||||
} // end of namespace QmlJS
|
||||
|
||||
Reference in New Issue
Block a user