diff options
author | Roberto Raggi <roberto.raggi@nokia.com> | 2011-09-09 10:58:52 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-09-19 12:07:46 +0200 |
commit | 3c45c63827867995277432ffa19b787c8717ccce (patch) | |
tree | d315f29cdb5643e3bf4e088dea3a8a2327917c30 /src/declarative/qml/parser/qdeclarativejslexer.cpp | |
parent | 648650313384d893e7fa8c179090d42f8167c13a (diff) |
Introduced a QML scanning mode.
In QML mode, the lexer will recognize the extra QML keywords, e.g.
readonly, as, on, and so on.
Change-Id: I148ff857e201f99d41e0265bcfc480a94a1085a0
Reviewed-on: http://codereview.qt-project.org/4518
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Diffstat (limited to 'src/declarative/qml/parser/qdeclarativejslexer.cpp')
-rw-r--r-- | src/declarative/qml/parser/qdeclarativejslexer.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/declarative/qml/parser/qdeclarativejslexer.cpp b/src/declarative/qml/parser/qdeclarativejslexer.cpp index 453502797f..def1aa87ad 100644 --- a/src/declarative/qml/parser/qdeclarativejslexer.cpp +++ b/src/declarative/qml/parser/qdeclarativejslexer.cpp @@ -111,6 +111,7 @@ Lexer::Lexer(Engine *engine) , _restrictedKeyword(false) , _terminator(false) , _delimited(false) + , _qmlMode(true) { if (engine) engine->setLexer(this); @@ -121,11 +122,12 @@ QString Lexer::code() const return _code; } -void Lexer::setCode(const QString &code, int lineno) +void Lexer::setCode(const QString &code, int lineno, bool qmlMode) { if (_engine) _engine->setCode(code); + _qmlMode = qmlMode; _code = code; _tokenText.clear(); _tokenText.reserve(1024); @@ -708,7 +710,7 @@ again: int kind = T_IDENTIFIER; if (! identifierWithEscapeChars) - kind = classify(_tokenStartPtr, _tokenLength); + kind = classify(_tokenStartPtr, _tokenLength, _qmlMode); if (_engine) { if (kind == T_IDENTIFIER && identifierWithEscapeChars) |