summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/parser
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-18 11:22:31 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-18 11:22:31 (GMT)
commit465f4df8ad4be9485c37ecc379c45e758b2842ad (patch)
tree5067e1a64edb496c76e699d2e2b295a9d7aad784 /src/declarative/qml/parser
parent0cea0e45523283d6c31998672f97b0343c1388f2 (diff)
parente66fcc2b1897883d8ec0780c731c5989cb657cdf (diff)
downloadQt-465f4df8ad4be9485c37ecc379c45e758b2842ad.zip
Qt-465f4df8ad4be9485c37ecc379c45e758b2842ad.tar.gz
Qt-465f4df8ad4be9485c37ecc379c45e758b2842ad.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: (29 commits) Recognize identifiers containing unicode escape sequences. Fix README Fix doc: QML_DECLARE_TYPE is no longer necessary Fix doc: remote contents requires qmldir Fixed parsing of inner labelled statements. Doc Remove unsupported plugin version flags in .pro files of declarative examples Documentation typo. More QML doc consistency. Ensure existing image is gone before next photo selection. Don't use zoomfactor. Doc: in QML use "real" and "enumeration", not "qreal" and "enum" Doc: Put "default" property label on same line as property name Wait for debug clients asynchronously instead of blocking creation of Test not reliable ResizeMode support for QGraphicsWidgets created with QDeclarativeView More class documentation fixes for declarative. Simplify QML import plugin deployment lines Add QML imports to s60installs.pro Cleanup photoviewer demo. ...
Diffstat (limited to 'src/declarative/qml/parser')
-rw-r--r--src/declarative/qml/parser/qdeclarativejs.g2
-rw-r--r--src/declarative/qml/parser/qdeclarativejsgrammar.cpp6
-rw-r--r--src/declarative/qml/parser/qdeclarativejslexer.cpp42
3 files changed, 45 insertions, 5 deletions
diff --git a/src/declarative/qml/parser/qdeclarativejs.g b/src/declarative/qml/parser/qdeclarativejs.g
index ba9338e..1b66ba0 100644
--- a/src/declarative/qml/parser/qdeclarativejs.g
+++ b/src/declarative/qml/parser/qdeclarativejs.g
@@ -1376,7 +1376,7 @@ case $rule_number: {
} break;
./
-PropertyName: T_IDENTIFIER %prec REDUCE_HERE ;
+PropertyName: T_IDENTIFIER %prec SHIFT_THERE ;
/.
case $rule_number: {
AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval);
diff --git a/src/declarative/qml/parser/qdeclarativejsgrammar.cpp b/src/declarative/qml/parser/qdeclarativejsgrammar.cpp
index 52e979a..b87d8f4 100644
--- a/src/declarative/qml/parser/qdeclarativejsgrammar.cpp
+++ b/src/declarative/qml/parser/qdeclarativejsgrammar.cpp
@@ -40,7 +40,7 @@
****************************************************************************/
// This file was generated by qlalr - DO NOT EDIT!
-#include "private/qdeclarativejsgrammar_p.h"
+#include "qdeclarativejsgrammar_p.h"
QT_BEGIN_NAMESPACE
@@ -346,9 +346,9 @@ const short QDeclarativeJSGrammar::action_index [] = {
const short QDeclarativeJSGrammar::action_info [] = {
399, 352, 345, -101, 343, 457, 440, 403, 257, -112,
- -125, -131, -123, -98, -120, 348, -128, 389, 453, 391,
+ -125, -131, -123, 346, -120, 348, -128, 389, 453, 391,
416, 401, 408, 563, -101, -123, 416, -120, 539, -131,
- -98, -112, -125, 348, 257, 99, 71, 645, 621, 101,
+ 346, -112, -125, 348, 257, 99, 71, 645, 621, 101,
-128, 440, 141, 621, 164, 431, 539, 430, 453, 573,
457, 444, 440, 424, 71, 424, 101, 446, 559, 420,
424, 448, 539, 440, 570, 539, 466, 527, 312, 346,
diff --git a/src/declarative/qml/parser/qdeclarativejslexer.cpp b/src/declarative/qml/parser/qdeclarativejslexer.cpp
index 3a0e897..a686dca 100644
--- a/src/declarative/qml/parser/qdeclarativejslexer.cpp
+++ b/src/declarative/qml/parser/qdeclarativejslexer.cpp
@@ -484,6 +484,8 @@ int Lexer::lex()
stackToken = -1;
}
+ bool identifierWithEscapedUnicode = false;
+
while (!done) {
switch (state) {
case Start:
@@ -523,7 +525,26 @@ int Lexer::lex()
state = InString;
multiLineString = false;
stringType = current;
+ } else if (current == '\\' && next1 == 'u') {
+ identifierWithEscapedUnicode = true;
+ recordStartPos();
+
+ shift(2); // skip the unicode escape prefix `\u'
+
+ if (isHexDigit(current) && isHexDigit(next1) &&
+ isHexDigit(next2) && isHexDigit(next3)) {
+ record16(convertUnicode(current, next1, next2, next3));
+ shift(3);
+ state = InIdentifier;
+ } else {
+ setDone(Bad);
+ err = IllegalUnicodeEscapeSequence;
+ errmsg = QCoreApplication::translate("QDeclarativeParser", "Illegal unicode escape sequence");
+ break;
+ }
+
} else if (isIdentLetter(current)) {
+ identifierWithEscapedUnicode = false;
recordStartPos();
record16(current);
state = InIdentifier;
@@ -683,6 +704,21 @@ int Lexer::lex()
if (isIdentLetter(current) || isDecimalDigit(current)) {
record16(current);
break;
+ } else if (current == '\\' && next1 == 'u') {
+ identifierWithEscapedUnicode = true;
+ shift(2); // skip the unicode escape prefix `\u'
+
+ if (isHexDigit(current) && isHexDigit(next1) &&
+ isHexDigit(next2) && isHexDigit(next3)) {
+ record16(convertUnicode(current, next1, next2, next3));
+ shift(3);
+ break;
+ } else {
+ setDone(Bad);
+ err = IllegalUnicodeEscapeSequence;
+ errmsg = QCoreApplication::translate("QDeclarativeParser", "Illegal unicode escape sequence");
+ break;
+ }
}
setDone(Identifier);
break;
@@ -825,7 +861,11 @@ int Lexer::lex()
delimited = true;
return token;
case Identifier:
- if ((token = findReservedWord(buffer16, pos16)) < 0) {
+ token = -1;
+ if (! identifierWithEscapedUnicode)
+ token = findReservedWord(buffer16, pos16);
+
+ if (token < 0) {
/* TODO: close leak on parse error. same holds true for String */
if (driver)
qsyylval.ustr = driver->intern(buffer16, pos16);