diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2014-12-05 16:32:56 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2015-01-08 22:08:19 +0100 |
commit | 9d7b27f5bf44a46707e6d50ebf51ecf73f91dd1b (patch) | |
tree | 69ec84f34655b892c8bc855aa9a378a4bb2716fa /src/qml/parser/qqmljslexer_p.h | |
parent | bede2a3ac794120be65fa50bfbc8ed04082c10e0 (diff) |
Clean up JS .import/.pragma directive scanning
There's a scanner in QQmlJS::Lexer::scanDirectives that can parse those, so
let's get rid of extra parser that operates on a string. Instead this way we
can do the scanning all in one shot, avoid detaching a copy of the source code
string and (most importantly) bring the parser closer to the copy in Qt
Creator, which uses the directives approach to extract imports and pragma.
Change-Id: Iff6eb8d91a45d8a70f383f953115692be48259de
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@theqtcompany.com>
Diffstat (limited to 'src/qml/parser/qqmljslexer_p.h')
-rw-r--r-- | src/qml/parser/qqmljslexer_p.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/qml/parser/qqmljslexer_p.h b/src/qml/parser/qqmljslexer_p.h index 9106c94477..b5415f8777 100644 --- a/src/qml/parser/qqmljslexer_p.h +++ b/src/qml/parser/qqmljslexer_p.h @@ -55,6 +55,7 @@ QT_QML_BEGIN_NAMESPACE namespace QQmlJS { class Engine; +class DiagnosticMessage; class QML_PARSER_EXPORT Directives { public: @@ -64,17 +65,21 @@ public: { } - virtual void importFile(const QString &jsfile, const QString &module) + virtual void importFile(const QString &jsfile, const QString &module, int line, int column) { Q_UNUSED(jsfile); Q_UNUSED(module); + Q_UNUSED(line); + Q_UNUSED(column); } - virtual void importModule(const QString &uri, const QString &version, const QString &module) + virtual void importModule(const QString &uri, const QString &version, const QString &module, int line, int column) { Q_UNUSED(uri); Q_UNUSED(version); Q_UNUSED(module); + Q_UNUSED(line); + Q_UNUSED(column); } }; @@ -146,7 +151,7 @@ public: int lex(); bool scanRegExp(RegExpBodyPrefix prefix = NoPrefix); - bool scanDirectives(Directives *directives); + bool scanDirectives(Directives *directives, DiagnosticMessage *error); int regExpFlags() const { return _patternFlags; } QString regExpPattern() const { return _tokenText; } |