Improve performance of the QML front-end
authorAaron Kennedy <aaron.kennedy@nokia.com>
Fri, 15 Jul 2011 07:46:43 +0000 (17:46 +1000)
committerQt by Nokia <qt-info@nokia.com>
Tue, 30 Aug 2011 11:18:28 +0000 (13:18 +0200)
Introduced a new lexer and a more efficient representation of
the AST. Instead of creating unique name ids, we simply use
QStringRef(s).

Change-Id: I403472fa2bb74d2c87dd6314065306499677a3bf
Authored-by: Roberto Raggi
Reviewed-on: http://codereview.qt.nokia.com/3750
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>

22 files changed:
src/declarative/qml/parser/parser.pri
src/declarative/qml/parser/qdeclarativejs.g
src/declarative/qml/parser/qdeclarativejsast_p.h
src/declarative/qml/parser/qdeclarativejsengine_p.cpp
src/declarative/qml/parser/qdeclarativejsengine_p.h
src/declarative/qml/parser/qdeclarativejsgrammar.cpp
src/declarative/qml/parser/qdeclarativejsgrammar_p.h
src/declarative/qml/parser/qdeclarativejskeywords_p.h [new file with mode: 0644]
src/declarative/qml/parser/qdeclarativejslexer.cpp
src/declarative/qml/parser/qdeclarativejslexer_p.h
src/declarative/qml/parser/qdeclarativejsparser.cpp
src/declarative/qml/parser/qdeclarativejsparser_p.h
src/declarative/qml/qdeclarativecompiler.cpp
src/declarative/qml/qdeclarativecompiler_p.h
src/declarative/qml/qdeclarativeparser.cpp
src/declarative/qml/qdeclarativeparser_p.h
src/declarative/qml/qdeclarativepropertycache.cpp
src/declarative/qml/qdeclarativepropertycache_p.h
src/declarative/qml/qdeclarativescriptparser.cpp
src/declarative/qml/v4/qdeclarativev4ir.cpp
src/declarative/qml/v4/qdeclarativev4ir_p.h
src/declarative/qml/v4/qdeclarativev4irbuilder.cpp

index fd4361c..74e870d 100644 (file)
@@ -10,7 +10,8 @@ HEADERS += \
     $$PWD/qdeclarativejsmemorypool_p.h \
     $$PWD/qdeclarativejsnodepool_p.h \
     $$PWD/qdeclarativejsparser_p.h \
-    $$PWD/qdeclarativejsglobal_p.h
+    $$PWD/qdeclarativejsglobal_p.h \
+    $$PWD/qdeclarativejskeywords_p.h
 
 SOURCES += \
     $$PWD/qdeclarativejsast.cpp \
index a57ecba..8a96ae5 100644 (file)
@@ -29,7 +29,7 @@
 
 %token T_AND "&"                T_AND_AND "&&"              T_AND_EQ "&="
 %token T_BREAK "break"          T_CASE "case"               T_CATCH "catch"
-%token T_COLON ":"              T_COMMA ";"                 T_CONTINUE "continue"
+%token T_COLON ":"              T_COMMA ","                 T_CONTINUE "continue"
 %token T_DEFAULT "default"      T_DELETE "delete"           T_DIVIDE_ "/"
 %token T_DIVIDE_EQ "/="         T_DO "do"                   T_DOT "."
 %token T_ELSE "else"            T_EQ "="                    T_EQ_EQ "=="
@@ -67,6 +67,8 @@
 %token T_AS "as"
 %token T_ON "on"
 
+%token T_ERROR
+
 --- feed tokens
 %token T_FEED_UI_PROGRAM
 %token T_FEED_UI_OBJECT_MEMBER
@@ -208,7 +210,6 @@ QT_QML_BEGIN_NAMESPACE
 namespace QDeclarativeJS {
 
 class Engine;
-class NameId;
 
 class QML_PARSER_EXPORT Parser: protected $table
 {
@@ -216,7 +217,6 @@ public:
     union Value {
       int ival;
       double dval;
-      NameId *sval;
       AST::ArgumentList *ArgumentList;
       AST::CaseBlock *CaseBlock;
       AST::CaseClause *CaseClause;
@@ -332,6 +332,9 @@ protected:
     inline Value &sym(int index)
     { return sym_stack [tos + index - 1]; }
 
+    inline QStringRef &stringRef(int index)
+    { return string_stack [tos + index - 1]; }
+
     inline AST::SourceLocation &loc(int index)
     { return location_stack [tos + index - 1]; }
 
@@ -344,6 +347,7 @@ protected:
     Value *sym_stack;
     int *state_stack;
     AST::SourceLocation *location_stack;
+    QStringRef *string_stack;
 
     AST::Node *program;
 
@@ -354,9 +358,11 @@ protected:
        int token;
        double dval;
        AST::SourceLocation loc;
+       QStringRef spell;
     };
 
     double yylval;
+    QStringRef yytokenspell;
     AST::SourceLocation yylloc;
     AST::SourceLocation yyprevlloc;
 
@@ -397,6 +403,7 @@ void Parser::reallocateStack()
     sym_stack = reinterpret_cast<Value*> (qRealloc(sym_stack, stack_size * sizeof(Value)));
     state_stack = reinterpret_cast<int*> (qRealloc(state_stack, stack_size * sizeof(int)));
     location_stack = reinterpret_cast<AST::SourceLocation*> (qRealloc(location_stack, stack_size * sizeof(AST::SourceLocation)));
+    string_stack = reinterpret_cast<QStringRef*> (qRealloc(string_stack, stack_size * sizeof(QStringRef)));
 }
 
 inline static bool automatic(Engine *driver, int token)
@@ -414,6 +421,7 @@ Parser::Parser(Engine *engine):
     sym_stack(0),
     state_stack(0),
     location_stack(0),
+    string_stack(0),
     first_token(0),
     last_token(0)
 {
@@ -425,6 +433,7 @@ Parser::~Parser()
         qFree(sym_stack);
         qFree(state_stack);
         qFree(location_stack);
+        qFree(string_stack);
     }
 }
 
@@ -433,14 +442,14 @@ static inline AST::SourceLocation location(Lexer *lexer)
     AST::SourceLocation loc;
     loc.offset = lexer->tokenOffset();
     loc.length = lexer->tokenLength();
-    loc.startLine = lexer->startLineNo();
-    loc.startColumn = lexer->startColumnNo();
+    loc.startLine = lexer->tokenStartLine();
+    loc.startColumn = lexer->tokenStartColumn();
     return loc;
 }
 
 AST::UiQualifiedId *Parser::reparseAsQualifiedId(AST::ExpressionNode *expr)
 {
-    QVarLengthArray<NameId *, 4> nameIds;
+    QVarLengthArray<QStringRef, 4> nameIds;
     QVarLengthArray<AST::SourceLocation, 4> locations;
 
     AST::ExpressionNode *it = expr;
@@ -492,11 +501,13 @@ bool Parser::parse(int startToken)
 
             if (first_token == last_token) {
                 yytoken = lexer->lex();
-                yylval = lexer->dval();
+                yylval = lexer->tokenValue();
+                yytokenspell = lexer->tokenSpell();
                 yylloc = location(lexer);
             } else {
                 yytoken = first_token->token;
                 yylval = first_token->dval;
+                yytokenspell = first_token->spell;
                 yylloc = first_token->loc;
                 ++first_token;
             }
@@ -507,6 +518,7 @@ bool Parser::parse(int startToken)
             if (action != ACCEPT_STATE) {
                 yytoken = -1;
                 sym(1).dval = yylval;
+                stringRef(1) = yytokenspell;
                 loc(1) = yylloc;
             } else {
               --tos;
@@ -628,7 +640,7 @@ case $rule_number: {
     sym(1).UiImport->versionToken = loc(2);
     sym(1).UiImport->asToken = loc(3);
     sym(1).UiImport->importIdToken = loc(4);
-    sym(1).UiImport->importId = sym(4).sval;
+    sym(1).UiImport->importId = stringRef(4);
     sym(1).UiImport->semicolonToken = loc(5);
 } break;
 ./
@@ -639,7 +651,7 @@ UiImport: UiImportHead T_AS JsIdentifier T_SEMICOLON ;
 case $rule_number: {
     sym(1).UiImport->asToken = loc(2);
     sym(1).UiImport->importIdToken = loc(3);
-    sym(1).UiImport->importId = sym(3).sval;
+    sym(1).UiImport->importId = stringRef(3);
     sym(1).UiImport->semicolonToken = loc(4);
 } break;
 ./
@@ -799,17 +811,7 @@ case $rule_number:
 ./
 
 UiPropertyType: T_VAR ;
-/.
-case $rule_number:
-./
 UiPropertyType: T_RESERVED_WORD ;
-/.
-case $rule_number: {
-    sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount());
-    break;
-}
-./
-
 UiPropertyType: T_IDENTIFIER ;
 
 UiParameterListOpt: ;
@@ -829,7 +831,7 @@ case $rule_number: {
 UiParameterList: UiPropertyType JsIdentifier ;
 /.
 case $rule_number: {
-  AST::UiParameterList *node = makeAstNode<AST::UiParameterList> (driver->nodePool(), sym(1).sval, sym(2).sval);
+  AST::UiParameterList *node = makeAstNode<AST::UiParameterList> (driver->nodePool(), stringRef(1), stringRef(2));
   node->identifierToken = loc(2);
   sym(1).Node = node;
 } break;
@@ -838,7 +840,7 @@ case $rule_number: {
 UiParameterList: UiParameterList T_COMMA UiPropertyType JsIdentifier ;
 /.
 case $rule_number: {
-  AST::UiParameterList *node = makeAstNode<AST::UiParameterList> (driver->nodePool(), sym(1).UiParameterList, sym(3).sval, sym(4).sval);
+  AST::UiParameterList *node = makeAstNode<AST::UiParameterList> (driver->nodePool(), sym(1).UiParameterList, stringRef(3), stringRef(4));
   node->commaToken = loc(2);
   node->identifierToken = loc(4);
   sym(1).Node = node;
@@ -849,7 +851,7 @@ UiObjectMember: T_SIGNAL T_IDENTIFIER T_LPAREN UiParameterListOpt T_RPAREN T_AUT
 UiObjectMember: T_SIGNAL T_IDENTIFIER T_LPAREN UiParameterListOpt T_RPAREN T_SEMICOLON ;
 /.
 case $rule_number: {
-    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), (NameId *)0, sym(2).sval);
+    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), QStringRef(), stringRef(2));
     node->type = AST::UiPublicMember::Signal;
     node->propertyToken = loc(1);
     node->typeToken = loc(2);
@@ -864,7 +866,7 @@ UiObjectMember: T_SIGNAL T_IDENTIFIER T_AUTOMATIC_SEMICOLON ;
 UiObjectMember: T_SIGNAL T_IDENTIFIER T_SEMICOLON ;
 /.
 case $rule_number: {
-    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), (NameId *)0, sym(2).sval);
+    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), QStringRef(), stringRef(2));
     node->type = AST::UiPublicMember::Signal;
     node->propertyToken = loc(1);
     node->typeToken = loc(2);
@@ -878,8 +880,8 @@ UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT JsIdentifier T_
 UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT JsIdentifier T_SEMICOLON ;
 /.
 case $rule_number: {
-    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(4).sval, sym(6).sval);
-    node->typeModifier = sym(2).sval;
+    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), stringRef(4), stringRef(6));
+    node->typeModifier = stringRef(2);
     node->propertyToken = loc(1);
     node->typeModifierToken = loc(2);
     node->typeToken = loc(4);
@@ -893,7 +895,7 @@ UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_AUTOMATIC_SEMICOLON ;
 UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_SEMICOLON ;
 /.
 case $rule_number: {
-    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval);
+    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), stringRef(2), stringRef(3));
     node->propertyToken = loc(1);
     node->typeToken = loc(2);
     node->identifierToken = loc(3);
@@ -906,7 +908,7 @@ UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_AUTOMATIC_SEM
 UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_SEMICOLON ;
 /.
 case $rule_number: {
-    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval);
+    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), stringRef(3), stringRef(4));
     node->isDefaultMember = true;
     node->defaultToken = loc(1);
     node->propertyToken = loc(2);
@@ -920,7 +922,7 @@ case $rule_number: {
 UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_COLON UiScriptStatement ;
 /.
 case $rule_number: {
-    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval,
+    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), stringRef(2), stringRef(3),
         sym(5).Statement);
     node->propertyToken = loc(1);
     node->typeToken = loc(2);
@@ -933,7 +935,7 @@ case $rule_number: {
 UiObjectMember: T_READONLY T_PROPERTY UiPropertyType JsIdentifier T_COLON UiScriptStatement ;
 /.
 case $rule_number: {
-    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval,
+    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), stringRef(3), stringRef(4),
         sym(6).Statement);
     node->isReadonlyMember = true;
     node->readonlyToken = loc(1);
@@ -948,7 +950,7 @@ case $rule_number: {
 UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_COLON UiScriptStatement ;
 /.
 case $rule_number: {
-    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval,
+    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), stringRef(3), stringRef(4),
         sym(6).Statement);
     node->isDefaultMember = true;
     node->defaultToken = loc(1);
@@ -963,15 +965,15 @@ case $rule_number: {
 UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT JsIdentifier T_COLON T_LBRACKET UiArrayMemberList T_RBRACKET ;
 /.
 case $rule_number: {
-    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(4).sval, sym(6).sval);
-    node->typeModifier = sym(2).sval;
+    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), stringRef(4), stringRef(6));
+    node->typeModifier = stringRef(2);
     node->propertyToken = loc(1);
     node->typeModifierToken = loc(2);
     node->typeToken = loc(4);
     node->identifierToken = loc(6);
     node->semicolonToken = loc(7); // insert a fake ';' before ':'
 
-    AST::UiQualifiedId *propertyName = makeAstNode<AST::UiQualifiedId>(driver->nodePool(), sym(6).sval);
+    AST::UiQualifiedId *propertyName = makeAstNode<AST::UiQualifiedId>(driver->nodePool(), stringRef(6));
     propertyName->identifierToken = loc(6);
     propertyName->next = 0;
 
@@ -990,13 +992,13 @@ case $rule_number: {
 UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_COLON UiQualifiedId UiObjectInitializer ;
 /.
 case $rule_number: {
-    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval);
+    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), stringRef(2), stringRef(3));
     node->propertyToken = loc(1);
     node->typeToken = loc(2);
     node->identifierToken = loc(3);
     node->semicolonToken = loc(4); // insert a fake ';' before ':'
 
-    AST::UiQualifiedId *propertyName = makeAstNode<AST::UiQualifiedId>(driver->nodePool(), sym(3).sval);
+    AST::UiQualifiedId *propertyName = makeAstNode<AST::UiQualifiedId>(driver->nodePool(), stringRef(3));
     propertyName->identifierToken = loc(3);
     propertyName->next = 0;
 
@@ -1027,40 +1029,9 @@ case $rule_number: {
 JsIdentifier: T_IDENTIFIER;
 
 JsIdentifier: T_PROPERTY ;
-/.
-case $rule_number: {
-    QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_PROPERTY]);
-    sym(1).sval = driver->intern(s.constData(), s.length());
-    break;
-}
-./
-
 JsIdentifier: T_SIGNAL ;
-/.
-case $rule_number: {
-    QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_SIGNAL]);
-    sym(1).sval = driver->intern(s.constData(), s.length());
-    break;
-}
-./
-
 JsIdentifier: T_READONLY ;
-/.
-case $rule_number: {
-    QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_READONLY]);
-    sym(1).sval = driver->intern(s.constData(), s.length());
-    break;
-}
-./
-
 JsIdentifier: T_ON ;
-/.
-case $rule_number: {
-    QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_ON]);
-    sym(1).sval = driver->intern(s.constData(), s.length());
-    break;
-}
-./
 
 --------------------------------------------------------------------------------------------------------
 -- Expressions
@@ -1078,7 +1049,7 @@ case $rule_number: {
 PrimaryExpression: JsIdentifier ;
 /.
 case $rule_number: {
-  AST::IdentifierExpression *node = makeAstNode<AST::IdentifierExpression> (driver->nodePool(), sym(1).sval);
+  AST::IdentifierExpression *node = makeAstNode<AST::IdentifierExpression> (driver->nodePool(), stringRef(1));
   node->identifierToken = loc(1);
   sym(1).Node = node;
 } break;
@@ -1126,7 +1097,7 @@ PrimaryExpression: T_MULTILINE_STRING_LITERAL ;
 PrimaryExpression: T_STRING_LITERAL ;
 /.
 case $rule_number: {
-  AST::StringLiteral *node = makeAstNode<AST::StringLiteral> (driver->nodePool(), sym(1).sval);
+  AST::StringLiteral *node = makeAstNode<AST::StringLiteral> (driver->nodePool(), stringRef(1));
   node->literalToken = loc(1);
   sym(1).Node = node;
 } break;
@@ -1146,7 +1117,8 @@ case $rule_number: {
 
   loc(1).length = lexer->tokenLength();
 
-  AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
+  AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(),
+    driver->newStringRef(lexer->regExpPattern()), lexer->regExpFlags());
   node->literalToken = loc(1);
   sym(1).Node = node;
 } break;
@@ -1166,7 +1138,8 @@ case $rule_number: {
 
   loc(1).length = lexer->tokenLength();
 
-  AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
+  AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(),
+    driver->newStringRef(lexer->regExpPattern()), lexer->regExpFlags());
   node->literalToken = loc(1);
   sym(1).Node = node;
 } break;
@@ -1368,7 +1341,7 @@ case $rule_number: {
 PropertyName: T_IDENTIFIER %prec SHIFT_THERE ;
 /.
 case $rule_number: {
-  AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval);
+  AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), stringRef(1));
   node->propertyNameToken = loc(1);
   sym(1).Node = node;
 } break;
@@ -1380,7 +1353,7 @@ PropertyName: T_SIGNAL ;
 PropertyName: T_PROPERTY ;
 /.
 case $rule_number: {
-  AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount()));
+  AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), stringRef(1));
   node->propertyNameToken = loc(1);
   sym(1).Node = node;
 } break;
@@ -1389,7 +1362,7 @@ case $rule_number: {
 PropertyName: T_STRING_LITERAL ;
 /.
 case $rule_number: {
-  AST::StringLiteralPropertyName *node = makeAstNode<AST::StringLiteralPropertyName> (driver->nodePool(), sym(1).sval);
+  AST::StringLiteralPropertyName *node = makeAstNode<AST::StringLiteralPropertyName> (driver->nodePool(), stringRef(1));
   node->propertyNameToken = loc(1);
   sym(1).Node = node;
 } break;
@@ -1407,139 +1380,43 @@ case $rule_number: {
 PropertyName: ReservedIdentifier ;
 /.
 case $rule_number: {
-  AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval);
+  AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), stringRef(1));
   node->propertyNameToken = loc(1);
   sym(1).Node = node;
 } break;
 ./
 
 ReservedIdentifier: T_BREAK ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_CASE ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_CATCH ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_CONTINUE ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_DEFAULT ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_DELETE ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_DO ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_ELSE ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_FALSE ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_FINALLY ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_FOR ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_FUNCTION ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_IF ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_IN ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_INSTANCEOF ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_NEW ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_NULL ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_RETURN ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_SWITCH ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_THIS ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_THROW ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_TRUE ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_TRY ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_TYPEOF ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_VAR ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_VOID ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_WHILE ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_CONST ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_DEBUGGER ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_RESERVED_WORD ;
-/.
-case $rule_number:
-./
 ReservedIdentifier: T_WITH ;
-/.
-case $rule_number:
-{
-  sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount());
-} break;
-./
 
 PropertyIdentifier: JsIdentifier ;
 PropertyIdentifier: ReservedIdentifier ;
@@ -1560,7 +1437,7 @@ case $rule_number: {
 MemberExpression: MemberExpression T_DOT PropertyIdentifier ;
 /.
 case $rule_number: {
-  AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval);
+  AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, stringRef(3));
   node->dotToken = loc(2);
   node->identifierToken = loc(3);
   sym(1).Node = node;
@@ -1622,7 +1499,7 @@ case $rule_number: {
 CallExpression: CallExpression T_DOT PropertyIdentifier ;
 /.
 case $rule_number: {
-  AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval);
+  AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, stringRef(3));
   node->dotToken = loc(2);
   node->identifierToken = loc(3);
   sym(1).Node = node;
@@ -2457,7 +2334,7 @@ case $rule_number: {
 VariableDeclaration: JsIdentifier InitialiserOpt ;
 /.
 case $rule_number: {
-  AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression);
+  AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), stringRef(1), sym(2).Expression);
   node->identifierToken = loc(1);
   sym(1).Node = node;
 } break;
@@ -2466,7 +2343,7 @@ case $rule_number: {
 VariableDeclarationNotIn: JsIdentifier InitialiserNotInOpt ;
 /.
 case $rule_number: {
-  AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression);
+  AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), stringRef(1), sym(2).Expression);
   node->identifierToken = loc(1);
   sym(1).Node = node;
 } break;
@@ -2646,7 +2523,7 @@ ContinueStatement: T_CONTINUE JsIdentifier T_AUTOMATIC_SEMICOLON ;  -- automatic
 ContinueStatement: T_CONTINUE JsIdentifier T_SEMICOLON ;
 /.
 case $rule_number: {
-  AST::ContinueStatement *node = makeAstNode<AST::ContinueStatement> (driver->nodePool(), sym(2).sval);
+  AST::ContinueStatement *node = makeAstNode<AST::ContinueStatement> (driver->nodePool(), stringRef(2));
   node->continueToken = loc(1);
   node->identifierToken = loc(2);
   node->semicolonToken = loc(3);
@@ -2658,7 +2535,7 @@ BreakStatement: T_BREAK T_AUTOMATIC_SEMICOLON ;  -- automatic semicolon
 BreakStatement: T_BREAK T_SEMICOLON ;
 /.
 case $rule_number: {
-  AST::BreakStatement *node = makeAstNode<AST::BreakStatement> (driver->nodePool());
+  AST::BreakStatement *node = makeAstNode<AST::BreakStatement> (driver->nodePool(), QStringRef());
   node->breakToken = loc(1);
   node->semicolonToken = loc(2);
   sym(1).Node = node;
@@ -2669,7 +2546,7 @@ BreakStatement: T_BREAK JsIdentifier T_AUTOMATIC_SEMICOLON ;  -- automatic semic
 BreakStatement: T_BREAK JsIdentifier T_SEMICOLON ;
 /.
 case $rule_number: {
-  AST::BreakStatement *node = makeAstNode<AST::BreakStatement> (driver->nodePool(), sym(2).sval);
+  AST::BreakStatement *node = makeAstNode<AST::BreakStatement> (driver->nodePool(), stringRef(2));
   node->breakToken = loc(1);
   node->identifierToken = loc(2);
   node->semicolonToken = loc(3);
@@ -2784,7 +2661,7 @@ LabelledStatement: T_SIGNAL T_COLON Statement ;
 LabelledStatement: T_PROPERTY T_COLON Statement ;
 /.
 case $rule_number: {
-  AST::LabelledStatement *node = makeAstNode<AST::LabelledStatement> (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount()), sym(3).Statement);
+  AST::LabelledStatement *node = makeAstNode<AST::LabelledStatement> (driver->nodePool(), stringRef(1), sym(3).Statement);
   node->identifierToken = loc(1);
   node->colonToken = loc(2);
   sym(1).Node = node;
@@ -2794,7 +2671,7 @@ case $rule_number: {
 LabelledStatement: T_IDENTIFIER T_COLON Statement ;
 /.
 case $rule_number: {
-  AST::LabelledStatement *node = makeAstNode<AST::LabelledStatement> (driver->nodePool(), sym(1).sval, sym(3).Statement);
+  AST::LabelledStatement *node = makeAstNode<AST::LabelledStatement> (driver->nodePool(), stringRef(1), sym(3).Statement);
   node->identifierToken = loc(1);
   node->colonToken = loc(2);
   sym(1).Node = node;
@@ -2842,7 +2719,7 @@ case $rule_number: {
 Catch: T_CATCH T_LPAREN JsIdentifier T_RPAREN Block ;
 /.
 case $rule_number: {
-  AST::Catch *node = makeAstNode<AST::Catch> (driver->nodePool(), sym(3).sval, sym(5).Block);
+  AST::Catch *node = makeAstNode<AST::Catch> (driver->nodePool(), stringRef(3), sym(5).Block);
   node->catchToken = loc(1);
   node->lparenToken = loc(2);
   node->identifierToken = loc(3);
@@ -2874,7 +2751,7 @@ case $rule_number: {
 FunctionDeclaration: T_FUNCTION JsIdentifier T_LPAREN FormalParameterListOpt T_RPAREN T_LBRACE FunctionBodyOpt T_RBRACE ;
 /.
 case $rule_number: {
-  AST::FunctionDeclaration *node = makeAstNode<AST::FunctionDeclaration> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody);
+  AST::FunctionDeclaration *node = makeAstNode<AST::FunctionDeclaration> (driver->nodePool(), stringRef(2), sym(4).FormalParameterList, sym(7).FunctionBody);
   node->functionToken = loc(1);
   node->identifierToken = loc(2);
   node->lparenToken = loc(3);
@@ -2888,9 +2765,9 @@ case $rule_number: {
 FunctionExpression: T_FUNCTION IdentifierOpt T_LPAREN FormalParameterListOpt T_RPAREN T_LBRACE FunctionBodyOpt T_RBRACE ;
 /.
 case $rule_number: {
-  AST::FunctionExpression *node = makeAstNode<AST::FunctionExpression> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody);
+  AST::FunctionExpression *node = makeAstNode<AST::FunctionExpression> (driver->nodePool(), stringRef(2), sym(4).FormalParameterList, sym(7).FunctionBody);
   node->functionToken = loc(1);
-  if (sym(2).sval)
+  if (! stringRef(2).isNull())
       node->identifierToken = loc(2);
   node->lparenToken = loc(3);
   node->rparenToken = loc(5);
@@ -2903,7 +2780,7 @@ case $rule_number: {
 FormalParameterList: JsIdentifier ;
 /.
 case $rule_number: {
-  AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), sym(1).sval);
+  AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), stringRef(1));
   node->identifierToken = loc(1);
   sym(1).Node = node;
 } break;
@@ -2912,7 +2789,7 @@ case $rule_number: {
 FormalParameterList: FormalParameterList T_COMMA JsIdentifier ;
 /.
 case $rule_number: {
-  AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), sym(1).FormalParameterList, sym(3).sval);
+  AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), sym(1).FormalParameterList, stringRef(3));
   node->commaToken = loc(2);
   node->identifierToken = loc(3);
   sym(1).Node = node;
@@ -2987,7 +2864,7 @@ case $rule_number: {
 IdentifierOpt: ;
 /.
 case $rule_number: {
-  sym(1).sval = 0;
+  stringRef(1) = QStringRef();
 } break;
 ./
 
@@ -3016,6 +2893,7 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
             SavedToken &tk = token_buffer[0];
             tk.token = yytoken;
             tk.dval = yylval;
+            tk.spell = yytokenspell;
             tk.loc = yylloc;
 
             yylloc = yyprevlloc;
@@ -3041,11 +2919,13 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
 
         token_buffer[0].token = yytoken;
         token_buffer[0].dval = yylval;
+        token_buffer[0].spell = yytokenspell;
         token_buffer[0].loc = yylloc;
 
-        token_buffer[1].token = yytoken = lexer->lex();
-        token_buffer[1].dval  = yylval  = lexer->dval();
-        token_buffer[1].loc   = yylloc  = location(lexer);
+        token_buffer[1].token = yytoken       = lexer->lex();
+        token_buffer[1].dval  = yylval        = lexer->tokenValue();
+        token_buffer[1].spell = yytokenspell  = lexer->tokenSpell();
+        token_buffer[1].loc   = yylloc        = location(lexer);
 
         if (t_action(errorState, yytoken)) {
             QString msg;
index 0fc989c..9794f38 100644 (file)
@@ -107,7 +107,7 @@ enum Op {
 } // namespace QSOperator
 
 namespace QDeclarativeJS {
-class NameId;
+
 namespace AST {
 
 template <typename _T1, typename _T2>
@@ -273,7 +273,7 @@ class QML_PARSER_EXPORT UiFormal: public Node
 public:
     QDECLARATIVEJS_DECLARE_AST_NODE(UiFormal)
 
-    UiFormal(NameId *name, NameId *alias = 0)
+    UiFormal(const QStringRef &name, const QStringRef &alias)
       : name(name), alias(alias)
     { }
 
@@ -286,8 +286,8 @@ public:
     virtual void accept0(Visitor *visitor);
 
 // attributes
-    NameId *name;
-    NameId *alias;
+    QStringRef name;
+    QStringRef alias;
     SourceLocation identifierToken;
     SourceLocation asToken;
     SourceLocation aliasToken;
@@ -398,7 +398,7 @@ class QML_PARSER_EXPORT IdentifierExpression: public ExpressionNode
 public:
     QDECLARATIVEJS_DECLARE_AST_NODE(IdentifierExpression)
 
-    IdentifierExpression(NameId *n):
+    IdentifierExpression(const QStringRef &n):
         name (n) { kind = K; }
 
     virtual void accept0(Visitor *visitor);
@@ -410,7 +410,7 @@ public:
     { return identifierToken; }
 
 // attributes
-    NameId *name;
+    QStringRef name;
     SourceLocation identifierToken;
 };
 
@@ -497,7 +497,7 @@ class QML_PARSER_EXPORT StringLiteral: public ExpressionNode
 public:
     QDECLARATIVEJS_DECLARE_AST_NODE(StringLiteral)
 
-    StringLiteral(NameId *v):
+    StringLiteral(const QStringRef &v):
         value (v) { kind = K; }
 
     virtual void accept0(Visitor *visitor);
@@ -509,7 +509,7 @@ public:
     { return literalToken; }
 
 // attributes:
-    NameId *value;
+    QStringRef value;
     SourceLocation literalToken;
 };
 
@@ -518,7 +518,7 @@ class QML_PARSER_EXPORT RegExpLiteral: public ExpressionNode
 public:
     QDECLARATIVEJS_DECLARE_AST_NODE(RegExpLiteral)
 
-    RegExpLiteral(NameId *p, int f):
+    RegExpLiteral(const QStringRef &p, int f):
         pattern (p), flags (f) { kind = K; }
 
     virtual void accept0(Visitor *visitor);
@@ -530,7 +530,7 @@ public:
     { return literalToken; }
 
 // attributes:
-    NameId *pattern;
+    QStringRef pattern;
     int flags;
     SourceLocation literalToken;
 };
@@ -705,13 +705,13 @@ class QML_PARSER_EXPORT IdentifierPropertyName: public PropertyName
 public:
     QDECLARATIVEJS_DECLARE_AST_NODE(IdentifierPropertyName)
 
-    IdentifierPropertyName(NameId *n):
+    IdentifierPropertyName(const QStringRef &n):
         id (n) { kind = K; }
 
     virtual void accept0(Visitor *visitor);
 
 // attributes
-    NameId *id;
+    QStringRef id;
 };
 
 class QML_PARSER_EXPORT StringLiteralPropertyName: public PropertyName
@@ -719,13 +719,13 @@ class QML_PARSER_EXPORT StringLiteralPropertyName: public PropertyName
 public:
     QDECLARATIVEJS_DECLARE_AST_NODE(StringLiteralPropertyName)
 
-    StringLiteralPropertyName(NameId *n):
+    StringLiteralPropertyName(const QStringRef &n):
         id (n) { kind = K; }
 
     virtual void accept0(Visitor *visitor);
 
 // attributes
-    NameId *id;
+    QStringRef id;
 };
 
 class QML_PARSER_EXPORT NumericLiteralPropertyName: public PropertyName
@@ -771,7 +771,7 @@ class QML_PARSER_EXPORT FieldMemberExpression: public ExpressionNode
 public:
     QDECLARATIVEJS_DECLARE_AST_NODE(FieldMemberExpression)
 
-    FieldMemberExpression(ExpressionNode *b, NameId *n):
+    FieldMemberExpression(ExpressionNode *b, const QStringRef &n):
         base (b), name (n)
         { kind = K; }
 
@@ -785,7 +785,7 @@ public:
 
     // attributes
     ExpressionNode *base;
-    NameId *name;
+    QStringRef name;
     SourceLocation dotToken;
     SourceLocation identifierToken;
 };
@@ -1277,14 +1277,14 @@ class QML_PARSER_EXPORT VariableDeclaration: public Node
 public:
     QDECLARATIVEJS_DECLARE_AST_NODE(VariableDeclaration)
 
-    VariableDeclaration(NameId *n, ExpressionNode *e):
+    VariableDeclaration(const QStringRef &n, ExpressionNode *e):
         name (n), expression (e), readOnly(false)
         { kind = K; }
 
     virtual void accept0(Visitor *visitor);
 
 // attributes
-    NameId *name;
+    QStringRef name;
     ExpressionNode *expression;
     bool readOnly;
     SourceLocation identifierToken;
@@ -1570,7 +1570,7 @@ class QML_PARSER_EXPORT ContinueStatement: public Statement
 public:
     QDECLARATIVEJS_DECLARE_AST_NODE(ContinueStatement)
 
-    ContinueStatement(NameId *l = 0):
+    ContinueStatement(const QStringRef &l = QStringRef()):
         label (l) { kind = K; }
 
     virtual void accept0(Visitor *visitor);
@@ -1582,7 +1582,7 @@ public:
     { return semicolonToken; }
 
 // attributes
-    NameId *label;
+    QStringRef label;
     SourceLocation continueToken;
     SourceLocation identifierToken;
     SourceLocation semicolonToken;
@@ -1593,7 +1593,7 @@ class QML_PARSER_EXPORT BreakStatement: public Statement
 public:
     QDECLARATIVEJS_DECLARE_AST_NODE(BreakStatement)
 
-    BreakStatement(NameId *l = 0):
+    BreakStatement(const QStringRef &l):
         label (l) { kind = K; }
 
     virtual void accept0(Visitor *visitor);
@@ -1605,7 +1605,7 @@ public:
     { return semicolonToken; }
 
     // attributes
-    NameId *label;
+    QStringRef label;
     SourceLocation breakToken;
     SourceLocation identifierToken;
     SourceLocation semicolonToken;
@@ -1773,7 +1773,7 @@ class QML_PARSER_EXPORT LabelledStatement: public Statement
 public:
     QDECLARATIVEJS_DECLARE_AST_NODE(LabelledStatement)
 
-    LabelledStatement(NameId *l, Statement *stmt):
+    LabelledStatement(const QStringRef &l, Statement *stmt):
         label (l), statement (stmt)
         { kind = K; }
 
@@ -1786,7 +1786,7 @@ public:
     { return statement->lastSourceLocation(); }
 
 // attributes
-    NameId *label;
+    QStringRef label;
     Statement *statement;
     SourceLocation identifierToken;
     SourceLocation colonToken;
@@ -1819,14 +1819,14 @@ class QML_PARSER_EXPORT Catch: public Node
 public:
     QDECLARATIVEJS_DECLARE_AST_NODE(Catch)
 
-    Catch(NameId *n, Block *stmt):
+    Catch(const QStringRef &n, Block *stmt):
         name (n), statement (stmt)
         { kind = K; }
 
     virtual void accept0(Visitor *visitor);
 
 // attributes
-    NameId *name;
+    QStringRef name;
     Block *statement;
     SourceLocation catchToken;
     SourceLocation lparenToken;
@@ -1894,7 +1894,7 @@ class QML_PARSER_EXPORT FunctionExpression: public ExpressionNode
 public:
     QDECLARATIVEJS_DECLARE_AST_NODE(FunctionExpression)
 
-    FunctionExpression(NameId *n, FormalParameterList *f, FunctionBody *b):
+    FunctionExpression(const QStringRef &n, FormalParameterList *f, FunctionBody *b):
         name (n), formals (f), body (b)
         { kind = K; }
 
@@ -1907,7 +1907,7 @@ public:
     { return rbraceToken; }
 
 // attributes
-    NameId *name;
+    QStringRef name;
     FormalParameterList *formals;
     FunctionBody *body;
     SourceLocation functionToken;
@@ -1923,7 +1923,7 @@ class QML_PARSER_EXPORT FunctionDeclaration: public FunctionExpression
 public:
     QDECLARATIVEJS_DECLARE_AST_NODE(FunctionDeclaration)
 
-    FunctionDeclaration(NameId *n, FormalParameterList *f, FunctionBody *b):
+    FunctionDeclaration(const QStringRef &n, FormalParameterList *f, FunctionBody *b):
         FunctionExpression(n, f, b)
         { kind = K; }
 
@@ -1935,11 +1935,11 @@ class QML_PARSER_EXPORT FormalParameterList: public Node
 public:
     QDECLARATIVEJS_DECLARE_AST_NODE(FormalParameterList)
 
-    FormalParameterList(NameId *n):
+    FormalParameterList(const QStringRef &n):
         name (n), next (this)
         { kind = K; }
 
-    FormalParameterList(FormalParameterList *previous, NameId *n):
+    FormalParameterList(FormalParameterList *previous, const QStringRef &n):
         name (n)
     {
         kind = K;
@@ -1957,7 +1957,7 @@ public:
     }
 
 // attributes
-    NameId *name;
+    QStringRef name;
     FormalParameterList *next;
     SourceLocation commaToken;
     SourceLocation identifierToken;
@@ -2105,11 +2105,11 @@ class QML_PARSER_EXPORT UiQualifiedId: public Node
 public:
     QDECLARATIVEJS_DECLARE_AST_NODE(UiQualifiedId)
 
-    UiQualifiedId(NameId *name)
+    UiQualifiedId(const QStringRef &name)
         : next(this), name(name)
     { kind = K; }
 
-    UiQualifiedId(UiQualifiedId *previous, NameId *name)
+    UiQualifiedId(UiQualifiedId *previous, const QStringRef &name)
         : name(name)
     {
         kind = K;
@@ -2128,7 +2128,7 @@ public:
 
 // attributes
     UiQualifiedId *next;
-    NameId *name;
+    QStringRef name;
     SourceLocation identifierToken;
 };
 
@@ -2137,7 +2137,7 @@ class QML_PARSER_EXPORT UiImport: public Node
 public:
     QDECLARATIVEJS_DECLARE_AST_NODE(UiImport)
 
-    UiImport(NameId *fileName)
+    UiImport(const QStringRef &fileName)
         : fileName(fileName), importUri(0), importId(0)
     { kind = K; }
 
@@ -2154,9 +2154,9 @@ public:
     virtual void accept0(Visitor *visitor);
 
 // attributes
-    NameId *fileName;
+    QStringRef fileName;
     UiQualifiedId *importUri;
-    NameId *importId;
+    QStringRef importId;
     SourceLocation importToken;
     SourceLocation fileNameToken;
     SourceLocation versionToken;
@@ -2306,11 +2306,11 @@ class QML_PARSER_EXPORT UiParameterList: public Node
 public:
     QDECLARATIVEJS_DECLARE_AST_NODE(UiParameterList)
 
-    UiParameterList(NameId *t, NameId *n):
+    UiParameterList(const QStringRef &t, const QStringRef &n):
         type (t), name (n), next (this)
         { kind = K; }
 
-    UiParameterList(UiParameterList *previous, NameId *t, NameId *n):
+    UiParameterList(UiParameterList *previous, const QStringRef &t, const QStringRef &n):
         type (t), name (n)
     {
         kind = K;
@@ -2328,8 +2328,8 @@ public:
     }
 
 // attributes
-    NameId *type;
-    NameId *name;
+    QStringRef type;
+    QStringRef name;
     UiParameterList *next;
     SourceLocation commaToken;
     SourceLocation identifierToken;
@@ -2340,13 +2340,13 @@ class QML_PARSER_EXPORT UiPublicMember: public UiObjectMember
 public:
     QDECLARATIVEJS_DECLARE_AST_NODE(UiPublicMember)
 
-    UiPublicMember(NameId *memberType,
-                   NameId *name)
+    UiPublicMember(const QStringRef &memberType,
+                   const QStringRef &name)
         : type(Property), typeModifier(0), memberType(memberType), name(name), statement(0), binding(0), isDefaultMember(false), isReadonlyMember(false), parameters(0)
     { kind = K; }
 
-    UiPublicMember(NameId *memberType,
-                   NameId *name,
+    UiPublicMember(const QStringRef &memberType,
+                   const QStringRef &name,
                    Statement *statement)
         : type(Property), typeModifier(0), memberType(memberType), name(name), statement(statement), binding(0), isDefaultMember(false), isReadonlyMember(false), parameters(0)
     { kind = K; }
@@ -2375,9 +2375,9 @@ public:
 
 // attributes
     enum { Signal, Property } type;
-    NameId *typeModifier;
-    NameId *memberType;
-    NameId *name;
+    QStringRef typeModifier;
+    QStringRef memberType;
+    QStringRef name;
     Statement *statement; // initialized with a JS expression
     UiObjectMember *binding; // initialized with a QML object or array.
     bool isDefaultMember;
index a449f77..3db4a44 100644 (file)
 
 #include <qnumeric.h>
 #include <QHash>
+#include <QDebug>
 
 QT_QML_BEGIN_NAMESPACE
 
 namespace QDeclarativeJS {
 
-uint qHash(const QDeclarativeJS::NameId &id)
-{ return qHash(id.asString()); }
-
-QString numberToString(double value)
-{ return QString::number(value); }
-
-int Ecma::RegExp::flagFromChar(const QChar &ch)
-{
-    static QHash<QChar, int> flagsHash;
-    if (flagsHash.isEmpty()) {
-        flagsHash[QLatin1Char('g')] = Global;
-        flagsHash[QLatin1Char('i')] = IgnoreCase;
-        flagsHash[QLatin1Char('m')] = Multiline;
-    }
-    QHash<QChar, int>::const_iterator it;
-    it = flagsHash.constFind(ch);
-    if (it == flagsHash.constEnd())
-        return 0;
-    return it.value();
-}
-
-QString Ecma::RegExp::flagsToString(int flags)
-{
-    QString result;
-    if (flags & Global)
-        result += QLatin1Char('g');
-    if (flags & IgnoreCase)
-        result += QLatin1Char('i');
-    if (flags & Multiline)
-        result += QLatin1Char('m');
-    return result;
-}
-
 NodePool::NodePool(const QString &fileName, Engine *engine)
     : m_fileName(fileName), m_engine(engine)
 {
@@ -178,8 +146,8 @@ Engine::Engine()
 Engine::~Engine()
 { }
 
-QSet<NameId> Engine::literals() const
-{ return _literals; }
+void Engine::setCode(const QString &code)
+{ _code = code; }
 
 void Engine::addComment(int pos, int len, int line, int col)
 { if (len > 0) _comments.append(QDeclarativeJS::AST::SourceLocation(pos, len, line, col)); }
@@ -187,12 +155,6 @@ void Engine::addComment(int pos, int len, int line, int col)
 QList<QDeclarativeJS::AST::SourceLocation> Engine::comments() const
 { return _comments; }
 
-NameId *Engine::intern(const QChar *u, int s)
-{ return const_cast<NameId *>(&*_literals.insert(NameId(u, s))); }
-
-QString Engine::toString(NameId *id)
-{ return id->asString(); }
-
 Lexer *Engine::lexer() const
 { return _lexer; }
 
@@ -205,7 +167,18 @@ NodePool *Engine::nodePool() const
 void Engine::setNodePool(NodePool *nodePool)
 { _nodePool = nodePool; }
 
+QStringRef Engine::midRef(int position, int size)
+{ return _code.midRef(position, size); }
+
+QStringRef Engine::newStringRef(const QString &text)
+{
+    const int pos = _extraCode.length();
+    _extraCode += text;
+    return _extraCode.midRef(pos, text.length());
+}
 
+QStringRef Engine::newStringRef(const QChar *chars, int size)
+{ return newStringRef(QString(chars, size)); }
 
 } // end of namespace QDeclarativeJS
 
index fd07f3f..56c6be4 100644 (file)
 QT_QML_BEGIN_NAMESPACE
 
 namespace QDeclarativeJS {
-class QML_PARSER_EXPORT NameId
-{
-    QString _text;
-
-public:
-    NameId(const QChar *u, int s)
-        : _text(u, s)
-    { }
-
-    const QString &asString() const
-    { return _text; }
-
-    bool operator == (const NameId &other) const
-    { return _text == other._text; }
-
-    bool operator != (const NameId &other) const
-    { return _text != other._text; }
-
-    bool operator < (const NameId &other) const
-    { return _text < other._text; }
-};
-
-uint qHash(const QDeclarativeJS::NameId &id);
-
-} // end of namespace QDeclarativeJS
-
-namespace QDeclarativeJS {
 
 class Lexer;
 class NodePool;
 
-namespace Ecma {
-
-class QML_PARSER_EXPORT RegExp
-{
-public:
-    enum RegExpFlag {
-        Global     = 0x01,
-        IgnoreCase = 0x02,
-        Multiline  = 0x04
-    };
-
-public:
-    static int flagFromChar(const QChar &);
-    static QString flagsToString(int flags);
-};
-
-} // end of namespace Ecma
-
 class QML_PARSER_EXPORT DiagnosticMessage
 {
 public:
@@ -137,27 +92,29 @@ class QML_PARSER_EXPORT Engine
 {
     Lexer *_lexer;
     NodePool *_nodePool;
-    QSet<NameId> _literals;
-    QList<QDeclarativeJS::AST::SourceLocation> _comments;
+    QList<AST::SourceLocation> _comments;
+    QString _extraCode;
+    QString _code;
 
 public:
     Engine();
     ~Engine();
 
-    QSet<NameId> literals() const;
+    void setCode(const QString &code);
 
     void addComment(int pos, int len, int line, int col);
-    QList<QDeclarativeJS::AST::SourceLocation> comments() const;
-
-    NameId *intern(const QChar *u, int s);
-
-    static QString toString(NameId *id);
+    QList<AST::SourceLocation> comments() const;
 
     Lexer *lexer() const;
     void setLexer(Lexer *lexer);
 
     NodePool *nodePool() const;
     void setNodePool(NodePool *nodePool);
+
+    QStringRef midRef(int position, int size);
+
+    QStringRef newStringRef(const QString &s);
+    QStringRef newStringRef(const QChar *chars, int size);
 };
 
 } // end of namespace QDeclarativeJS
index 38bd46b..89c00c2 100644 (file)
@@ -45,7 +45,7 @@
 QT_BEGIN_NAMESPACE
 
 const char *const QDeclarativeJSGrammar::spell [] = {
-  "end of file", "&", "&&", "&=", "break", "case", "catch", ":", ";", "continue", 
+  "end of file", "&", "&&", "&=", "break", "case", "catch", ":", ",", "continue", 
   "default", "delete", "/", "/=", "do", ".", "else", "=", "==", "===", 
   "finally", "for", "function", ">=", ">", ">>", ">>=", ">>>", ">>>=", "identifier", 
   "if", "in", "instanceof", "{", "[", "<=", "(", "<", "<<", "<<=", 
@@ -55,44 +55,44 @@ const char *const QDeclarativeJSGrammar::spell [] = {
   "this", "throw", "~", "try", "typeof", "var", "void", "while", "with", "^", 
   "^=", "null", "true", "false", "const", "debugger", "reserved word", "multiline string literal", "comment", "public", 
   "import", "as", "on", 0, 0, 0, 0, 0, 0, 0, 
-  0};
+  0, 0};
 
 const short QDeclarativeJSGrammar::lhs [] = {
-  101, 101, 101, 101, 101, 101, 102, 108, 108, 111, 
-  111, 113, 112, 112, 112, 112, 112, 112, 112, 112, 
-  115, 110, 109, 118, 118, 119, 119, 120, 120, 117, 
-  106, 106, 106, 106, 122, 122, 122, 122, 106, 127, 
-  127, 127, 128, 128, 129, 129, 106, 106, 106, 106, 
-  106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 
-  106, 106, 106, 116, 116, 116, 116, 116, 132, 132, 
-  132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 
-  132, 132, 132, 132, 132, 132, 121, 134, 134, 134, 
-  134, 133, 133, 136, 136, 138, 138, 138, 138, 138, 
-  138, 139, 139, 139, 139, 139, 139, 139, 139, 139, 
-  139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 
-  139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 
-  139, 139, 140, 140, 114, 114, 114, 114, 114, 143, 
-  143, 144, 144, 144, 144, 142, 142, 145, 145, 146, 
-  146, 147, 147, 147, 148, 148, 148, 148, 148, 148, 
-  148, 148, 148, 148, 149, 149, 149, 149, 150, 150, 
-  150, 151, 151, 151, 151, 152, 152, 152, 152, 152, 
-  152, 152, 153, 153, 153, 153, 153, 153, 154, 154, 
-  154, 154, 154, 155, 155, 155, 155, 155, 156, 156, 
-  157, 157, 158, 158, 159, 159, 160, 160, 161, 161, 
-  162, 162, 163, 163, 164, 164, 165, 165, 166, 166, 
-  167, 167, 137, 137, 168, 168, 169, 169, 169, 169, 
-  169, 169, 169, 169, 169, 169, 169, 169, 104, 104, 
-  170, 170, 171, 171, 172, 172, 103, 103, 103, 103, 
-  103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 
-  103, 123, 184, 184, 183, 183, 131, 131, 185, 185, 
-  186, 186, 188, 188, 187, 189, 192, 190, 190, 193, 
-  191, 191, 124, 125, 125, 126, 126, 173, 173, 173, 
-  173, 173, 173, 173, 174, 174, 174, 174, 175, 175, 
-  175, 175, 176, 176, 177, 179, 194, 194, 197, 197, 
-  195, 195, 198, 196, 178, 178, 178, 180, 180, 181, 
-  181, 181, 199, 200, 182, 182, 130, 141, 204, 204, 
-  201, 201, 202, 202, 205, 107, 206, 206, 105, 105, 
-  203, 203, 135, 135, 207};
+  102, 102, 102, 102, 102, 102, 103, 109, 109, 112, 
+  112, 114, 113, 113, 113, 113, 113, 113, 113, 113, 
+  116, 111, 110, 119, 119, 120, 120, 121, 121, 118, 
+  107, 107, 107, 107, 123, 123, 123, 123, 107, 128, 
+  128, 128, 129, 129, 130, 130, 107, 107, 107, 107, 
+  107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 
+  107, 107, 107, 117, 117, 117, 117, 117, 133, 133, 
+  133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 
+  133, 133, 133, 133, 133, 133, 122, 135, 135, 135, 
+  135, 134, 134, 137, 137, 139, 139, 139, 139, 139, 
+  139, 140, 140, 140, 140, 140, 140, 140, 140, 140, 
+  140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 
+  140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 
+  140, 140, 141, 141, 115, 115, 115, 115, 115, 144, 
+  144, 145, 145, 145, 145, 143, 143, 146, 146, 147, 
+  147, 148, 148, 148, 149, 149, 149, 149, 149, 149, 
+  149, 149, 149, 149, 150, 150, 150, 150, 151, 151, 
+  151, 152, 152, 152, 152, 153, 153, 153, 153, 153, 
+  153, 153, 154, 154, 154, 154, 154, 154, 155, 155, 
+  155, 155, 155, 156, 156, 156, 156, 156, 157, 157, 
+  158, 158, 159, 159, 160, 160, 161, 161, 162, 162, 
+  163, 163, 164, 164, 165, 165, 166, 166, 167, 167, 
+  168, 168, 138, 138, 169, 169, 170, 170, 170, 170, 
+  170, 170, 170, 170, 170, 170, 170, 170, 105, 105, 
+  171, 171, 172, 172, 173, 173, 104, 104, 104, 104, 
+  104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 
+  104, 124, 185, 185, 184, 184, 132, 132, 186, 186, 
+  187, 187, 189, 189, 188, 190, 193, 191, 191, 194, 
+  192, 192, 125, 126, 126, 127, 127, 174, 174, 174, 
+  174, 174, 174, 174, 175, 175, 175, 175, 176, 176, 
+  176, 176, 177, 177, 178, 180, 195, 195, 198, 198, 
+  196, 196, 199, 197, 179, 179, 179, 181, 181, 182, 
+  182, 182, 200, 201, 183, 183, 131, 142, 205, 205, 
+  202, 202, 203, 203, 206, 108, 207, 207, 106, 106, 
+  204, 204, 136, 136, 208};
 
 const short QDeclarativeJSGrammar::rhs [] = {
   2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 
@@ -212,71 +212,71 @@ const short QDeclarativeJSGrammar::goto_default [] = {
   185, 199, 181, 184, 198, 206, 0};
 
 const short QDeclarativeJSGrammar::action_index [] = {
-  350, 1271, 2492, 2492, 2395, 999, 52, 93, 137, -101, 
-  104, 72, 66, 177, -101, 285, 80, -101, -101, 641, 
-  71, 130, 167, 178, -101, -101, -101, 431, 321, 1271, 
-  -101, -101, -101, 393, -101, 2201, 2007, 1271, 1271, 1271, 
-  -101, 811, 1271, -101, -101, -101, 1271, 1271, -101, -101, 
-  -101, -101, -101, 1271, -101, 1271, 1271, -101, 1271, 1271, 
-  87, 188, -101, -101, 1271, 1271, 1271, -101, -101, -101, 
-  179, 1271, 263, 1271, 1271, 1271, 1271, 456, 1271, 1271, 
-  1271, 1271, 1271, 1271, 321, 1271, 1271, 1271, 128, 114, 
-  120, 193, 181, 172, 321, 321, 446, 395, 405, 1271, 
-  -8, 1271, 76, 2104, 1271, 1271, -101, -101, -101, -101, 
-  -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, 
-  -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, 
-  -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, 
-  110, 1271, -101, -101, 68, 38, -101, 1271, -101, -101, 
-  1271, -101, -101, -101, -101, -101, -101, -101, -101, -101, 
-  -101, -101, -101, -101, 1271, 32, 1271, 1271, 85, 83, 
-  1271, -101, 2104, 1271, 1271, -101, 108, -101, 53, -101, 
-  -101, 64, -101, 393, 89, 62, -101, 297, -101, 63, 
-  2492, -101, -101, -101, -101, -101, 154, -101, -101, 47, 
-  -101, -101, -101, -101, -101, -101, 2492, -101, -101, 461, 
-  -101, 470, 74, 2395, 59, 393, 92, 67, 2686, 152, 
-  1271, -101, 65, 43, 1271, 41, -101, 39, 34, -101, 
-  -101, 393, -101, -101, -101, -101, -101, -101, 86, -101, 
-  -101, -101, -101, 90, -101, -101, -101, -101, -101, -101, 
-  -11, 50, 1271, 103, 82, -101, -101, 1455, -101, 84, 
-  44, 5, -101, 267, 70, 33, 575, 79, 69, 471, 
-  235, 393, 1271, 275, 1271, 1271, 1271, 1271, 305, 1271, 
-  1271, 1271, 1271, 1271, 229, 201, 225, 202, 321, 355, 
-  374, 380, 1271, 35, 1271, 81, 1271, -101, 641, 1271, 
-  -101, 1271, 61, 1, 1271, 29, 2395, -101, 1271, 133, 
-  2395, -101, 1271, 73, 1271, 1271, 99, 97, 1271, -101, 
-  51, 153, 60, -101, -101, 1271, -101, 393, 1271, -101, 
-  56, 1271, -25, 2395, -101, 1271, 129, 2395, -101, -35, 
-  309, -56, -31, 2492, -39, -101, 2395, -101, 1271, 245, 
-  2395, -5, 2395, -101, 6, 0, -33, -101, -101, 2395, 
-  -43, 543, 7, 488, 112, 1271, 2395, -1, -27, 453, 
-  8, -18, 630, 14, 16, -101, 1365, -101, 12, -19, 
-  3, 1271, 58, -30, 1271, -2, 1271, -29, -36, 1271, 
-  -101, 2298, 18, -101, -101, -101, -101, -101, -101, 1271, 
-  -101, -101, -101, -101, 223, -101, 1271, -10, -101, 2395, 
-  -101, 95, -101, -101, 2395, -101, 1271, 107, 20, -101, 
-  40, -101, 46, 100, 1271, -101, 55, 57, -101, 28, 
-  -101, 2395, -101, 118, 2395, -101, 161, -101, -101, 126, 
-  2395, 37, -101, -12, -4, -101, 393, -34, -6, -101, 
-  -101, -101, -101, 1271, 98, 2395, -101, 1271, 116, 2395, 
-  -101, 19, -101, 186, -101, -101, 1271, -101, -101, 303, 
-  -101, -101, -101, 119, 1638, -101, -101, 1821, -101, -101, 
-  1914, -101, -101, -101, -101, -101, -101, 123, -101, -101, 
-  -101, -101, -101, -101, -101, -101, 2492, -101, -101, -101, 
-  94, -26, 819, 158, -28, 4, -101, -101, 210, -101, 
-  203, -101, -101, -101, 393, 230, -101, 1545, -101, -101, 
-  -101, -101, -101, -101, 234, 2, 393, 232, 17, 393, 
-  163, -101, 10, -101, 908, 125, -101, 13, 908, -101, 
-  -101, 1090, -101, -101, -101, 1181, -101, -101, 214, -101, 
-  1545, -101, 262, 9, -101, -101, 180, 318, 30, 1545, 
-  -101, 238, -101, 236, -101, 26, -32, 315, 183, 288, 
-  -101, 77, -101, -101, -101, 1728, 908, 291, 2589, 2007, 
-  -3, -101, 443, 25, 497, 88, 1271, 2395, 24, 11, 
-  384, 36, 27, 702, 48, 49, -101, 1365, -101, 54, 
-  31, 45, 1271, 58, 15, 1271, 42, 1271, 23, 22, 
-  122, -101, -101, 21, -101, -101, 730, -101, 254, -70, 
-  908, -101, -101, 138, 393, -101, 143, -101, 134, -101, 
-  -101, 268, -101, -101, 124, -101, -101, -101, -101, -101, 
-  -101, 
+  360, 1286, 2520, 2520, 2422, 1011, 52, 96, 132, -102, 
+  104, 69, 66, 177, -102, 283, 80, -102, -102, 649, 
+  71, 120, 160, 169, -102, -102, -102, 444, 325, 1286, 
+  -102, -102, -102, 324, -102, 2226, 2030, 1286, 1286, 1286, 
+  -102, 801, 1286, -102, -102, -102, 1286, 1286, -102, -102, 
+  -102, -102, -102, 1286, -102, 1286, 1286, -102, 1286, 1286, 
+  87, 190, -102, -102, 1286, 1286, 1286, -102, -102, -102, 
+  187, 1286, 251, 1286, 1286, 1286, 1286, 471, 1286, 1286, 
+  1286, 1286, 1286, 1286, 325, 1286, 1286, 1286, 128, 113, 
+  127, 182, 168, 159, 325, 325, 454, 406, 416, 1286, 
+  -7, 1286, 76, 2128, 1286, 1286, -102, -102, -102, -102, 
+  -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, 
+  -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, 
+  -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, 
+  107, 1286, -102, -102, 68, 44, -102, 1286, -102, -102, 
+  1286, -102, -102, -102, -102, -102, -102, -102, -102, -102, 
+  -102, -102, -102, -102, 1286, 32, 1286, 1286, 88, 86, 
+  1286, -102, 2128, 1286, 1286, -102, 103, -102, 56, -102, 
+  -102, 65, -102, 398, 89, 63, -102, 274, -102, 62, 
+  2520, -102, -102, -102, -102, -102, 248, -102, -102, 47, 
+  -102, -102, -102, -102, -102, -102, 2520, -102, -102, 467, 
+  -102, 470, 73, 2422, 53, 398, 91, 67, 2716, 154, 
+  1286, -102, 64, 43, 1286, 41, -102, 39, 34, -102, 
+  -102, 398, -102, -102, -102, -102, -102, -102, 82, -102, 
+  -102, -102, -102, 90, -102, -102, -102, -102, -102, -102, 
+  -8, 51, 1286, 100, 77, -102, -102, 1472, -102, 84, 
+  38, 5, -102, 266, 70, 33, 555, 79, 74, 477, 
+  234, 320, 1286, 281, 1286, 1286, 1286, 1286, 311, 1286, 
+  1286, 1286, 1286, 1286, 230, 189, 213, 208, 325, 371, 
+  386, 396, 1286, 35, 1286, 81, 1286, -102, 649, 1286, 
+  -102, 1286, 60, 1, 1286, 31, 2422, -102, 1286, 140, 
+  2422, -102, 1286, 72, 1286, 1286, 97, 93, 1286, -102, 
+  50, 149, 61, -102, -102, 1286, -102, 310, 1286, -102, 
+  58, 1286, -25, 2422, -102, 1286, 125, 2422, -102, -35, 
+  292, -56, -31, 2520, -39, -102, 2422, -102, 1286, 141, 
+  2422, -5, 2422, -102, 6, 0, -33, -102, -102, 2422, 
+  -43, 550, 7, 478, 115, 1286, 2422, -1, -27, 451, 
+  8, -18, 627, 14, 16, -102, 1381, -102, 12, -19, 
+  3, 1286, 59, -30, 1286, -2, 1286, -29, -36, 1286, 
+  -102, 2324, 18, -102, -102, -102, -102, -102, -102, 1286, 
+  -102, -102, -102, -102, 203, -102, 1286, -10, -102, 2422, 
+  -102, 94, -102, -102, 2422, -102, 1286, 102, 20, -102, 
+  40, -102, 46, 99, 1286, -102, 55, 57, -102, 28, 
+  -102, 2422, -102, 114, 2422, -102, 161, -102, -102, 121, 
+  2422, 37, -102, -12, -4, -102, 398, -34, -6, -102, 
+  -102, -102, -102, 1286, 98, 2422, -102, 1286, 105, 2422, 
+  -102, 19, -102, 181, -102, -102, 1286, -102, -102, 288, 
+  -102, -102, -102, 110, 1657, -102, -102, 1842, -102, -102, 
+  1936, -102, -102, -102, -102, -102, -102, 122, -102, -102, 
+  -102, -102, -102, -102, -102, -102, 2520, -102, -102, -102, 
+  92, -26, 829, 142, -28, 4, -102, -102, 191, -102, 
+  202, -102, -102, -102, 398, 218, -102, 1563, -102, -102, 
+  -102, -102, -102, -102, 237, 2, 368, 207, 17, 398, 
+  205, -102, 10, -102, 919, 124, -102, 13, 919, -102, 
+  -102, 1103, -102, -102, -102, 1195, -102, -102, 214, -102, 
+  1563, -102, 271, 9, -102, -102, 174, 307, 30, 1563, 
+  -102, 228, -102, 212, -102, 26, -32, 301, 179, 265, 
+  -102, 75, -102, -102, -102, 1748, 919, 280, 2618, 2030, 
+  -3, -102, 459, 25, 486, 85, 1286, 2422, 24, 11, 
+  378, 36, 27, 711, 48, 49, -102, 1381, -102, 54, 
+  29, 45, 1286, 59, 15, 1286, 42, 1286, 23, 22, 
+  117, -102, -102, 21, -102, -102, 739, -102, 201, -70, 
+  919, -102, -102, 116, 398, -102, 143, -102, 129, -102, 
+  -102, 252, -102, -102, 126, -102, -102, -102, -102, -102, 
+  -102, 
 
   -107, 25, -75, 27, 30, 272, -107, -107, -107, -107, 
   -107, -107, -107, -107, -107, -107, -107, -107, -107, -42, 
@@ -351,252 +351,245 @@ const short QDeclarativeJSGrammar::action_info [] = {
   541, -110, -129, 561, 568, 333, 466, 559, 556, 527, 
   510, 529, 541, 346, 534, 424, 541, 257, 440, -126, 
   408, 424, -121, 420, 541, -118, -100, 444, 457, 453, 
-  424, -99, 304, 348, 431, -123, 251, 416, 325, 141, 
-  457, 101, 414, 164, 440, 453, 147, 71, 296, 416, 
-  99, 312, 272, 430, 294, 272, 252, 164, 141, 306, 
-  170, 335, 292, 640, 301, 257, 190, 187, 149, 346, 
-  183, 312, 236, 348, 318, 71, 141, 0, 0, 172, 
-  427, 141, 0, 179, 294, 141, 141, 331, 141, 314, 
-  99, 292, 189, 315, 141, 434, 141, 477, 173, 62, 
-  538, 141, 443, 538, 0, 249, 248, 141, 573, 572, 
-  63, 141, 616, 256, 255, 101, 444, 242, 241, 249, 
-  248, 247, 246, 172, 58, 428, 413, 412, 455, 409, 
-  58, 327, 141, 254, 177, 59, 142, 418, 58, 141, 
-  532, 59, 173, 249, 248, 478, 459, 58, 611, 59, 
-  166, 539, 172, 488, 167, 636, 635, 525, 59, 337, 
-  64, 64, 103, 310, 469, 630, 629, 85, 0, 86, 
-  64, 173, 0, 174, 633, 632, 85, 0, 86, 511, 
-  87, 104, 511, 105, 328, 235, 234, 575, 85, 87, 
-  86, 550, 438, 437, 533, 531, 85, 85, 86, 86, 
-  0, 87, 511, 513, 631, 65, 65, 517, 172, 87, 
-  87, 66, 66, 541, 512, 65, 0, 470, 468, 172, 
-  85, 66, 86, 141, 85, 513, 86, 173, 513, 406, 
-  85, 511, 86, 87, 0, 511, 512, 87, 173, 512, 
-  406, 0, 0, 87, 563, 551, 549, 172, 513, 0, 
-  0, 73, 74, 0, 0, 274, 275, 0, 0, 512, 
-  0, 518, 516, 274, 275, -87, 173, 34, 174, 564, 
-  562, 626, 576, 73, 74, 350, 172, 513, 75, 76, 
-  0, 513, 276, 277, 0, 627, 625, 34, 512, 0, 
-  276, 277, 512, 0, -87, 173, 34, 174, 279, 280, 
-  75, 76, 34, 0, 48, 50, 49, 281, 34, 0, 
-  282, 0, 283, 0, 34, 624, 85, 34, 86, 0, 
-  0, 0, 0, 0, 48, 50, 49, 0, 0, 87, 
-  45, 0, 0, 48, 50, 49, 0, 0, 0, 48, 
-  50, 49, 0, 0, 0, 48, 50, 49, 279, 280, 
-  45, 48, 50, 49, 48, 50, 49, 281, 0, 45, 
-  282, 0, 283, 0, 0, 45, 0, 279, 280, 0, 
-  0, 45, 0, 279, 280, 0, 281, 45, 0, 282, 
-  45, 283, 281, 34, 0, 282, 0, 283, 78, 79, 
-  -341, 0, 34, 0, 0, 0, 80, 81, 78, 79, 
-  82, 0, 83, 0, 0, 0, 80, 81, 0, 0, 
-  82, 0, 83, 6, 5, 4, 1, 3, 2, 0, 
-  48, 50, 49, 0, 78, 79, 0, 0, 0, 48, 
-  50, 49, 80, 81, 0, 0, 82, 0, 83, 78, 
-  79, 0, 34, 0, 0, 0, 45, 80, 81, 78, 
-  79, 82, 34, 83, 0, 45, 0, 80, 81, -341, 
-  34, 82, 0, 83, 279, 280, 0, 0, 0, 34, 
-  0, 0, 0, 281, 240, 239, 282, 0, 283, 48, 
-  50, 49, 0, 0, 0, 0, 0, 34, 0, 48, 
-  50, 49, 240, 239, 0, 0, 34, 48, 50, 49, 
-  0, 245, 244, 0, 0, 45, 48, 50, 49, 0, 
-  0, 0, 0, 0, 0, 45, 0, 0, 0, 245, 
-  244, 0, 0, 45, 48, 50, 49, 0, 245, 244, 
-  0, 0, 45, 48, 50, 49, 0, 0, 0, 0, 
-  0, 0, 34, 0, 0, 0, 0, 0, 151, 0, 
-  45, 0, 0, 0, 0, 0, 0, 0, 152, 45, 
-  0, 0, 153, 0, 0, 0, 0, 0, 0, 0, 
-  0, 154, 0, 155, 240, 239, 308, 0, 0, 48, 
-  50, 49, 0, 0, 156, 0, 157, 62, 0, 0, 
+  424, -99, 304, 348, 431, 416, -123, 325, 141, 251, 
+  457, 414, 101, 164, 440, 453, 147, 71, 296, 416, 
+  99, 312, 272, 430, 294, 272, 292, 252, 141, 257, 
+  164, 306, 335, 170, 301, 190, 640, 187, 346, 312, 
+  318, 183, 236, 348, 149, 71, 141, 172, 141, 427, 
+  141, 141, 0, 141, 294, 141, 179, 99, 477, 331, 
+  292, 434, 141, 189, 314, 538, 173, 443, 315, 62, 
+  141, 172, 538, 141, 249, 248, 573, 572, 256, 255, 
+  63, 444, 616, 242, 241, 101, 249, 248, 141, 141, 
+  173, 247, 246, 58, 428, 413, 412, 327, 455, 177, 
+  254, 409, 418, 142, 59, 459, 478, 58, 58, 141, 
+  166, 525, 58, 611, 167, 172, 249, 248, 59, 59, 
+  539, 64, 488, 59, 85, 337, 86, 636, 635, 469, 
+  630, 629, 103, 85, 173, 86, 174, 87, 575, 64, 
+  310, 350, 64, 511, 633, 632, 87, 85, 511, 86, 
+  328, 104, 532, 105, 85, 0, 86, 513, 172, 0, 
+  87, 550, 438, 437, 541, 517, 65, 87, 512, 0, 
+  0, 511, 66, 85, 631, 86, 511, 173, 85, 406, 
+  86, 511, 470, 468, 65, 0, 87, 65, 626, 513, 
+  66, 87, 172, 66, 513, 85, 141, 86, 0, 85, 
+  512, 86, 627, 625, 563, 512, 533, 531, 87, 73, 
+  74, 173, 87, 406, 0, 551, 549, 513, 0, 518, 
+  516, 34, 513, 576, 274, 275, 172, 513, 512, 564, 
+  562, 0, 624, 512, 34, 172, 75, 76, 512, 274, 
+  275, 73, 74, 34, -87, 173, 0, 174, 0, 235, 
+  234, 276, 277, -87, 173, 0, 174, 34, 48, 50, 
+  49, 34, 0, 0, 0, 0, 276, 277, 75, 76, 
+  34, 48, 50, 49, 279, 280, 34, 0, 0, 34, 
+  48, 50, 49, 281, 45, 0, 282, 0, 283, 34, 
+  85, 0, 86, 34, 48, 50, 49, 45, 48, 50, 
+  49, 0, 0, 87, 0, 0, 45, 48, 50, 49, 
+  0, 0, 0, 48, 50, 49, 48, 50, 49, 0, 
+  45, 0, 0, 0, 45, 0, 48, 50, 49, 0, 
+  48, 50, 49, 45, 279, 280, 0, 34, 0, 45, 
+  0, 0, 45, 281, 0, 0, 282, 34, 283, 279, 
+  280, 0, 45, 0, -341, 0, 45, 0, 281, 279, 
+  280, 282, 0, 283, 0, 0, 0, 34, 281, 78, 
+  79, 282, 0, 283, 48, 50, 49, 80, 81, 78, 
+  79, 82, 0, 83, 48, 50, 49, 80, 81, 0, 
+  0, 82, 0, 83, 6, 5, 4, 1, 3, 2, 
+  45, 0, 0, 0, 48, 50, 49, 78, 79, 0, 
+  45, 0, 0, 0, 0, 80, 81, 78, 79, 82, 
+  34, 83, 0, 0, 0, 80, 81, -341, 34, 82, 
+  45, 83, 0, 0, 78, 79, 34, 0, 0, 34, 
+  279, 280, 80, 81, 0, 0, 82, 34, 83, 281, 
+  0, 0, 282, 0, 283, 34, 0, 48, 50, 49, 
+  240, 239, 0, 0, 0, 48, 50, 49, 240, 239, 
+  0, 245, 244, 48, 50, 49, 48, 50, 49, 245, 
+  244, 0, 0, 45, 48, 50, 49, 245, 244, 0, 
+  0, 45, 48, 50, 49, 0, 0, 0, 151, 45, 
+  0, 0, 45, 0, 0, 0, 0, 0, 152, 0, 
+  45, 0, 153, 0, 0, 0, 0, 0, 45, 34, 
+  0, 154, 0, 155, 0, 0, 308, 0, 0, 0, 
+  0, 0, 0, 0, 156, 0, 157, 62, 0, 0, 
   0, 0, 0, 0, 158, 0, 0, 159, 63, 0, 
-  0, 0, 0, 160, 0, 45, 0, 0, 0, 161, 
-  0, 0, 30, 31, 151, 0, 0, 0, 0, 0, 
-  0, 0, 33, 0, 152, 162, 0, 0, 153, 34, 
-  0, 0, 0, 35, 36, 0, 37, 154, 0, 155, 
-  0, 0, 0, 41, 0, 0, 0, 44, 0, 0, 
-  156, 0, 157, 62, 0, 0, 0, 0, 0, 0, 
-  158, 0, 0, 159, 63, 51, 48, 50, 49, 160, 
-  52, 0, 0, 0, 0, 161, 0, 0, 0, 0, 
-  0, 43, 54, 32, 30, 31, 0, 40, 0, 0, 
-  0, 162, 45, 0, 33, 0, 0, 0, 0, 0, 
-  0, 34, 0, 0, 0, 35, 36, 0, 37, 0, 
-  0, 0, 30, 31, 0, 41, 0, 0, 0, 44, 
-  0, 0, 33, 0, 0, 0, 0, 0, 0, 34, 
-  0, 0, 0, 35, 36, 0, 37, 51, 48, 50, 
-  49, 0, 52, 502, 0, 0, 0, 44, 0, 0, 
-  0, 0, 0, 43, 54, 32, 0, 0, 0, 40, 
-  0, 0, 0, 0, 45, 51, 48, 50, 49, 0, 
-  52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
-  0, 43, 54, 32, 0, 0, 0, 40, 0, 0, 
-  0, 0, 45, 30, 31, 0, 0, 0, 0, 0, 
-  0, 30, 31, 33, 0, 0, 0, 0, 0, 0, 
-  34, 33, 0, 0, 35, 36, 0, 37, 34, 0, 
-  0, 0, 35, 36, 41, 37, 0, 0, 44, 0, 
-  0, 0, 502, 0, 0, 0, 44, 0, 0, 0, 
-  0, 0, 0, 0, 0, 0, 51, 48, 50, 49, 
-  0, 52, 0, 0, 51, 48, 50, 49, 0, 52, 
+  0, 240, 239, 160, 0, 0, 48, 50, 49, 161, 
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+  0, 0, 0, 0, 0, 162, 0, 0, 0, 30, 
+  31, 0, 45, 0, 0, 0, 0, 0, 0, 33, 
+  0, 0, 151, 0, 0, 0, 34, 0, 0, 0, 
+  35, 36, 152, 37, 0, 0, 153, 0, 0, 0, 
+  41, 0, 0, 0, 44, 154, 0, 155, 0, 0, 
+  0, 0, 0, 0, 0, 0, 0, 0, 156, 0, 
+  157, 62, 51, 48, 50, 49, 0, 52, 158, 0, 
+  0, 159, 63, 0, 0, 0, 0, 160, 43, 54, 
+  32, 0, 0, 161, 40, 0, 0, 0, 0, 45, 
+  0, 0, 0, 30, 31, 0, 0, 0, 0, 162, 
+  0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 
+  34, 0, 0, 0, 35, 36, 0, 37, 0, 0, 
+  0, 30, 31, 0, 41, 0, 0, 0, 44, 0, 
+  0, 33, 0, 0, 0, 0, 0, 0, 34, 0, 
+  0, 0, 35, 36, 0, 37, 51, 48, 50, 49, 
+  0, 52, 502, 0, 0, 0, 44, 0, 0, 0, 
   0, 0, 43, 54, 32, 0, 0, 0, 40, 0, 
-  43, 54, 32, 45, 0, 0, 40, 0, 0, 0, 
-  0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 
-  30, 31, 0, 0, 0, 0, 0, 0, 0, 0, 
-  33, 0, 0, 0, 0, 0, 0, 34, 0, 0, 
-  0, 35, 36, 0, 37, 0, 0, 0, 0, 0, 
-  0, 502, 0, 0, 0, 44, 0, 0, 0, 0, 
+  0, 0, 0, 45, 51, 48, 50, 49, 0, 52, 
+  0, 0, 0, 30, 31, 0, 0, 0, 0, 0, 
+  43, 54, 32, 33, 0, 0, 40, 0, 0, 0, 
+  34, 45, 0, 0, 35, 36, 0, 37, 0, 0, 
+  0, 30, 31, 0, 41, 0, 0, 0, 44, 0, 
+  0, 33, 0, 0, 0, 0, 0, 0, 34, 0, 
+  0, 0, 35, 36, 0, 37, 51, 48, 50, 49, 
+  0, 52, 502, 0, 0, 0, 44, 0, 0, 0, 
+  0, 0, 43, 54, 32, 0, 0, 0, 40, 0, 
+  0, 0, 0, 45, 51, 48, 50, 49, 0, 52, 
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
-  0, 0, 0, 51, 48, 50, 49, 0, 52, 0, 
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 
-  54, 32, 0, 0, 0, 40, 0, 0, 0, 0, 
-  45, 0, 0, 0, 0, 0, 0, 0, 0, 501, 
+  43, 54, 32, 0, 0, 0, 40, 0, 0, 0, 
+  0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 
   0, 30, 31, 0, 0, 0, 0, 0, 0, 0, 
-  0, 215, 0, 0, 0, 0, 0, 0, 34, 0, 
+  0, 33, 0, 0, 0, 0, 0, 0, 34, 0, 
   0, 0, 35, 36, 0, 37, 0, 0, 0, 0, 
   0, 0, 502, 0, 0, 0, 44, 0, 0, 0, 
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
-  0, 0, 0, 0, 51, 503, 505, 504, 0, 52, 
-  0, 0, 0, 0, 226, 0, 0, 0, 0, 0, 
-  43, 54, 32, 210, 0, 0, 40, 0, 0, 0, 
+  0, 0, 0, 0, 51, 48, 50, 49, 0, 52, 
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+  43, 54, 32, 0, 0, 0, 40, 0, 0, 0, 
   0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 
-  501, 0, 30, 31, 0, 0, 0, 0, 0, 0, 
-  0, 0, 215, 0, 0, 0, 0, 0, 0, 34, 
-  0, 0, 0, 35, 36, 0, 37, 0, 0, 0, 
-  0, 0, 0, 502, 0, 0, 0, 44, 0, 0, 
-  0, 0, 0, 0, 0, 543, 0, 0, 0, 0, 
-  0, 0, 0, 0, 0, 51, 503, 505, 504, 0, 
-  52, 0, 0, 0, 0, 226, 0, 0, 0, 0, 
-  0, 43, 54, 32, 210, 0, 0, 40, 0, 0, 
-  0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 
   0, 501, 0, 30, 31, 0, 0, 0, 0, 0, 
   0, 0, 0, 215, 0, 0, 0, 0, 0, 0, 
   34, 0, 0, 0, 35, 36, 0, 37, 0, 0, 
   0, 0, 0, 0, 502, 0, 0, 0, 44, 0, 
-  0, 0, 0, 0, 0, 0, 546, 0, 0, 0, 
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
   0, 0, 0, 0, 0, 0, 51, 503, 505, 504, 
   0, 52, 0, 0, 0, 0, 226, 0, 0, 0, 
   0, 0, 43, 54, 32, 210, 0, 0, 40, 0, 
   0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 
-  0, 0, 29, 30, 31, 0, 0, 0, 0, 0, 
-  0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 
-  34, 0, 0, 0, 35, 36, 0, 37, 0, 0, 
-  0, 38, 0, 39, 41, 42, 0, 0, 44, 0, 
-  0, 0, 46, 0, 47, 0, 0, 0, 0, 0, 
-  0, 0, 0, 0, 0, 0, 51, 48, 50, 49, 
-  0, 52, 0, 53, 0, 55, 0, 56, 0, 0, 
-  0, 0, 43, 54, 32, 0, 0, 0, 40, 0, 
-  0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 
-  0, 0, -119, 0, 0, 0, 29, 30, 31, 0, 
-  0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 
+  0, 0, 0, 501, 0, 30, 31, 0, 0, 0, 
+  0, 0, 0, 0, 0, 215, 0, 0, 0, 0, 
+  0, 0, 34, 0, 0, 0, 35, 36, 0, 37, 
+  0, 0, 0, 0, 0, 0, 502, 0, 0, 0, 
+  44, 0, 0, 0, 0, 0, 0, 0, 543, 0, 
+  0, 0, 0, 0, 0, 0, 0, 0, 51, 503, 
+  505, 504, 0, 52, 0, 0, 0, 0, 226, 0, 
+  0, 0, 0, 0, 43, 54, 32, 210, 0, 0, 
+  40, 0, 0, 0, 0, 45, 0, 0, 0, 0, 
+  0, 0, 0, 0, 0, 501, 0, 30, 31, 0, 
+  0, 0, 0, 0, 0, 0, 0, 215, 0, 0, 
   0, 0, 0, 0, 34, 0, 0, 0, 35, 36, 
-  0, 37, 0, 0, 0, 38, 0, 39, 41, 42, 
-  0, 0, 44, 0, 0, 0, 46, 0, 47, 0, 
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
-  51, 48, 50, 49, 0, 52, 0, 53, 0, 55, 
-  0, 56, 0, 0, 0, 0, 43, 54, 32, 0, 
+  0, 37, 0, 0, 0, 0, 0, 0, 502, 0, 
+  0, 0, 44, 0, 0, 0, 0, 0, 0, 0, 
+  546, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+  51, 503, 505, 504, 0, 52, 0, 0, 0, 0, 
+  226, 0, 0, 0, 0, 0, 43, 54, 32, 210, 
   0, 0, 40, 0, 0, 0, 0, 45, 0, 0, 
-  0, 0, 0, 0, 0, 0, 29, 30, 31, 0, 
-  0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 
-  0, 0, 0, 0, 34, 0, 0, 0, 35, 36, 
-  0, 37, 0, 0, 0, 38, 0, 39, 41, 42, 
-  0, 0, 44, 0, 0, 0, 46, 0, 47, 0, 
+  0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 
+  0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 
+  0, 0, 0, 0, 0, 34, 0, 0, 0, 35, 
+  36, 0, 37, 0, 0, 0, 38, 0, 39, 41, 
+  42, 0, 0, 44, 0, 0, 0, 46, 0, 47, 
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
-  51, 48, 50, 49, 0, 52, 0, 53, 0, 55, 
-  271, 56, 0, 0, 0, 0, 43, 54, 32, 0, 
-  0, 0, 40, 0, 0, 0, 0, 45, 0, 0, 
-  0, 0, 0, 0, 0, 0, 29, 30, 31, 0, 
-  0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 
-  0, 0, 0, 0, 34, 217, 0, 0, 218, 36, 
-  0, 37, 0, 0, 0, 38, 0, 39, 41, 42, 
-  0, 0, 44, 0, 0, 0, 46, 0, 47, 0, 
-  0, 0, 0, 0, 0, 0, 221, 0, 0, 0, 
-  51, 48, 50, 49, 0, 52, 0, 53, 0, 55, 
-  0, 56, 0, 0, 0, 0, 43, 54, 32, 0, 
-  0, 0, 40, 0, 0, 0, 0, 45, 0, 0, 
-  0, 0, 0, 0, 0, 0, 483, 0, 0, 29, 
-  30, 31, 0, 0, 0, 0, 0, 0, 0, 0, 
-  33, 0, 0, 0, 0, 0, 0, 34, 0, 0, 
-  0, 35, 36, 0, 37, 0, 0, 0, 38, 0, 
-  39, 41, 42, 0, 0, 44, 0, 0, 0, 46, 
-  0, 47, 0, 0, 486, 0, 0, 0, 0, 0, 
-  0, 0, 0, 51, 48, 50, 49, 0, 52, 0, 
-  53, 0, 55, 0, 56, 0, 0, 0, 0, 43, 
-  54, 32, 0, 0, 0, 40, 0, 0, 0, 0, 
-  45, 0, 0, 0, 0, 0, 0, 0, 0, 29, 
-  30, 31, 0, 0, 0, 0, 0, 0, 0, 0, 
-  33, 0, 0, 0, 0, 0, 0, 34, 217, 0, 
-  0, 578, 579, 0, 37, 0, 0, 0, 38, 0, 
-  39, 41, 42, 0, 0, 44, 0, 0, 0, 46, 
-  0, 47, 0, 0, 0, 0, 0, 0, 0, 221, 
-  0, 0, 0, 51, 48, 50, 49, 0, 52, 0, 
-  53, 0, 55, 0, 56, 0, 0, 0, 0, 43, 
-  54, 32, 0, 0, 0, 40, 0, 0, 0, 0, 
-  45, 0, 0, 0, 0, 0, 0, 0, 0, 475, 
+  0, 51, 48, 50, 49, 0, 52, 0, 53, 0, 
+  55, 0, 56, 0, 0, 0, 0, 43, 54, 32, 
+  0, 0, 0, 40, 0, 0, 0, 0, 45, 0, 
+  0, 0, 0, 0, 0, 0, 0, 0, -119, 0, 
   0, 0, 29, 30, 31, 0, 0, 0, 0, 0, 
   0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 
   34, 0, 0, 0, 35, 36, 0, 37, 0, 0, 
   0, 38, 0, 39, 41, 42, 0, 0, 44, 0, 
-  0, 0, 46, 0, 47, 0, 0, 481, 0, 0, 
+  0, 0, 46, 0, 47, 0, 0, 0, 0, 0, 
   0, 0, 0, 0, 0, 0, 51, 48, 50, 49, 
   0, 52, 0, 53, 0, 55, 0, 56, 0, 0, 
   0, 0, 43, 54, 32, 0, 0, 0, 40, 0, 
   0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 
-  0, 0, 483, 0, 0, 29, 30, 31, 0, 0, 
-  0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 
-  0, 0, 0, 34, 0, 0, 0, 35, 36, 0, 
-  37, 0, 0, 0, 38, 0, 39, 41, 42, 0, 
-  0, 44, 0, 0, 0, 46, 0, 47, 0, 0, 
-  484, 0, 0, 0, 0, 0, 0, 0, 0, 51, 
-  48, 50, 49, 0, 52, 0, 53, 0, 55, 0, 
-  56, 0, 0, 0, 0, 43, 54, 32, 0, 0, 
-  0, 40, 0, 0, 0, 0, 45, 0, 0, 0, 
-  0, 0, 0, 0, 0, 475, 0, 0, 29, 30, 
+  0, 0, 0, 29, 30, 31, 0, 0, 0, 0, 
+  0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 
+  0, 34, 0, 0, 0, 35, 36, 0, 37, 0, 
+  0, 0, 38, 0, 39, 41, 42, 0, 0, 44, 
+  0, 0, 0, 46, 0, 47, 0, 0, 0, 0, 
+  0, 0, 0, 0, 0, 0, 0, 51, 48, 50, 
+  49, 0, 52, 0, 53, 0, 55, 271, 56, 0, 
+  0, 0, 0, 43, 54, 32, 0, 0, 0, 40, 
+  0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 
+  0, 0, 0, 0, 29, 30, 31, 0, 0, 0, 
+  0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 
+  0, 0, 34, 217, 0, 0, 218, 36, 0, 37, 
+  0, 0, 0, 38, 0, 39, 41, 42, 0, 0, 
+  44, 0, 0, 0, 46, 0, 47, 0, 0, 0, 
+  0, 0, 0, 0, 221, 0, 0, 0, 51, 48, 
+  50, 49, 0, 52, 0, 53, 0, 55, 0, 56, 
+  0, 0, 0, 0, 43, 54, 32, 0, 0, 0, 
+  40, 0, 0, 0, 0, 45, 0, 0, 0, 0, 
+  0, 0, 0, 0, 0, 483, 0, 0, 29, 30, 
   31, 0, 0, 0, 0, 0, 0, 0, 0, 33, 
   0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 
   35, 36, 0, 37, 0, 0, 0, 38, 0, 39, 
   41, 42, 0, 0, 44, 0, 0, 0, 46, 0, 
-  47, 0, 0, 476, 0, 0, 0, 0, 0, 0, 
+  47, 0, 0, 486, 0, 0, 0, 0, 0, 0, 
   0, 0, 51, 48, 50, 49, 0, 52, 0, 53, 
   0, 55, 0, 56, 0, 0, 0, 0, 43, 54, 
   32, 0, 0, 0, 40, 0, 0, 0, 0, 45, 
-  0, 0, 0, 0, 0, 0, 0, 0, 109, 110, 
-  111, 0, 0, 113, 115, 116, 0, 0, 117, 0, 
-  118, 0, 0, 0, 120, 121, 122, 0, 0, 0, 
-  0, 0, 0, 34, 123, 124, 125, 0, 0, 0, 
-  0, 0, 0, 0, 0, 0, 0, 126, 0, 0, 
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
-  0, 0, 0, 129, 0, 0, 0, 0, 0, 0, 
-  48, 50, 49, 130, 131, 132, 0, 134, 135, 136, 
-  137, 138, 139, 0, 0, 127, 133, 119, 112, 114, 
-  128, 0, 0, 0, 0, 0, 45, 0, 0, 0, 
-  0, 0, 0, 0, 0, 109, 110, 111, 0, 0, 
-  113, 115, 116, 0, 0, 117, 0, 118, 0, 0, 
-  0, 120, 121, 122, 0, 0, 0, 0, 0, 0, 
-  393, 123, 124, 125, 0, 0, 0, 0, 0, 0, 
-  0, 0, 0, 0, 126, 0, 0, 0, 394, 0, 
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
-  129, 0, 0, 0, 0, 0, 398, 395, 397, 0, 
-  130, 131, 132, 0, 134, 135, 136, 137, 138, 139, 
-  0, 0, 127, 133, 119, 112, 114, 128, 0, 0, 
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 
+  30, 31, 0, 0, 0, 0, 0, 0, 0, 0, 
+  33, 0, 0, 0, 0, 0, 0, 34, 217, 0, 
+  0, 578, 579, 0, 37, 0, 0, 0, 38, 0, 
+  39, 41, 42, 0, 0, 44, 0, 0, 0, 46, 
+  0, 47, 0, 0, 0, 0, 0, 0, 0, 221, 
+  0, 0, 0, 51, 48, 50, 49, 0, 52, 0, 
+  53, 0, 55, 0, 56, 0, 0, 0, 0, 43, 
+  54, 32, 0, 0, 0, 40, 0, 0, 0, 0, 
+  45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+  475, 0, 0, 29, 30, 31, 0, 0, 0, 0, 
+  0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 
+  0, 34, 0, 0, 0, 35, 36, 0, 37, 0, 
+  0, 0, 38, 0, 39, 41, 42, 0, 0, 44, 
+  0, 0, 0, 46, 0, 47, 0, 0, 481, 0, 
+  0, 0, 0, 0, 0, 0, 0, 51, 48, 50, 
+  49, 0, 52, 0, 53, 0, 55, 0, 56, 0, 
+  0, 0, 0, 43, 54, 32, 0, 0, 0, 40, 
+  0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 
+  0, 0, 0, 0, 483, 0, 0, 29, 30, 31, 
+  0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 
+  0, 0, 0, 0, 0, 34, 0, 0, 0, 35, 
+  36, 0, 37, 0, 0, 0, 38, 0, 39, 41, 
+  42, 0, 0, 44, 0, 0, 0, 46, 0, 47, 
+  0, 0, 484, 0, 0, 0, 0, 0, 0, 0, 
+  0, 51, 48, 50, 49, 0, 52, 0, 53, 0, 
+  55, 0, 56, 0, 0, 0, 0, 43, 54, 32, 
+  0, 0, 0, 40, 0, 0, 0, 0, 45, 0, 
+  0, 0, 0, 0, 0, 0, 0, 0, 475, 0, 
+  0, 29, 30, 31, 0, 0, 0, 0, 0, 0, 
+  0, 0, 33, 0, 0, 0, 0, 0, 0, 34, 
+  0, 0, 0, 35, 36, 0, 37, 0, 0, 0, 
+  38, 0, 39, 41, 42, 0, 0, 44, 0, 0, 
+  0, 46, 0, 47, 0, 0, 476, 0, 0, 0, 
+  0, 0, 0, 0, 0, 51, 48, 50, 49, 0, 
+  52, 0, 53, 0, 55, 0, 56, 0, 0, 0, 
+  0, 43, 54, 32, 0, 0, 0, 40, 0, 0, 
+  0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 
   0, 0, 109, 110, 111, 0, 0, 113, 115, 116, 
   0, 0, 117, 0, 118, 0, 0, 0, 120, 121, 
-  122, 0, 0, 0, 0, 0, 0, 393, 123, 124, 
+  122, 0, 0, 0, 0, 0, 0, 34, 123, 124, 
   125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
-  0, 126, 0, 0, 0, 394, 0, 0, 0, 0, 
-  0, 0, 0, 396, 0, 0, 0, 129, 0, 0, 
-  0, 0, 0, 398, 395, 397, 0, 130, 131, 132, 
+  0, 126, 0, 0, 0, 0, 0, 0, 0, 0, 
+  0, 0, 0, 0, 0, 0, 0, 129, 0, 0, 
+  0, 0, 0, 0, 48, 50, 49, 130, 131, 132, 
   0, 134, 135, 136, 137, 138, 139, 0, 0, 127, 
   133, 119, 112, 114, 128, 0, 0, 0, 0, 0, 
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 209, 
-  0, 0, 0, 0, 211, 0, 29, 30, 31, 213, 
-  0, 0, 0, 0, 0, 0, 214, 33, 0, 0, 
-  0, 0, 0, 0, 216, 217, 0, 0, 218, 36, 
-  0, 37, 0, 0, 0, 38, 0, 39, 41, 42, 
-  0, 0, 44, 0, 0, 0, 46, 0, 47, 0, 
-  0, 0, 0, 0, 220, 0, 221, 0, 0, 0, 
-  51, 219, 222, 49, 223, 52, 224, 53, 225, 55, 
-  226, 56, 227, 228, 0, 0, 43, 54, 32, 210, 
-  212, 0, 40, 0, 0, 0, 0, 45, 0, 0, 
+  45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+  109, 110, 111, 0, 0, 113, 115, 116, 0, 0, 
+  117, 0, 118, 0, 0, 0, 120, 121, 122, 0, 
+  0, 0, 0, 0, 0, 393, 123, 124, 125, 0, 
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 
+  0, 0, 0, 394, 0, 0, 0, 0, 0, 0, 
+  0, 0, 0, 0, 0, 129, 0, 0, 0, 0, 
+  0, 398, 395, 397, 0, 130, 131, 132, 0, 134, 
+  135, 136, 137, 138, 139, 0, 0, 127, 133, 119, 
+  112, 114, 128, 0, 0, 0, 0, 0, 0, 0, 
+  0, 0, 0, 0, 0, 0, 0, 0, 109, 110, 
+  111, 0, 0, 113, 115, 116, 0, 0, 117, 0, 
+  118, 0, 0, 0, 120, 121, 122, 0, 0, 0, 
+  0, 0, 0, 393, 123, 124, 125, 0, 0, 0, 
+  0, 0, 0, 0, 0, 0, 0, 126, 0, 0, 
+  0, 394, 0, 0, 0, 0, 0, 0, 0, 396, 
+  0, 0, 0, 129, 0, 0, 0, 0, 0, 398, 
+  395, 397, 0, 130, 131, 132, 0, 134, 135, 136, 
+  137, 138, 139, 0, 0, 127, 133, 119, 112, 114, 
+  128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
   0, 0, 0, 0, 0, 0, 209, 0, 0, 0, 
   0, 211, 0, 29, 30, 31, 213, 0, 0, 0, 
-  0, 0, 0, 214, 215, 0, 0, 0, 0, 0, 
+  0, 0, 0, 214, 33, 0, 0, 0, 0, 0, 
   0, 216, 217, 0, 0, 218, 36, 0, 37, 0, 
   0, 0, 38, 0, 39, 41, 42, 0, 0, 44, 
   0, 0, 0, 46, 0, 47, 0, 0, 0, 0, 
@@ -604,16 +597,26 @@ const short QDeclarativeJSGrammar::action_info [] = {
   49, 223, 52, 224, 53, 225, 55, 226, 56, 227, 
   228, 0, 0, 43, 54, 32, 210, 212, 0, 40, 
   0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 
-  0, 0, 0, 582, 110, 111, 0, 0, 584, 115, 
-  586, 30, 31, 587, 0, 118, 0, 0, 0, 120, 
-  589, 590, 0, 0, 0, 0, 0, 0, 591, 592, 
-  124, 125, 218, 36, 0, 37, 0, 0, 0, 38, 
-  0, 39, 593, 42, 0, 0, 595, 0, 0, 0, 
-  46, 0, 47, 0, 0, 0, 0, 0, 597, 0, 
-  221, 0, 0, 0, 599, 596, 598, 49, 600, 601, 
-  602, 53, 604, 605, 606, 607, 608, 609, 0, 0, 
-  594, 603, 588, 583, 585, 128, 40, 0, 0, 0, 
-  0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 
+  0, 0, 0, 0, 209, 0, 0, 0, 0, 211, 
+  0, 29, 30, 31, 213, 0, 0, 0, 0, 0, 
+  0, 214, 215, 0, 0, 0, 0, 0, 0, 216, 
+  217, 0, 0, 218, 36, 0, 37, 0, 0, 0, 
+  38, 0, 39, 41, 42, 0, 0, 44, 0, 0, 
+  0, 46, 0, 47, 0, 0, 0, 0, 0, 220, 
+  0, 221, 0, 0, 0, 51, 219, 222, 49, 223, 
+  52, 224, 53, 225, 55, 226, 56, 227, 228, 0, 
+  0, 43, 54, 32, 210, 212, 0, 40, 0, 0, 
+  0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 
+  0, 0, 582, 110, 111, 0, 0, 584, 115, 586, 
+  30, 31, 587, 0, 118, 0, 0, 0, 120, 589, 
+  590, 0, 0, 0, 0, 0, 0, 591, 592, 124, 
+  125, 218, 36, 0, 37, 0, 0, 0, 38, 0, 
+  39, 593, 42, 0, 0, 595, 0, 0, 0, 46, 
+  0, 47, 0, 0, 0, 0, 0, 597, 0, 221, 
+  0, 0, 0, 599, 596, 598, 49, 600, 601, 602, 
+  53, 604, 605, 606, 607, 608, 609, 0, 0, 594, 
+  603, 588, 583, 585, 128, 40, 0, 0, 0, 0, 
+  45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
   361, 110, 111, 0, 0, 363, 115, 365, 30, 31, 
   366, 0, 118, 0, 0, 0, 120, 368, 369, 0, 
   0, 0, 0, 0, 0, 370, 371, 124, 125, 218, 
@@ -623,7 +626,7 @@ const short QDeclarativeJSGrammar::action_info [] = {
   0, 378, 375, 377, 49, 379, 380, 381, 53, 383, 
   384, 385, 386, 387, 388, 0, 0, 373, 382, 367, 
   362, 364, 128, 40, 0, 0, 0, 0, 45, 0, 
-  0, 0, 0, 0, 0, 0, 0, 
+  0, 0, 0, 0, 0, 0, 0, 0, 
 
   567, 169, 558, 570, 574, 515, 569, 557, 309, 548, 
   461, 528, 311, 530, 417, 555, 307, 188, 415, 358, 
@@ -681,201 +684,166 @@ const short QDeclarativeJSGrammar::action_check [] = {
   33, 7, 7, 29, 8, 60, 17, 7, 66, 37, 
   66, 24, 33, 7, 34, 5, 33, 36, 33, 7, 
   60, 5, 7, 33, 33, 7, 7, 20, 36, 36, 
-  5, 7, 61, 36, 7, 7, 77, 36, 17, 8, 
-  36, 79, 7, 2, 33, 36, 8, 1, 8, 36, 
-  48, 2, 1, 55, 79, 1, 36, 2, 8, 60, 
-  7, 31, 48, 0, 61, 36, 33, 8, 60, 7, 
-  36, 2, 55, 36, 7, 1, 8, -1, -1, 15, 
-  10, 8, -1, 60, 79, 8, 8, 61, 8, 50, 
-  48, 48, 60, 54, 8, 7, 8, 8, 34, 42, 
-  8, 8, 6, 8, -1, 61, 62, 8, 61, 62, 
-  53, 8, 90, 61, 62, 79, 20, 61, 62, 61, 
-  62, 61, 62, 15, 40, 55, 61, 62, 60, 7, 
-  40, 8, 8, 60, 56, 51, 56, 60, 40, 8, 
-  7, 51, 34, 61, 62, 56, 60, 40, 56, 51, 
-  50, 56, 15, 60, 54, 61, 62, 29, 51, 60, 
-  12, 12, 15, 60, 8, 61, 62, 25, -1, 27, 
-  12, 34, -1, 36, 61, 62, 25, -1, 27, 29, 
-  38, 34, 29, 36, 61, 61, 62, 7, 25, 38, 
-  27, 7, 61, 62, 61, 62, 25, 25, 27, 27, 
-  -1, 38, 29, 75, 91, 57, 57, 7, 15, 38, 
-  38, 63, 63, 33, 86, 57, -1, 61, 62, 15, 
-  25, 63, 27, 8, 25, 75, 27, 34, 75, 36, 
-  25, 29, 27, 38, -1, 29, 86, 38, 34, 86, 
-  36, -1, -1, 38, 36, 61, 62, 15, 75, -1, 
-  -1, 18, 19, -1, -1, 18, 19, -1, -1, 86, 
-  -1, 61, 62, 18, 19, 33, 34, 29, 36, 61, 
-  62, 47, 92, 18, 19, 60, 15, 75, 45, 46, 
-  -1, 75, 45, 46, -1, 61, 62, 29, 86, -1, 
-  45, 46, 86, -1, 33, 34, 29, 36, 23, 24, 
-  45, 46, 29, -1, 66, 67, 68, 32, 29, -1, 
-  35, -1, 37, -1, 29, 91, 25, 29, 27, -1, 
-  -1, -1, -1, -1, 66, 67, 68, -1, -1, 38, 
-  92, -1, -1, 66, 67, 68, -1, -1, -1, 66, 
-  67, 68, -1, -1, -1, 66, 67, 68, 23, 24, 
-  92, 66, 67, 68, 66, 67, 68, 32, -1, 92, 
-  35, -1, 37, -1, -1, 92, -1, 23, 24, -1, 
-  -1, 92, -1, 23, 24, -1, 32, 92, -1, 35, 
-  92, 37, 32, 29, -1, 35, -1, 37, 23, 24, 
-  36, -1, 29, -1, -1, -1, 31, 32, 23, 24, 
-  35, -1, 37, -1, -1, -1, 31, 32, -1, -1, 
-  35, -1, 37, 93, 94, 95, 96, 97, 98, -1, 
-  66, 67, 68, -1, 23, 24, -1, -1, -1, 66, 
-  67, 68, 31, 32, -1, -1, 35, -1, 37, 23, 
-  24, -1, 29, -1, -1, -1, 92, 31, 32, 23, 
-  24, 35, 29, 37, -1, 92, -1, 31, 32, 36, 
-  29, 35, -1, 37, 23, 24, -1, -1, -1, 29, 
-  -1, -1, -1, 32, 61, 62, 35, -1, 37, 66, 
-  67, 68, -1, -1, -1, -1, -1, 29, -1, 66, 
-  67, 68, 61, 62, -1, -1, 29, 66, 67, 68, 
-  -1, 61, 62, -1, -1, 92, 66, 67, 68, -1, 
-  -1, -1, -1, -1, -1, 92, -1, -1, -1, 61, 
-  62, -1, -1, 92, 66, 67, 68, -1, 61, 62, 
-  -1, -1, 92, 66, 67, 68, -1, -1, -1, -1, 
-  -1, -1, 29, -1, -1, -1, -1, -1, 3, -1, 
-  92, -1, -1, -1, -1, -1, -1, -1, 13, 92, 
-  -1, -1, 17, -1, -1, -1, -1, -1, -1, -1, 
-  -1, 26, -1, 28, 61, 62, 31, -1, -1, 66, 
-  67, 68, -1, -1, 39, -1, 41, 42, -1, -1, 
+  5, 7, 61, 36, 7, 36, 7, 17, 8, 77, 
+  36, 7, 79, 2, 33, 36, 8, 1, 8, 36, 
+  48, 2, 1, 55, 79, 1, 48, 36, 8, 36, 
+  2, 60, 31, 7, 61, 33, 0, 8, 7, 2, 
+  7, 36, 55, 36, 60, 1, 8, 15, 8, 10, 
+  8, 8, -1, 8, 79, 8, 60, 48, 8, 61, 
+  48, 7, 8, 60, 50, 8, 34, 6, 54, 42, 
+  8, 15, 8, 8, 61, 62, 61, 62, 61, 62, 
+  53, 20, 90, 61, 62, 79, 61, 62, 8, 8, 
+  34, 61, 62, 40, 55, 61, 62, 8, 60, 56, 
+  60, 7, 60, 56, 51, 60, 56, 40, 40, 8, 
+  50, 29, 40, 56, 54, 15, 61, 62, 51, 51, 
+  56, 12, 60, 51, 25, 60, 27, 61, 62, 8, 
+  61, 62, 15, 25, 34, 27, 36, 38, 7, 12, 
+  60, 60, 12, 29, 61, 62, 38, 25, 29, 27, 
+  61, 34, 7, 36, 25, -1, 27, 75, 15, -1, 
+  38, 7, 61, 62, 33, 7, 57, 38, 86, -1, 
+  -1, 29, 63, 25, 91, 27, 29, 34, 25, 36, 
+  27, 29, 61, 62, 57, -1, 38, 57, 47, 75, 
+  63, 38, 15, 63, 75, 25, 8, 27, -1, 25, 
+  86, 27, 61, 62, 36, 86, 61, 62, 38, 18, 
+  19, 34, 38, 36, -1, 61, 62, 75, -1, 61, 
+  62, 29, 75, 92, 18, 19, 15, 75, 86, 61, 
+  62, -1, 91, 86, 29, 15, 45, 46, 86, 18, 
+  19, 18, 19, 29, 33, 34, -1, 36, -1, 61, 
+  62, 45, 46, 33, 34, -1, 36, 29, 66, 67, 
+  68, 29, -1, -1, -1, -1, 45, 46, 45, 46, 
+  29, 66, 67, 68, 23, 24, 29, -1, -1, 29, 
+  66, 67, 68, 32, 92, -1, 35, -1, 37, 29, 
+  25, -1, 27, 29, 66, 67, 68, 92, 66, 67, 
+  68, -1, -1, 38, -1, -1, 92, 66, 67, 68, 
+  -1, -1, -1, 66, 67, 68, 66, 67, 68, -1, 
+  92, -1, -1, -1, 92, -1, 66, 67, 68, -1, 
+  66, 67, 68, 92, 23, 24, -1, 29, -1, 92, 
+  -1, -1, 92, 32, -1, -1, 35, 29, 37, 23, 
+  24, -1, 92, -1, 36, -1, 92, -1, 32, 23, 
+  24, 35, -1, 37, -1, -1, -1, 29, 32, 23, 
+  24, 35, -1, 37, 66, 67, 68, 31, 32, 23, 
+  24, 35, -1, 37, 66, 67, 68, 31, 32, -1, 
+  -1, 35, -1, 37, 94, 95, 96, 97, 98, 99, 
+  92, -1, -1, -1, 66, 67, 68, 23, 24, -1, 
+  92, -1, -1, -1, -1, 31, 32, 23, 24, 35, 
+  29, 37, -1, -1, -1, 31, 32, 36, 29, 35, 
+  92, 37, -1, -1, 23, 24, 29, -1, -1, 29, 
+  23, 24, 31, 32, -1, -1, 35, 29, 37, 32, 
+  -1, -1, 35, -1, 37, 29, -1, 66, 67, 68, 
+  61, 62, -1, -1, -1, 66, 67, 68, 61, 62, 
+  -1, 61, 62, 66, 67, 68, 66, 67, 68, 61, 
+  62, -1, -1, 92, 66, 67, 68, 61, 62, -1, 
+  -1, 92, 66, 67, 68, -1, -1, -1, 3, 92, 
+  -1, -1, 92, -1, -1, -1, -1, -1, 13, -1, 
+  92, -1, 17, -1, -1, -1, -1, -1, 92, 29, 
+  -1, 26, -1, 28, -1, -1, 31, -1, -1, -1, 
+  -1, -1, -1, -1, 39, -1, 41, 42, -1, -1, 
   -1, -1, -1, -1, 49, -1, -1, 52, 53, -1, 
-  -1, -1, -1, 58, -1, 92, -1, -1, -1, 64, 
-  -1, -1, 12, 13, 3, -1, -1, -1, -1, -1, 
-  -1, -1, 22, -1, 13, 80, -1, -1, 17, 29, 
-  -1, -1, -1, 33, 34, -1, 36, 26, -1, 28, 
-  -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, 
-  39, -1, 41, 42, -1, -1, -1, -1, -1, -1, 
-  49, -1, -1, 52, 53, 65, 66, 67, 68, 58, 
-  70, -1, -1, -1, -1, 64, -1, -1, -1, -1, 
-  -1, 81, 82, 83, 12, 13, -1, 87, -1, -1, 
-  -1, 80, 92, -1, 22, -1, -1, -1, -1, -1, 
-  -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, 
-  -1, -1, 12, 13, -1, 43, -1, -1, -1, 47, 
-  -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, 
-  -1, -1, -1, 33, 34, -1, 36, 65, 66, 67, 
-  68, -1, 70, 43, -1, -1, -1, 47, -1, -1, 
-  -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, 
-  -1, -1, -1, -1, 92, 65, 66, 67, 68, -1, 
-  70, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-  -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, 
-  -1, -1, 92, 12, 13, -1, -1, -1, -1, -1, 
-  -1, 12, 13, 22, -1, -1, -1, -1, -1, -1, 
-  29, 22, -1, -1, 33, 34, -1, 36, 29, -1, 
-  -1, -1, 33, 34, 43, 36, -1, -1, 47, -1, 
-  -1, -1, 43, -1, -1, -1, 47, -1, -1, -1, 
-  -1, -1, -1, -1, -1, -1, 65, 66, 67, 68, 
-  -1, 70, -1, -1, 65, 66, 67, 68, -1, 70, 
+  -1, 61, 62, 58, -1, -1, 66, 67, 68, 64, 
+  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+  -1, -1, -1, -1, -1, 80, -1, -1, -1, 12, 
+  13, -1, 92, -1, -1, -1, -1, -1, -1, 22, 
+  -1, -1, 3, -1, -1, -1, 29, -1, -1, -1, 
+  33, 34, 13, 36, -1, -1, 17, -1, -1, -1, 
+  43, -1, -1, -1, 47, 26, -1, 28, -1, -1, 
+  -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, 
+  41, 42, 65, 66, 67, 68, -1, 70, 49, -1, 
+  -1, 52, 53, -1, -1, -1, -1, 58, 81, 82, 
+  83, -1, -1, 64, 87, -1, -1, -1, -1, 92, 
+  -1, -1, -1, 12, 13, -1, -1, -1, -1, 80, 
+  -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 
+  29, -1, -1, -1, 33, 34, -1, 36, -1, -1, 
+  -1, 12, 13, -1, 43, -1, -1, -1, 47, -1, 
+  -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, 
+  -1, -1, 33, 34, -1, 36, 65, 66, 67, 68, 
+  -1, 70, 43, -1, -1, -1, 47, -1, -1, -1, 
   -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, 
-  81, 82, 83, 92, -1, -1, 87, -1, -1, -1, 
-  -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, 
-  12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 
-  22, -1, -1, -1, -1, -1, -1, 29, -1, -1, 
-  -1, 33, 34, -1, 36, -1, -1, -1, -1, -1, 
-  -1, 43, -1, -1, -1, 47, -1, -1, -1, -1, 
+  -1, -1, -1, 92, 65, 66, 67, 68, -1, 70, 
+  -1, -1, -1, 12, 13, -1, -1, -1, -1, -1, 
+  81, 82, 83, 22, -1, -1, 87, -1, -1, -1, 
+  29, 92, -1, -1, 33, 34, -1, 36, -1, -1, 
+  -1, 12, 13, -1, 43, -1, -1, -1, 47, -1, 
+  -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, 
+  -1, -1, 33, 34, -1, 36, 65, 66, 67, 68, 
+  -1, 70, 43, -1, -1, -1, 47, -1, -1, -1, 
+  -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, 
+  -1, -1, -1, 92, 65, 66, 67, 68, -1, 70, 
   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-  -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, 
-  -1, -1, -1, -1, -1, -1, -1, -1, -1, 81, 
-  82, 83, -1, -1, -1, 87, -1, -1, -1, -1, 
-  92, -1, -1, -1, -1, -1, -1, -1, -1, 10, 
+  81, 82, 83, -1, -1, -1, 87, -1, -1, -1, 
+  -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, 
   -1, 12, 13, -1, -1, -1, -1, -1, -1, -1, 
   -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, 
   -1, -1, 33, 34, -1, 36, -1, -1, -1, -1, 
   -1, -1, 43, -1, -1, -1, 47, -1, -1, -1, 
   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
   -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, 
-  -1, -1, -1, -1, 75, -1, -1, -1, -1, -1, 
-  81, 82, 83, 84, -1, -1, 87, -1, -1, -1, 
+  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+  81, 82, 83, -1, -1, -1, 87, -1, -1, -1, 
   -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, 
-  10, -1, 12, 13, -1, -1, -1, -1, -1, -1, 
-  -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, 
-  -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, 
-  -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, 
-  -1, -1, -1, -1, -1, 55, -1, -1, -1, -1, 
-  -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, 
-  70, -1, -1, -1, -1, 75, -1, -1, -1, -1, 
-  -1, 81, 82, 83, 84, -1, -1, 87, -1, -1, 
-  -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, 
   -1, 10, -1, 12, 13, -1, -1, -1, -1, -1, 
   -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 
   29, -1, -1, -1, 33, 34, -1, 36, -1, -1, 
   -1, -1, -1, -1, 43, -1, -1, -1, 47, -1, 
-  -1, -1, -1, -1, -1, -1, 55, -1, -1, -1, 
+  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
   -1, -1, -1, -1, -1, -1, 65, 66, 67, 68, 
   -1, 70, -1, -1, -1, -1, 75, -1, -1, -1, 
   -1, -1, 81, 82, 83, 84, -1, -1, 87, -1, 
   -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, 
-  -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, 
-  -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 
-  29, -1, -1, -1, 33, 34, -1, 36, -1, -1, 
-  -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, 
-  -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, 
-  -1, -1, -1, -1, -1, -1, 65, 66, 67, 68, 
-  -1, 70, -1, 72, -1, 74, -1, 76, -1, -1, 
-  -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, 
-  -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, 
-  -1, -1, 7, -1, -1, -1, 11, 12, 13, -1, 
+  -1, -1, -1, 10, -1, 12, 13, -1, -1, -1, 
+  -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, 
+  -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, 
+  -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, 
+  47, -1, -1, -1, -1, -1, -1, -1, 55, -1, 
+  -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, 
+  67, 68, -1, 70, -1, -1, -1, -1, 75, -1, 
+  -1, -1, -1, -1, 81, 82, 83, 84, -1, -1, 
+  87, -1, -1, -1, -1, 92, -1, -1, -1, -1, 
+  -1, -1, -1, -1, -1, 10, -1, 12, 13, -1, 
   -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, 
   -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, 
-  -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, 
-  -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, 
-  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-  65, 66, 67, 68, -1, 70, -1, 72, -1, 74, 
-  -1, 76, -1, -1, -1, -1, 81, 82, 83, -1, 
+  -1, 36, -1, -1, -1, -1, -1, -1, 43, -1, 
+  -1, -1, 47, -1, -1, -1, -1, -1, -1, -1, 
+  55, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+  65, 66, 67, 68, -1, 70, -1, -1, -1, -1, 
+  75, -1, -1, -1, -1, -1, 81, 82, 83, 84, 
   -1, -1, 87, -1, -1, -1, -1, 92, -1, -1, 
-  -1, -1, -1, -1, -1, -1, 11, 12, 13, -1, 
-  -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, 
-  -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, 
-  -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, 
-  -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, 
+  -1, -1, -1, -1, -1, -1, -1, 11, 12, 13, 
+  -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, 
+  -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 
+  34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 
+  44, -1, -1, 47, -1, -1, -1, 51, -1, 53, 
   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-  65, 66, 67, 68, -1, 70, -1, 72, -1, 74, 
-  75, 76, -1, -1, -1, -1, 81, 82, 83, -1, 
-  -1, -1, 87, -1, -1, -1, -1, 92, -1, -1, 
-  -1, -1, -1, -1, -1, -1, 11, 12, 13, -1, 
-  -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, 
-  -1, -1, -1, -1, 29, 30, -1, -1, 33, 34, 
-  -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, 
-  -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, 
-  -1, -1, -1, -1, -1, -1, 61, -1, -1, -1, 
-  65, 66, 67, 68, -1, 70, -1, 72, -1, 74, 
-  -1, 76, -1, -1, -1, -1, 81, 82, 83, -1, 
-  -1, -1, 87, -1, -1, -1, -1, 92, -1, -1, 
-  -1, -1, -1, -1, -1, -1, 8, -1, -1, 11, 
-  12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 
-  22, -1, -1, -1, -1, -1, -1, 29, -1, -1, 
-  -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, 
-  42, 43, 44, -1, -1, 47, -1, -1, -1, 51, 
-  -1, 53, -1, -1, 56, -1, -1, -1, -1, -1, 
-  -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, 
-  72, -1, 74, -1, 76, -1, -1, -1, -1, 81, 
-  82, 83, -1, -1, -1, 87, -1, -1, -1, -1, 
-  92, -1, -1, -1, -1, -1, -1, -1, -1, 11, 
-  12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 
-  22, -1, -1, -1, -1, -1, -1, 29, 30, -1, 
-  -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, 
-  42, 43, 44, -1, -1, 47, -1, -1, -1, 51, 
-  -1, 53, -1, -1, -1, -1, -1, -1, -1, 61, 
-  -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, 
-  72, -1, 74, -1, 76, -1, -1, -1, -1, 81, 
-  82, 83, -1, -1, -1, 87, -1, -1, -1, -1, 
-  92, -1, -1, -1, -1, -1, -1, -1, -1, 8, 
+  -1, 65, 66, 67, 68, -1, 70, -1, 72, -1, 
+  74, -1, 76, -1, -1, -1, -1, 81, 82, 83, 
+  -1, -1, -1, 87, -1, -1, -1, -1, 92, -1, 
+  -1, -1, -1, -1, -1, -1, -1, -1, 7, -1, 
   -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, 
   -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 
   29, -1, -1, -1, 33, 34, -1, 36, -1, -1, 
   -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, 
-  -1, -1, 51, -1, 53, -1, -1, 56, -1, -1, 
+  -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, 
   -1, -1, -1, -1, -1, -1, 65, 66, 67, 68, 
   -1, 70, -1, 72, -1, 74, -1, 76, -1, -1, 
   -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, 
   -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, 
-  -1, -1, 8, -1, -1, 11, 12, 13, -1, -1, 
-  -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, 
-  -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 
-  36, -1, -1, -1, 40, -1, 42, 43, 44, -1, 
-  -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, 
-  56, -1, -1, -1, -1, -1, -1, -1, -1, 65, 
-  66, 67, 68, -1, 70, -1, 72, -1, 74, -1, 
-  76, -1, -1, -1, -1, 81, 82, 83, -1, -1, 
-  -1, 87, -1, -1, -1, -1, 92, -1, -1, -1, 
+  -1, -1, -1, 11, 12, 13, -1, -1, -1, -1, 
+  -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, 
+  -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, 
+  -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, 
+  -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, 
+  -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, 
+  68, -1, 70, -1, 72, -1, 74, 75, 76, -1, 
+  -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, 
+  -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, 
+  -1, -1, -1, -1, 11, 12, 13, -1, -1, -1, 
+  -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, 
+  -1, -1, 29, 30, -1, -1, 33, 34, -1, 36, 
+  -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, 
+  47, -1, -1, -1, 51, -1, 53, -1, -1, -1, 
+  -1, -1, -1, -1, 61, -1, -1, -1, 65, 66, 
+  67, 68, -1, 70, -1, 72, -1, 74, -1, 76, 
+  -1, -1, -1, -1, 81, 82, 83, -1, -1, -1, 
+  87, -1, -1, -1, -1, 92, -1, -1, -1, -1, 
   -1, -1, -1, -1, -1, 8, -1, -1, 11, 12, 
   13, -1, -1, -1, -1, -1, -1, -1, -1, 22, 
   -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 
@@ -885,45 +853,73 @@ const short QDeclarativeJSGrammar::action_check [] = {
   -1, -1, 65, 66, 67, 68, -1, 70, -1, 72, 
   -1, 74, -1, 76, -1, -1, -1, -1, 81, 82, 
   83, -1, -1, -1, 87, -1, -1, -1, -1, 92, 
-  -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, 
-  6, -1, -1, 9, 10, 11, -1, -1, 14, -1, 
-  16, -1, -1, -1, 20, 21, 22, -1, -1, -1, 
-  -1, -1, -1, 29, 30, 31, 32, -1, -1, -1, 
-  -1, -1, -1, -1, -1, -1, -1, 43, -1, -1, 
-  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-  -1, -1, -1, 59, -1, -1, -1, -1, -1, -1, 
-  66, 67, 68, 69, 70, 71, -1, 73, 74, 75, 
-  76, 77, 78, -1, -1, 81, 82, 83, 84, 85, 
-  86, -1, -1, -1, -1, -1, 92, -1, -1, -1, 
-  -1, -1, -1, -1, -1, 4, 5, 6, -1, -1, 
-  9, 10, 11, -1, -1, 14, -1, 16, -1, -1, 
-  -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, 
-  29, 30, 31, 32, -1, -1, -1, -1, -1, -1, 
-  -1, -1, -1, -1, 43, -1, -1, -1, 47, -1, 
-  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-  59, -1, -1, -1, -1, -1, 65, 66, 67, -1, 
-  69, 70, 71, -1, 73, 74, 75, 76, 77, 78, 
-  -1, -1, 81, 82, 83, 84, 85, 86, -1, -1, 
-  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+  -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 
+  12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 
+  22, -1, -1, -1, -1, -1, -1, 29, 30, -1, 
+  -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, 
+  42, 43, 44, -1, -1, 47, -1, -1, -1, 51, 
+  -1, 53, -1, -1, -1, -1, -1, -1, -1, 61, 
+  -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, 
+  72, -1, 74, -1, 76, -1, -1, -1, -1, 81, 
+  82, 83, -1, -1, -1, 87, -1, -1, -1, -1, 
+  92, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+  8, -1, -1, 11, 12, 13, -1, -1, -1, -1, 
+  -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, 
+  -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, 
+  -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, 
+  -1, -1, -1, 51, -1, 53, -1, -1, 56, -1, 
+  -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, 
+  68, -1, 70, -1, 72, -1, 74, -1, 76, -1, 
+  -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, 
+  -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, 
+  -1, -1, -1, -1, 8, -1, -1, 11, 12, 13, 
+  -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, 
+  -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 
+  34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 
+  44, -1, -1, 47, -1, -1, -1, 51, -1, 53, 
+  -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, 
+  -1, 65, 66, 67, 68, -1, 70, -1, 72, -1, 
+  74, -1, 76, -1, -1, -1, -1, 81, 82, 83, 
+  -1, -1, -1, 87, -1, -1, -1, -1, 92, -1, 
+  -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, 
+  -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, 
+  -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, 
+  -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, 
+  40, -1, 42, 43, 44, -1, -1, 47, -1, -1, 
+  -1, 51, -1, 53, -1, -1, 56, -1, -1, -1, 
+  -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, 
+  70, -1, 72, -1, 74, -1, 76, -1, -1, -1, 
+  -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, 
+  -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, 
   -1, -1, 4, 5, 6, -1, -1, 9, 10, 11, 
   -1, -1, 14, -1, 16, -1, -1, -1, 20, 21, 
   22, -1, -1, -1, -1, -1, -1, 29, 30, 31, 
   32, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-  -1, 43, -1, -1, -1, 47, -1, -1, -1, -1, 
-  -1, -1, -1, 55, -1, -1, -1, 59, -1, -1, 
-  -1, -1, -1, 65, 66, 67, -1, 69, 70, 71, 
+  -1, 43, -1, -1, -1, -1, -1, -1, -1, -1, 
+  -1, -1, -1, -1, -1, -1, -1, 59, -1, -1, 
+  -1, -1, -1, -1, 66, 67, 68, 69, 70, 71, 
   -1, 73, 74, 75, 76, 77, 78, -1, -1, 81, 
   82, 83, 84, 85, 86, -1, -1, -1, -1, -1, 
-  -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 
-  -1, -1, -1, -1, 9, -1, 11, 12, 13, 14, 
-  -1, -1, -1, -1, -1, -1, 21, 22, -1, -1, 
-  -1, -1, -1, -1, 29, 30, -1, -1, 33, 34, 
-  -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, 
-  -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, 
-  -1, -1, -1, -1, 59, -1, 61, -1, -1, -1, 
-  65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 
-  75, 76, 77, 78, -1, -1, 81, 82, 83, 84, 
-  85, -1, 87, -1, -1, -1, -1, 92, -1, -1, 
+  92, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+  4, 5, 6, -1, -1, 9, 10, 11, -1, -1, 
+  14, -1, 16, -1, -1, -1, 20, 21, 22, -1, 
+  -1, -1, -1, -1, -1, 29, 30, 31, 32, -1, 
+  -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, 
+  -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, 
+  -1, -1, -1, -1, -1, 59, -1, -1, -1, -1, 
+  -1, 65, 66, 67, -1, 69, 70, 71, -1, 73, 
+  74, 75, 76, 77, 78, -1, -1, 81, 82, 83, 
+  84, 85, 86, -1, -1, -1, -1, -1, -1, -1, 
+  -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, 
+  6, -1, -1, 9, 10, 11, -1, -1, 14, -1, 
+  16, -1, -1, -1, 20, 21, 22, -1, -1, -1, 
+  -1, -1, -1, 29, 30, 31, 32, -1, -1, -1, 
+  -1, -1, -1, -1, -1, -1, -1, 43, -1, -1, 
+  -1, 47, -1, -1, -1, -1, -1, -1, -1, 55, 
+  -1, -1, -1, 59, -1, -1, -1, -1, -1, 65, 
+  66, 67, -1, 69, 70, 71, -1, 73, 74, 75, 
+  76, 77, 78, -1, -1, 81, 82, 83, 84, 85, 
+  86, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
   -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, 
   -1, 9, -1, 11, 12, 13, 14, -1, -1, -1, 
   -1, -1, -1, 21, 22, -1, -1, -1, -1, -1, 
@@ -934,16 +930,26 @@ const short QDeclarativeJSGrammar::action_check [] = {
   68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 
   78, -1, -1, 81, 82, 83, 84, 85, -1, 87, 
   -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, 
-  -1, -1, -1, 4, 5, 6, -1, -1, 9, 10, 
-  11, 12, 13, 14, -1, 16, -1, -1, -1, 20, 
-  21, 22, -1, -1, -1, -1, -1, -1, 29, 30, 
-  31, 32, 33, 34, -1, 36, -1, -1, -1, 40, 
-  -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, 
-  51, -1, 53, -1, -1, -1, -1, -1, 59, -1, 
-  61, -1, -1, -1, 65, 66, 67, 68, 69, 70, 
-  71, 72, 73, 74, 75, 76, 77, 78, -1, -1, 
-  81, 82, 83, 84, 85, 86, 87, -1, -1, -1, 
-  -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, 
+  -1, -1, -1, -1, 4, -1, -1, -1, -1, 9, 
+  -1, 11, 12, 13, 14, -1, -1, -1, -1, -1, 
+  -1, 21, 22, -1, -1, -1, -1, -1, -1, 29, 
+  30, -1, -1, 33, 34, -1, 36, -1, -1, -1, 
+  40, -1, 42, 43, 44, -1, -1, 47, -1, -1, 
+  -1, 51, -1, 53, -1, -1, -1, -1, -1, 59, 
+  -1, 61, -1, -1, -1, 65, 66, 67, 68, 69, 
+  70, 71, 72, 73, 74, 75, 76, 77, 78, -1, 
+  -1, 81, 82, 83, 84, 85, -1, 87, -1, -1, 
+  -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, 
+  -1, -1, 4, 5, 6, -1, -1, 9, 10, 11, 
+  12, 13, 14, -1, 16, -1, -1, -1, 20, 21, 
+  22, -1, -1, -1, -1, -1, -1, 29, 30, 31, 
+  32, 33, 34, -1, 36, -1, -1, -1, 40, -1, 
+  42, 43, 44, -1, -1, 47, -1, -1, -1, 51, 
+  -1, 53, -1, -1, -1, -1, -1, 59, -1, 61, 
+  -1, -1, -1, 65, 66, 67, 68, 69, 70, 71, 
+  72, 73, 74, 75, 76, 77, 78, -1, -1, 81, 
+  82, 83, 84, 85, 86, 87, -1, -1, -1, -1, 
+  92, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
   4, 5, 6, -1, -1, 9, 10, 11, 12, 13, 
   14, -1, 16, -1, -1, -1, 20, 21, 22, -1, 
   -1, -1, -1, -1, -1, 29, 30, 31, 32, 33, 
@@ -953,7 +959,7 @@ const short QDeclarativeJSGrammar::action_check [] = {
   -1, 65, 66, 67, 68, 69, 70, 71, 72, 73, 
   74, 75, 76, 77, 78, -1, -1, 81, 82, 83, 
   84, 85, 86, 87, -1, -1, -1, -1, 92, -1, 
-  -1, -1, -1, -1, -1, -1, -1, 
+  -1, -1, -1, -1, -1, -1, -1, -1, 
 
   26, 36, 15, 15, 15, 15, 26, 26, 3, 15, 
   15, 26, 2, 15, 3, 19, 2, 15, 2, 2, 
index a093bc2..0dae476 100644 (file)
@@ -63,8 +63,8 @@ class QDeclarativeJSGrammar
 public:
   enum VariousConstants {
     EOF_SYMBOL = 0,
-    REDUCE_HERE = 100,
-    SHIFT_THERE = 99,
+    REDUCE_HERE = 101,
+    SHIFT_THERE = 100,
     T_AND = 1,
     T_AND_AND = 2,
     T_AND_EQ = 3,
@@ -89,13 +89,14 @@ public:
     T_EQ = 17,
     T_EQ_EQ = 18,
     T_EQ_EQ_EQ = 19,
+    T_ERROR = 93,
     T_FALSE = 83,
-    T_FEED_JS_EXPRESSION = 96,
-    T_FEED_JS_PROGRAM = 98,
-    T_FEED_JS_SOURCE_ELEMENT = 97,
-    T_FEED_JS_STATEMENT = 95,
-    T_FEED_UI_OBJECT_MEMBER = 94,
-    T_FEED_UI_PROGRAM = 93,
+    T_FEED_JS_EXPRESSION = 97,
+    T_FEED_JS_PROGRAM = 99,
+    T_FEED_JS_SOURCE_ELEMENT = 98,
+    T_FEED_JS_STATEMENT = 96,
+    T_FEED_UI_OBJECT_MEMBER = 95,
+    T_FEED_UI_PROGRAM = 94,
     T_FINALLY = 20,
     T_FOR = 21,
     T_FUNCTION = 22,
@@ -167,12 +168,12 @@ public:
     ACCEPT_STATE = 640,
     RULE_COUNT = 345,
     STATE_COUNT = 641,
-    TERMINAL_COUNT = 101,
+    TERMINAL_COUNT = 102,
     NON_TERMINAL_COUNT = 107,
 
     GOTO_INDEX_OFFSET = 641,
-    GOTO_INFO_OFFSET = 2787,
-    GOTO_CHECK_OFFSET = 2787
+    GOTO_INFO_OFFSET = 2818,
+    GOTO_CHECK_OFFSET = 2818
   };
 
   static const char  *const    spell [];
diff --git a/src/declarative/qml/parser/qdeclarativejskeywords_p.h b/src/declarative/qml/parser/qdeclarativejskeywords_p.h
new file mode 100644 (file)
index 0000000..b0762d5
--- /dev/null
@@ -0,0 +1,875 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QDECLARATIVEJSKEYWORDS_P_H
+#define QDECLARATIVEJSKEYWORDS_P_H
+
+//
+//  W A R N I N G
+//  -------------
+//
+// This file is not part of the Qt API.  It exists purely as an
+// implementation detail.  This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+static inline int classify2(const QChar *s) {
+  if (s[0].unicode() == 'a') {
+    if (s[1].unicode() == 's') {
+      return Lexer::T_AS;
+    }
+  }
+  else if (s[0].unicode() == 'd') {
+    if (s[1].unicode() == 'o') {
+      return Lexer::T_DO;
+    }
+  }
+  else if (s[0].unicode() == 'i') {
+    if (s[1].unicode() == 'f') {
+      return Lexer::T_IF;
+    }
+    else if (s[1].unicode() == 'n') {
+      return Lexer::T_IN;
+    }
+  }
+  else if (s[0].unicode() == 'o') {
+    if (s[1].unicode() == 'n') {
+      return Lexer::T_ON;
+    }
+  }
+  return Lexer::T_IDENTIFIER;
+}
+
+static inline int classify3(const QChar *s) {
+  if (s[0].unicode() == 'f') {
+    if (s[1].unicode() == 'o') {
+      if (s[2].unicode() == 'r') {
+        return Lexer::T_FOR;
+      }
+    }
+  }
+  else if (s[0].unicode() == 'i') {
+    if (s[1].unicode() == 'n') {
+      if (s[2].unicode() == 't') {
+        return Lexer::T_INT;
+      }
+    }
+  }
+  else if (s[0].unicode() == 'n') {
+    if (s[1].unicode() == 'e') {
+      if (s[2].unicode() == 'w') {
+        return Lexer::T_NEW;
+      }
+    }
+  }
+  else if (s[0].unicode() == 't') {
+    if (s[1].unicode() == 'r') {
+      if (s[2].unicode() == 'y') {
+        return Lexer::T_TRY;
+      }
+    }
+  }
+  else if (s[0].unicode() == 'v') {
+    if (s[1].unicode() == 'a') {
+      if (s[2].unicode() == 'r') {
+        return Lexer::T_VAR;
+      }
+    }
+  }
+  return Lexer::T_IDENTIFIER;
+}
+
+static inline int classify4(const QChar *s) {
+  if (s[0].unicode() == 'b') {
+    if (s[1].unicode() == 'y') {
+      if (s[2].unicode() == 't') {
+        if (s[3].unicode() == 'e') {
+          return Lexer::T_BYTE;
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 'c') {
+    if (s[1].unicode() == 'a') {
+      if (s[2].unicode() == 's') {
+        if (s[3].unicode() == 'e') {
+          return Lexer::T_CASE;
+        }
+      }
+    }
+    else if (s[1].unicode() == 'h') {
+      if (s[2].unicode() == 'a') {
+        if (s[3].unicode() == 'r') {
+          return Lexer::T_CHAR;
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 'e') {
+    if (s[1].unicode() == 'l') {
+      if (s[2].unicode() == 's') {
+        if (s[3].unicode() == 'e') {
+          return Lexer::T_ELSE;
+        }
+      }
+    }
+    else if (s[1].unicode() == 'n') {
+      if (s[2].unicode() == 'u') {
+        if (s[3].unicode() == 'm') {
+          return Lexer::T_ENUM;
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 'g') {
+    if (s[1].unicode() == 'o') {
+      if (s[2].unicode() == 't') {
+        if (s[3].unicode() == 'o') {
+          return Lexer::T_GOTO;
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 'l') {
+    if (s[1].unicode() == 'o') {
+      if (s[2].unicode() == 'n') {
+        if (s[3].unicode() == 'g') {
+          return Lexer::T_LONG;
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 'n') {
+    if (s[1].unicode() == 'u') {
+      if (s[2].unicode() == 'l') {
+        if (s[3].unicode() == 'l') {
+          return Lexer::T_NULL;
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 't') {
+    if (s[1].unicode() == 'h') {
+      if (s[2].unicode() == 'i') {
+        if (s[3].unicode() == 's') {
+          return Lexer::T_THIS;
+        }
+      }
+    }
+    else if (s[1].unicode() == 'r') {
+      if (s[2].unicode() == 'u') {
+        if (s[3].unicode() == 'e') {
+          return Lexer::T_TRUE;
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 'v') {
+    if (s[1].unicode() == 'o') {
+      if (s[2].unicode() == 'i') {
+        if (s[3].unicode() == 'd') {
+          return Lexer::T_VOID;
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 'w') {
+    if (s[1].unicode() == 'i') {
+      if (s[2].unicode() == 't') {
+        if (s[3].unicode() == 'h') {
+          return Lexer::T_WITH;
+        }
+      }
+    }
+  }
+  return Lexer::T_IDENTIFIER;
+}
+
+static inline int classify5(const QChar *s) {
+  if (s[0].unicode() == 'b') {
+    if (s[1].unicode() == 'r') {
+      if (s[2].unicode() == 'e') {
+        if (s[3].unicode() == 'a') {
+          if (s[4].unicode() == 'k') {
+            return Lexer::T_BREAK;
+          }
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 'c') {
+    if (s[1].unicode() == 'a') {
+      if (s[2].unicode() == 't') {
+        if (s[3].unicode() == 'c') {
+          if (s[4].unicode() == 'h') {
+            return Lexer::T_CATCH;
+          }
+        }
+      }
+    }
+    else if (s[1].unicode() == 'l') {
+      if (s[2].unicode() == 'a') {
+        if (s[3].unicode() == 's') {
+          if (s[4].unicode() == 's') {
+            return Lexer::T_CLASS;
+          }
+        }
+      }
+    }
+    else if (s[1].unicode() == 'o') {
+      if (s[2].unicode() == 'n') {
+        if (s[3].unicode() == 's') {
+          if (s[4].unicode() == 't') {
+            return Lexer::T_CONST;
+          }
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 'f') {
+    if (s[1].unicode() == 'a') {
+      if (s[2].unicode() == 'l') {
+        if (s[3].unicode() == 's') {
+          if (s[4].unicode() == 'e') {
+            return Lexer::T_FALSE;
+          }
+        }
+      }
+    }
+    else if (s[1].unicode() == 'i') {
+      if (s[2].unicode() == 'n') {
+        if (s[3].unicode() == 'a') {
+          if (s[4].unicode() == 'l') {
+            return Lexer::T_FINAL;
+          }
+        }
+      }
+    }
+    else if (s[1].unicode() == 'l') {
+      if (s[2].unicode() == 'o') {
+        if (s[3].unicode() == 'a') {
+          if (s[4].unicode() == 't') {
+            return Lexer::T_FLOAT;
+          }
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 's') {
+    if (s[1].unicode() == 'h') {
+      if (s[2].unicode() == 'o') {
+        if (s[3].unicode() == 'r') {
+          if (s[4].unicode() == 't') {
+            return Lexer::T_SHORT;
+          }
+        }
+      }
+    }
+    else if (s[1].unicode() == 'u') {
+      if (s[2].unicode() == 'p') {
+        if (s[3].unicode() == 'e') {
+          if (s[4].unicode() == 'r') {
+            return Lexer::T_SUPER;
+          }
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 't') {
+    if (s[1].unicode() == 'h') {
+      if (s[2].unicode() == 'r') {
+        if (s[3].unicode() == 'o') {
+          if (s[4].unicode() == 'w') {
+            return Lexer::T_THROW;
+          }
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 'w') {
+    if (s[1].unicode() == 'h') {
+      if (s[2].unicode() == 'i') {
+        if (s[3].unicode() == 'l') {
+          if (s[4].unicode() == 'e') {
+            return Lexer::T_WHILE;
+          }
+        }
+      }
+    }
+  }
+  return Lexer::T_IDENTIFIER;
+}
+
+static inline int classify6(const QChar *s) {
+  if (s[0].unicode() == 'd') {
+    if (s[1].unicode() == 'e') {
+      if (s[2].unicode() == 'l') {
+        if (s[3].unicode() == 'e') {
+          if (s[4].unicode() == 't') {
+            if (s[5].unicode() == 'e') {
+              return Lexer::T_DELETE;
+            }
+          }
+        }
+      }
+    }
+    else if (s[1].unicode() == 'o') {
+      if (s[2].unicode() == 'u') {
+        if (s[3].unicode() == 'b') {
+          if (s[4].unicode() == 'l') {
+            if (s[5].unicode() == 'e') {
+              return Lexer::T_DOUBLE;
+            }
+          }
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 'e') {
+    if (s[1].unicode() == 'x') {
+      if (s[2].unicode() == 'p') {
+        if (s[3].unicode() == 'o') {
+          if (s[4].unicode() == 'r') {
+            if (s[5].unicode() == 't') {
+              return Lexer::T_EXPORT;
+            }
+          }
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 'i') {
+    if (s[1].unicode() == 'm') {
+      if (s[2].unicode() == 'p') {
+        if (s[3].unicode() == 'o') {
+          if (s[4].unicode() == 'r') {
+            if (s[5].unicode() == 't') {
+              return Lexer::T_IMPORT;
+            }
+          }
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 'n') {
+    if (s[1].unicode() == 'a') {
+      if (s[2].unicode() == 't') {
+        if (s[3].unicode() == 'i') {
+          if (s[4].unicode() == 'v') {
+            if (s[5].unicode() == 'e') {
+              return Lexer::T_NATIVE;
+            }
+          }
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 'p') {
+    if (s[1].unicode() == 'u') {
+      if (s[2].unicode() == 'b') {
+        if (s[3].unicode() == 'l') {
+          if (s[4].unicode() == 'i') {
+            if (s[5].unicode() == 'c') {
+              return Lexer::T_PUBLIC;
+            }
+          }
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 'r') {
+    if (s[1].unicode() == 'e') {
+      if (s[2].unicode() == 't') {
+        if (s[3].unicode() == 'u') {
+          if (s[4].unicode() == 'r') {
+            if (s[5].unicode() == 'n') {
+              return Lexer::T_RETURN;
+            }
+          }
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 's') {
+    if (s[1].unicode() == 'i') {
+      if (s[2].unicode() == 'g') {
+        if (s[3].unicode() == 'n') {
+          if (s[4].unicode() == 'a') {
+            if (s[5].unicode() == 'l') {
+              return Lexer::T_SIGNAL;
+            }
+          }
+        }
+      }
+    }
+    else if (s[1].unicode() == 't') {
+      if (s[2].unicode() == 'a') {
+        if (s[3].unicode() == 't') {
+          if (s[4].unicode() == 'i') {
+            if (s[5].unicode() == 'c') {
+              return Lexer::T_STATIC;
+            }
+          }
+        }
+      }
+    }
+    else if (s[1].unicode() == 'w') {
+      if (s[2].unicode() == 'i') {
+        if (s[3].unicode() == 't') {
+          if (s[4].unicode() == 'c') {
+            if (s[5].unicode() == 'h') {
+              return Lexer::T_SWITCH;
+            }
+          }
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 't') {
+    if (s[1].unicode() == 'h') {
+      if (s[2].unicode() == 'r') {
+        if (s[3].unicode() == 'o') {
+          if (s[4].unicode() == 'w') {
+            if (s[5].unicode() == 's') {
+              return Lexer::T_THROWS;
+            }
+          }
+        }
+      }
+    }
+    else if (s[1].unicode() == 'y') {
+      if (s[2].unicode() == 'p') {
+        if (s[3].unicode() == 'e') {
+          if (s[4].unicode() == 'o') {
+            if (s[5].unicode() == 'f') {
+              return Lexer::T_TYPEOF;
+            }
+          }
+        }
+      }
+    }
+  }
+  return Lexer::T_IDENTIFIER;
+}
+
+static inline int classify7(const QChar *s) {
+  if (s[0].unicode() == 'b') {
+    if (s[1].unicode() == 'o') {
+      if (s[2].unicode() == 'o') {
+        if (s[3].unicode() == 'l') {
+          if (s[4].unicode() == 'e') {
+            if (s[5].unicode() == 'a') {
+              if (s[6].unicode() == 'n') {
+                return Lexer::T_BOOLEAN;
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 'c') {
+    if (s[1].unicode() == 'o') {
+      if (s[2].unicode() == 'm') {
+        if (s[3].unicode() == 'm') {
+          if (s[4].unicode() == 'e') {
+            if (s[5].unicode() == 'n') {
+              if (s[6].unicode() == 't') {
+                return Lexer::T_COMMENT;
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 'd') {
+    if (s[1].unicode() == 'e') {
+      if (s[2].unicode() == 'f') {
+        if (s[3].unicode() == 'a') {
+          if (s[4].unicode() == 'u') {
+            if (s[5].unicode() == 'l') {
+              if (s[6].unicode() == 't') {
+                return Lexer::T_DEFAULT;
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 'e') {
+    if (s[1].unicode() == 'x') {
+      if (s[2].unicode() == 't') {
+        if (s[3].unicode() == 'e') {
+          if (s[4].unicode() == 'n') {
+            if (s[5].unicode() == 'd') {
+              if (s[6].unicode() == 's') {
+                return Lexer::T_EXTENDS;
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 'f') {
+    if (s[1].unicode() == 'i') {
+      if (s[2].unicode() == 'n') {
+        if (s[3].unicode() == 'a') {
+          if (s[4].unicode() == 'l') {
+            if (s[5].unicode() == 'l') {
+              if (s[6].unicode() == 'y') {
+                return Lexer::T_FINALLY;
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 'p') {
+    if (s[1].unicode() == 'a') {
+      if (s[2].unicode() == 'c') {
+        if (s[3].unicode() == 'k') {
+          if (s[4].unicode() == 'a') {
+            if (s[5].unicode() == 'g') {
+              if (s[6].unicode() == 'e') {
+                return Lexer::T_PACKAGE;
+              }
+            }
+          }
+        }
+      }
+    }
+    else if (s[1].unicode() == 'r') {
+      if (s[2].unicode() == 'i') {
+        if (s[3].unicode() == 'v') {
+          if (s[4].unicode() == 'a') {
+            if (s[5].unicode() == 't') {
+              if (s[6].unicode() == 'e') {
+                return Lexer::T_PRIVATE;
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  return Lexer::T_IDENTIFIER;
+}
+
+static inline int classify8(const QChar *s) {
+  if (s[0].unicode() == 'a') {
+    if (s[1].unicode() == 'b') {
+      if (s[2].unicode() == 's') {
+        if (s[3].unicode() == 't') {
+          if (s[4].unicode() == 'r') {
+            if (s[5].unicode() == 'a') {
+              if (s[6].unicode() == 'c') {
+                if (s[7].unicode() == 't') {
+                  return Lexer::T_ABSTRACT;
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 'c') {
+    if (s[1].unicode() == 'o') {
+      if (s[2].unicode() == 'n') {
+        if (s[3].unicode() == 't') {
+          if (s[4].unicode() == 'i') {
+            if (s[5].unicode() == 'n') {
+              if (s[6].unicode() == 'u') {
+                if (s[7].unicode() == 'e') {
+                  return Lexer::T_CONTINUE;
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 'd') {
+    if (s[1].unicode() == 'e') {
+      if (s[2].unicode() == 'b') {
+        if (s[3].unicode() == 'u') {
+          if (s[4].unicode() == 'g') {
+            if (s[5].unicode() == 'g') {
+              if (s[6].unicode() == 'e') {
+                if (s[7].unicode() == 'r') {
+                  return Lexer::T_DEBUGGER;
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 'f') {
+    if (s[1].unicode() == 'u') {
+      if (s[2].unicode() == 'n') {
+        if (s[3].unicode() == 'c') {
+          if (s[4].unicode() == 't') {
+            if (s[5].unicode() == 'i') {
+              if (s[6].unicode() == 'o') {
+                if (s[7].unicode() == 'n') {
+                  return Lexer::T_FUNCTION;
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 'p') {
+    if (s[1].unicode() == 'r') {
+      if (s[2].unicode() == 'o') {
+        if (s[3].unicode() == 'p') {
+          if (s[4].unicode() == 'e') {
+            if (s[5].unicode() == 'r') {
+              if (s[6].unicode() == 't') {
+                if (s[7].unicode() == 'y') {
+                  return Lexer::T_PROPERTY;
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 'r') {
+    if (s[1].unicode() == 'e') {
+      if (s[2].unicode() == 'a') {
+        if (s[3].unicode() == 'd') {
+          if (s[4].unicode() == 'o') {
+            if (s[5].unicode() == 'n') {
+              if (s[6].unicode() == 'l') {
+                if (s[7].unicode() == 'y') {
+                  return Lexer::T_READONLY;
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 'v') {
+    if (s[1].unicode() == 'o') {
+      if (s[2].unicode() == 'l') {
+        if (s[3].unicode() == 'a') {
+          if (s[4].unicode() == 't') {
+            if (s[5].unicode() == 'i') {
+              if (s[6].unicode() == 'l') {
+                if (s[7].unicode() == 'e') {
+                  return Lexer::T_VOLATILE;
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  return Lexer::T_IDENTIFIER;
+}
+
+static inline int classify9(const QChar *s) {
+  if (s[0].unicode() == 'i') {
+    if (s[1].unicode() == 'n') {
+      if (s[2].unicode() == 't') {
+        if (s[3].unicode() == 'e') {
+          if (s[4].unicode() == 'r') {
+            if (s[5].unicode() == 'f') {
+              if (s[6].unicode() == 'a') {
+                if (s[7].unicode() == 'c') {
+                  if (s[8].unicode() == 'e') {
+                    return Lexer::T_INTERFACE;
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 'p') {
+    if (s[1].unicode() == 'r') {
+      if (s[2].unicode() == 'o') {
+        if (s[3].unicode() == 't') {
+          if (s[4].unicode() == 'e') {
+            if (s[5].unicode() == 'c') {
+              if (s[6].unicode() == 't') {
+                if (s[7].unicode() == 'e') {
+                  if (s[8].unicode() == 'd') {
+                    return Lexer::T_PROTECTED;
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  else if (s[0].unicode() == 't') {
+    if (s[1].unicode() == 'r') {
+      if (s[2].unicode() == 'a') {
+        if (s[3].unicode() == 'n') {
+          if (s[4].unicode() == 's') {
+            if (s[5].unicode() == 'i') {
+              if (s[6].unicode() == 'e') {
+                if (s[7].unicode() == 'n') {
+                  if (s[8].unicode() == 't') {
+                    return Lexer::T_TRANSIENT;
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  return Lexer::T_IDENTIFIER;
+}
+
+static inline int classify10(const QChar *s) {
+  if (s[0].unicode() == 'i') {
+    if (s[1].unicode() == 'm') {
+      if (s[2].unicode() == 'p') {
+        if (s[3].unicode() == 'l') {
+          if (s[4].unicode() == 'e') {
+            if (s[5].unicode() == 'm') {
+              if (s[6].unicode() == 'e') {
+                if (s[7].unicode() == 'n') {
+                  if (s[8].unicode() == 't') {
+                    if (s[9].unicode() == 's') {
+                      return Lexer::T_IMPLEMENTS;
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+    else if (s[1].unicode() == 'n') {
+      if (s[2].unicode() == 's') {
+        if (s[3].unicode() == 't') {
+          if (s[4].unicode() == 'a') {
+            if (s[5].unicode() == 'n') {
+              if (s[6].unicode() == 'c') {
+                if (s[7].unicode() == 'e') {
+                  if (s[8].unicode() == 'o') {
+                    if (s[9].unicode() == 'f') {
+                      return Lexer::T_INSTANCEOF;
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  return Lexer::T_IDENTIFIER;
+}
+
+static inline int classify12(const QChar *s) {
+  if (s[0].unicode() == 's') {
+    if (s[1].unicode() == 'y') {
+      if (s[2].unicode() == 'n') {
+        if (s[3].unicode() == 'c') {
+          if (s[4].unicode() == 'h') {
+            if (s[5].unicode() == 'r') {
+              if (s[6].unicode() == 'o') {
+                if (s[7].unicode() == 'n') {
+                  if (s[8].unicode() == 'i') {
+                    if (s[9].unicode() == 'z') {
+                      if (s[10].unicode() == 'e') {
+                        if (s[11].unicode() == 'd') {
+                          return Lexer::T_SYNCHRONIZED;
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  return Lexer::T_IDENTIFIER;
+}
+
+int Lexer::classify(const QChar *s, int n) {
+  switch (n) {
+    case 2: return classify2(s);
+    case 3: return classify3(s);
+    case 4: return classify4(s);
+    case 5: return classify5(s);
+    case 6: return classify6(s);
+    case 7: return classify7(s);
+    case 8: return classify8(s);
+    case 9: return classify9(s);
+    case 10: return classify10(s);
+    case 12: return classify12(s);
+    default: return Lexer::T_IDENTIFIER;
+  } // switch
+}
+
+#endif // QDECLARATIVEJSKEYWORDS_P_H
index 4d68f28..ac4be34 100644 (file)
 **
 ****************************************************************************/
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include "qdeclarativejslexer_p.h"
-
-#include "qdeclarativejsglobal_p.h"
 #include "qdeclarativejsengine_p.h"
-#include "qdeclarativejsgrammar_p.h"
-
-#include <QtCore/qcoreapplication.h>
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
+#include "qdeclarativejsnodepool_p.h"
+#include <QtCore/QCoreApplication>
+#include <QtCore/QDebug>
 
 QT_BEGIN_NAMESPACE
 Q_CORE_EXPORT double qstrtod(const char *s00, char const **se, bool *ok);
 QT_END_NAMESPACE
 
-QT_QML_BEGIN_NAMESPACE
+using namespace QDeclarativeJS;
 
-#define shiftWindowsLineBreak() \
-    do { \
-        if (((current == '\r') && (next1 == '\n')) \
-            || ((current == '\n') && (next1 == '\r'))) { \
-            shift(1); \
-        } \
-    } \
-    while (0)
+enum RegExpFlag {
+    Global     = 0x01,
+    IgnoreCase = 0x02,
+    Multiline  = 0x04
+};
 
-namespace QDeclarativeJS {
-extern double integerFromString(const char *buf, int size, int radix);
+static int flagFromChar(const QChar &ch)
+{
+    switch (ch.unicode()) {
+    case 'g': return Global;
+    case 'i': return IgnoreCase;
+    case 'm': return Multiline;
+    }
+    return 0;
 }
 
-using namespace QDeclarativeJS;
+static unsigned char convertHex(ushort c)
+{
+    if (c >= '0' && c <= '9')
+        return (c - '0');
+    else if (c >= 'a' && c <= 'f')
+        return (c - 'a' + 10);
+    else
+        return (c - 'A' + 10);
+}
 
-Lexer::Lexer(Engine *eng, bool tokenizeComments)
-    : driver(eng),
-      yylineno(0),
-      done(false),
-      size8(128), size16(128),
-      pos8(0), pos16(0),
-      terminator(false),
-      restrKeyword(false),
-      delimited(false),
-      stackToken(-1),
-      state(Start),
-      pos(0),
-      code(0), length(0),
-      yycolumn(0),
-      startpos(0),
-      startlineno(0), startcolumn(0),
-      bol(true),
-      current(0), next1(0), next2(0), next3(0),
-      err(NoError),
-      wantRx(false),
-      check_reserved(true),
-      parenthesesState(IgnoreParentheses),
-      parenthesesCount(0),
-      prohibitAutomaticSemicolon(false),
-      tokenizeComments(tokenizeComments)
+static unsigned char convertHex(QChar c1, QChar c2)
 {
-    if (driver) driver->setLexer(this);
-    // allocate space for read buffers
-    buffer8 = new char[size8];
-    buffer16 = new QChar[size16];
-    pattern = 0;
-    flags = 0;
+    return ((convertHex(c1.unicode()) << 4) + convertHex(c2.unicode()));
+}
 
+static QChar convertUnicode(QChar c1, QChar c2, QChar c3, QChar c4)
+{
+    return QChar((convertHex(c3.unicode()) << 4) + convertHex(c4.unicode()),
+                 (convertHex(c1.unicode()) << 4) + convertHex(c2.unicode()));
 }
 
-Lexer::~Lexer()
+Lexer::Lexer(Engine *engine)
+    : _engine(engine)
+    , _codePtr(0)
+    , _lastLinePtr(0)
+    , _tokenLinePtr(0)
+    , _tokenStartPtr(0)
+    , _char(QLatin1Char('\n'))
+    , _errorCode(NoError)
+    , _currentLineNumber(0)
+    , _tokenValue(0)
+    , _parenthesesState(IgnoreParentheses)
+    , _parenthesesCount(0)
+    , _stackToken(-1)
+    , _patternFlags(0)
+    , _tokenLength(0)
+    , _tokenLine(0)
+    , _validTokenText(false)
+    , _prohibitAutomaticSemicolon(false)
+    , _restrictedKeyword(false)
+    , _terminator(false)
+    , _delimited(false)
 {
-    delete [] buffer8;
-    delete [] buffer16;
+    if (engine)
+        engine->setLexer(this);
 }
 
-void Lexer::setCode(const QString &c, int lineno)
+QString Lexer::code() const
 {
-    errmsg.clear();
-    yylineno = lineno;
-    yycolumn = 1;
-    restrKeyword = false;
-    delimited = false;
-    stackToken = -1;
-    pos = 0;
-    code = c.unicode();
-    length = c.length();
-    bol = true;
-
-    // read first characters
-    current = (length > 0) ? code[0].unicode() : 0;
-    next1 = (length > 1) ? code[1].unicode() : 0;
-    next2 = (length > 2) ? code[2].unicode() : 0;
-    next3 = (length > 3) ? code[3].unicode() : 0;
+    return _code;
 }
 
-void Lexer::shift(uint p)
+void Lexer::setCode(const QString &code, int lineno)
 {
-    while (p--) {
-        ++pos;
-        ++yycolumn;
-        current = next1;
-        next1 = next2;
-        next2 = next3;
-        next3 = (pos + 3 < length) ? code[pos+3].unicode() : 0;
-    }
+    if (_engine)
+        _engine->setCode(code);
+
+    _code = code;
+    _tokenText.clear();
+    _errorMessage.clear();
+    _tokenSpell = QStringRef();
+
+    _codePtr = code.unicode();
+    _lastLinePtr = _codePtr;
+    _tokenLinePtr = _codePtr;
+    _tokenStartPtr = _codePtr;
+
+    _char = QLatin1Char('\n');
+    _errorCode = NoError;
+
+    _currentLineNumber = lineno;
+    _tokenValue = 0;
+
+    // parentheses state
+    _parenthesesState = IgnoreParentheses;
+    _parenthesesCount = 0;
+
+    _stackToken = -1;
+
+    _patternFlags = 0;
+    _tokenLength = 0;
+    _tokenLine = lineno;
+
+    _validTokenText = false;
+    _prohibitAutomaticSemicolon = false;
+    _restrictedKeyword = false;
+    _terminator = false;
+    _delimited = false;
 }
 
-void Lexer::setDone(State s)
+void Lexer::scanChar()
 {
-    state = s;
-    done = true;
+    _char = *_codePtr++;
+
+    if (_char == QLatin1Char('\n')) {
+        _lastLinePtr = _codePtr; // points to the first character after the newline
+        ++_currentLineNumber;
+    }
 }
 
-int Lexer::findReservedWord(const QChar *c, int size) const
+int Lexer::lex()
 {
-    switch (size) {
-    case 2: {
-        if (c[0] == QLatin1Char('d') && c[1] == QLatin1Char('o'))
-            return QDeclarativeJSGrammar::T_DO;
-        else if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('f'))
-            return QDeclarativeJSGrammar::T_IF;
-        else if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('n'))
-            return QDeclarativeJSGrammar::T_IN;
-        else if (c[0] == QLatin1Char('a') && c[1] == QLatin1Char('s'))
-            return QDeclarativeJSGrammar::T_AS;
-        else if (c[0] == QLatin1Char('o') && c[1] == QLatin1Char('n'))
-            return QDeclarativeJSGrammar::T_ON;
-    }   break;
-
-    case 3: {
-        if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('o') && c[2] == QLatin1Char('r'))
-            return QDeclarativeJSGrammar::T_FOR;
-        else if (c[0] == QLatin1Char('n') && c[1] == QLatin1Char('e') && c[2] == QLatin1Char('w'))
-            return QDeclarativeJSGrammar::T_NEW;
-        else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('r') && c[2] == QLatin1Char('y'))
-            return QDeclarativeJSGrammar::T_TRY;
-        else if (c[0] == QLatin1Char('v') && c[1] == QLatin1Char('a') && c[2] == QLatin1Char('r'))
-            return QDeclarativeJSGrammar::T_VAR;
-        else if (check_reserved) {
-            if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('n') && c[2] == QLatin1Char('t'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
-        }
-    }   break;
-
-    case 4: {
-        if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('a')
-                && c[2] == QLatin1Char('s') && c[3] == QLatin1Char('e'))
-            return QDeclarativeJSGrammar::T_CASE;
-        else if (c[0] == QLatin1Char('e') && c[1] == QLatin1Char('l')
-                && c[2] == QLatin1Char('s') && c[3] == QLatin1Char('e'))
-            return QDeclarativeJSGrammar::T_ELSE;
-        else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('h')
-                && c[2] == QLatin1Char('i') && c[3] == QLatin1Char('s'))
-            return QDeclarativeJSGrammar::T_THIS;
-        else if (c[0] == QLatin1Char('v') && c[1] == QLatin1Char('o')
-                && c[2] == QLatin1Char('i') && c[3] == QLatin1Char('d'))
-            return QDeclarativeJSGrammar::T_VOID;
-        else if (c[0] == QLatin1Char('w') && c[1] == QLatin1Char('i')
-                && c[2] == QLatin1Char('t') && c[3] == QLatin1Char('h'))
-            return QDeclarativeJSGrammar::T_WITH;
-        else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('r')
-                && c[2] == QLatin1Char('u') && c[3] == QLatin1Char('e'))
-            return QDeclarativeJSGrammar::T_TRUE;
-        else if (c[0] == QLatin1Char('n') && c[1] == QLatin1Char('u')
-                && c[2] == QLatin1Char('l') && c[3] == QLatin1Char('l'))
-            return QDeclarativeJSGrammar::T_NULL;
-        else if (check_reserved) {
-            if (c[0] == QLatin1Char('e') && c[1] == QLatin1Char('n')
-                    && c[2] == QLatin1Char('u') && c[3] == QLatin1Char('m'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
-            else if (c[0] == QLatin1Char('b') && c[1] == QLatin1Char('y')
-                    && c[2] == QLatin1Char('t') && c[3] == QLatin1Char('e'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
-            else if (c[0] == QLatin1Char('l') && c[1] == QLatin1Char('o')
-                    && c[2] == QLatin1Char('n') && c[3] == QLatin1Char('g'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
-            else if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('h')
-                    && c[2] == QLatin1Char('a') && c[3] == QLatin1Char('r'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
-            else if (c[0] == QLatin1Char('g') && c[1] == QLatin1Char('o')
-                    && c[2] == QLatin1Char('t') && c[3] == QLatin1Char('o'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
-        }
-    }   break;
-
-    case 5: {
-        if (c[0] == QLatin1Char('b') && c[1] == QLatin1Char('r')
-                && c[2] == QLatin1Char('e') && c[3] == QLatin1Char('a')
-                && c[4] == QLatin1Char('k'))
-            return QDeclarativeJSGrammar::T_BREAK;
-        else if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('a')
-                && c[2] == QLatin1Char('t') && c[3] == QLatin1Char('c')
-                && c[4] == QLatin1Char('h'))
-            return QDeclarativeJSGrammar::T_CATCH;
-        else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('h')
-                && c[2] == QLatin1Char('r') && c[3] == QLatin1Char('o')
-                && c[4] == QLatin1Char('w'))
-            return QDeclarativeJSGrammar::T_THROW;
-        else if (c[0] == QLatin1Char('w') && c[1] == QLatin1Char('h')
-                && c[2] == QLatin1Char('i') && c[3] == QLatin1Char('l')
-                && c[4] == QLatin1Char('e'))
-            return QDeclarativeJSGrammar::T_WHILE;
-        else if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('o')
-                && c[2] == QLatin1Char('n') && c[3] == QLatin1Char('s')
-                && c[4] == QLatin1Char('t'))
-            return QDeclarativeJSGrammar::T_CONST;
-        else if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('a')
-                && c[2] == QLatin1Char('l') && c[3] == QLatin1Char('s')
-                && c[4] == QLatin1Char('e'))
-            return QDeclarativeJSGrammar::T_FALSE;
-        else if (check_reserved) {
-            if (c[0] == QLatin1Char('s') && c[1] == QLatin1Char('h')
-                    && c[2] == QLatin1Char('o') && c[3] == QLatin1Char('r')
-                    && c[4] == QLatin1Char('t'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
-            else if (c[0] == QLatin1Char('s') && c[1] == QLatin1Char('u')
-                    && c[2] == QLatin1Char('p') && c[3] == QLatin1Char('e')
-                    && c[4] == QLatin1Char('r'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
-            else if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('i')
-                    && c[2] == QLatin1Char('n') && c[3] == QLatin1Char('a')
-                    && c[4] == QLatin1Char('l'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
-            else if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('l')
-                    && c[2] == QLatin1Char('a') && c[3] == QLatin1Char('s')
-                    && c[4] == QLatin1Char('s'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
-            else if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('l')
-                    && c[2] == QLatin1Char('o') && c[3] == QLatin1Char('a')
-                    && c[4] == QLatin1Char('t'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
-        }
-    }   break;
-
-    case 6: {
-        if (c[0] == QLatin1Char('d') && c[1] == QLatin1Char('e')
-                && c[2] == QLatin1Char('l') && c[3] == QLatin1Char('e')
-                && c[4] == QLatin1Char('t') && c[5] == QLatin1Char('e'))
-            return QDeclarativeJSGrammar::T_DELETE;
-        else if (c[0] == QLatin1Char('r') && c[1] == QLatin1Char('e')
-                && c[2] == QLatin1Char('t') && c[3] == QLatin1Char('u')
-                && c[4] == QLatin1Char('r') && c[5] == QLatin1Char('n'))
-            return QDeclarativeJSGrammar::T_RETURN;
-        else if (c[0] == QLatin1Char('s') && c[1] == QLatin1Char('w')
-                && c[2] == QLatin1Char('i') && c[3] == QLatin1Char('t')
-                && c[4] == QLatin1Char('c') && c[5] == QLatin1Char('h'))
-            return QDeclarativeJSGrammar::T_SWITCH;
-        else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('y')
-                && c[2] == QLatin1Char('p') && c[3] == QLatin1Char('e')
-                && c[4] == QLatin1Char('o') && c[5] == QLatin1Char('f'))
-            return QDeclarativeJSGrammar::T_TYPEOF;
-        else if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('m')
-            && c[2] == QLatin1Char('p') && c[3] == QLatin1Char('o')
-            && c[4] == QLatin1Char('r') && c[5] == QLatin1Char('t'))
-            return QDeclarativeJSGrammar::T_IMPORT;
-        else if (c[0] == QLatin1Char('s') && c[1] == QLatin1Char('i')
-            && c[2] == QLatin1Char('g') && c[3] == QLatin1Char('n')
-            && c[4] == QLatin1Char('a') && c[5] == QLatin1Char('l'))
-            return QDeclarativeJSGrammar::T_SIGNAL;
-        else if (check_reserved) {
-            if (c[0] == QLatin1Char('e') && c[1] == QLatin1Char('x')
-                    && c[2] == QLatin1Char('p') && c[3] == QLatin1Char('o')
-                    && c[4] == QLatin1Char('r') && c[5] == QLatin1Char('t'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
-            else if (c[0] == QLatin1Char('s') && c[1] == QLatin1Char('t')
-                    && c[2] == QLatin1Char('a') && c[3] == QLatin1Char('t')
-                    && c[4] == QLatin1Char('i') && c[5] == QLatin1Char('c'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
-            else if (c[0] == QLatin1Char('d') && c[1] == QLatin1Char('o')
-                    && c[2] == QLatin1Char('u') && c[3] == QLatin1Char('b')
-                    && c[4] == QLatin1Char('l') && c[5] == QLatin1Char('e'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
-            else if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('m')
-                    && c[2] == QLatin1Char('p') && c[3] == QLatin1Char('o')
-                    && c[4] == QLatin1Char('r') && c[5] == QLatin1Char('t'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
-            else if (c[0] == QLatin1Char('p') && c[1] == QLatin1Char('u')
-                    && c[2] == QLatin1Char('b') && c[3] == QLatin1Char('l')
-                    && c[4] == QLatin1Char('i') && c[5] == QLatin1Char('c'))
-                return QDeclarativeJSGrammar::T_PUBLIC;
-            else if (c[0] == QLatin1Char('n') && c[1] == QLatin1Char('a')
-                    && c[2] == QLatin1Char('t') && c[3] == QLatin1Char('i')
-                    && c[4] == QLatin1Char('v') && c[5] == QLatin1Char('e'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
-            else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('h')
-                    && c[2] == QLatin1Char('r') && c[3] == QLatin1Char('o')
-                    && c[4] == QLatin1Char('w') && c[5] == QLatin1Char('s'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
-        }
-    }   break;
-
-    case 7: {
-        if (c[0] == QLatin1Char('d') && c[1] == QLatin1Char('e')
-                && c[2] == QLatin1Char('f') && c[3] == QLatin1Char('a')
-                && c[4] == QLatin1Char('u') && c[5] == QLatin1Char('l')
-                && c[6] == QLatin1Char('t'))
-            return QDeclarativeJSGrammar::T_DEFAULT;
-        else if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('i')
-                && c[2] == QLatin1Char('n') && c[3] == QLatin1Char('a')
-                && c[4] == QLatin1Char('l') && c[5] == QLatin1Char('l')
-                && c[6] == QLatin1Char('y'))
-            return QDeclarativeJSGrammar::T_FINALLY;
-        else if (check_reserved) {
-            if (c[0] == QLatin1Char('b') && c[1] == QLatin1Char('o')
-                    && c[2] == QLatin1Char('o') && c[3] == QLatin1Char('l')
-                    && c[4] == QLatin1Char('e') && c[5] == QLatin1Char('a')
-                    && c[6] == QLatin1Char('n'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
-            else if (c[0] == QLatin1Char('e') && c[1] == QLatin1Char('x')
-                    && c[2] == QLatin1Char('t') && c[3] == QLatin1Char('e')
-                    && c[4] == QLatin1Char('n') && c[5] == QLatin1Char('d')
-                    && c[6] == QLatin1Char('s'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
-            else if (c[0] == QLatin1Char('p') && c[1] == QLatin1Char('a')
-                    && c[2] == QLatin1Char('c') && c[3] == QLatin1Char('k')
-                    && c[4] == QLatin1Char('a') && c[5] == QLatin1Char('g')
-                    && c[6] == QLatin1Char('e'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
-            else if (c[0] == QLatin1Char('p') && c[1] == QLatin1Char('r')
-                    && c[2] == QLatin1Char('i') && c[3] == QLatin1Char('v')
-                    && c[4] == QLatin1Char('a') && c[5] == QLatin1Char('t')
-                    && c[6] == QLatin1Char('e'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
-        }
-    }   break;
-
-    case 8: {
-        if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('o')
-                && c[2] == QLatin1Char('n') && c[3] == QLatin1Char('t')
-                && c[4] == QLatin1Char('i') && c[5] == QLatin1Char('n')
-                && c[6] == QLatin1Char('u') && c[7] == QLatin1Char('e'))
-            return QDeclarativeJSGrammar::T_CONTINUE;
-        else if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('u')
-                && c[2] == QLatin1Char('n') && c[3] == QLatin1Char('c')
-                && c[4] == QLatin1Char('t') && c[5] == QLatin1Char('i')
-                && c[6] == QLatin1Char('o') && c[7] == QLatin1Char('n'))
-            return QDeclarativeJSGrammar::T_FUNCTION;
-        else if (c[0] == QLatin1Char('d') && c[1] == QLatin1Char('e')
-                && c[2] == QLatin1Char('b') && c[3] == QLatin1Char('u')
-                && c[4] == QLatin1Char('g') && c[5] == QLatin1Char('g')
-                && c[6] == QLatin1Char('e') && c[7] == QLatin1Char('r'))
-            return QDeclarativeJSGrammar::T_DEBUGGER;
-        else if (c[0] == QLatin1Char('p') && c[1] == QLatin1Char('r')
-                && c[2] == QLatin1Char('o') && c[3] == QLatin1Char('p')
-                && c[4] == QLatin1Char('e') && c[5] == QLatin1Char('r')
-                && c[6] == QLatin1Char('t') && c[7] == QLatin1Char('y'))
-            return QDeclarativeJSGrammar::T_PROPERTY;
-        else if (c[0] == QLatin1Char('r') && c[1] == QLatin1Char('e')
-                && c[2] == QLatin1Char('a') && c[3] == QLatin1Char('d')
-                && c[4] == QLatin1Char('o') && c[5] == QLatin1Char('n')
-                && c[6] == QLatin1Char('l') && c[7] == QLatin1Char('y'))
-            return QDeclarativeJSGrammar::T_READONLY;
-        else if (check_reserved) {
-            if (c[0] == QLatin1Char('a') && c[1] == QLatin1Char('b')
-                    && c[2] == QLatin1Char('s') && c[3] == QLatin1Char('t')
-                    && c[4] == QLatin1Char('r') && c[5] == QLatin1Char('a')
-                    && c[6] == QLatin1Char('c') && c[7] == QLatin1Char('t'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
-            else if (c[0] == QLatin1Char('v') && c[1] == QLatin1Char('o')
-                    && c[2] == QLatin1Char('l') && c[3] == QLatin1Char('a')
-                    && c[4] == QLatin1Char('t') && c[5] == QLatin1Char('i')
-                    && c[6] == QLatin1Char('l') && c[7] == QLatin1Char('e'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
-        }
-    }   break;
-
-    case 9: {
-        if (check_reserved) {
-            if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('n')
-                    && c[2] == QLatin1Char('t') && c[3] == QLatin1Char('e')
-                    && c[4] == QLatin1Char('r') && c[5] == QLatin1Char('f')
-                    && c[6] == QLatin1Char('a') && c[7] == QLatin1Char('c')
-                    && c[8] == QLatin1Char('e'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
-            else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('r')
-                    && c[2] == QLatin1Char('a') && c[3] == QLatin1Char('n')
-                    && c[4] == QLatin1Char('s') && c[5] == QLatin1Char('i')
-                    && c[6] == QLatin1Char('e') && c[7] == QLatin1Char('n')
-                    && c[8] == QLatin1Char('t'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
-            else if (c[0] == QLatin1Char('p') && c[1] == QLatin1Char('r')
-                    && c[2] == QLatin1Char('o') && c[3] == QLatin1Char('t')
-                    && c[4] == QLatin1Char('e') && c[5] == QLatin1Char('c')
-                    && c[6] == QLatin1Char('t') && c[7] == QLatin1Char('e')
-                    && c[8] == QLatin1Char('d'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
-        }
-    }   break;
-
-    case 10: {
-        if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('n')
-                && c[2] == QLatin1Char('s') && c[3] == QLatin1Char('t')
-                && c[4] == QLatin1Char('a') && c[5] == QLatin1Char('n')
-                && c[6] == QLatin1Char('c') && c[7] == QLatin1Char('e')
-                && c[8] == QLatin1Char('o') && c[9] == QLatin1Char('f'))
-            return QDeclarativeJSGrammar::T_INSTANCEOF;
-        else if (check_reserved) {
-            if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('m')
-                    && c[2] == QLatin1Char('p') && c[3] == QLatin1Char('l')
-                    && c[4] == QLatin1Char('e') && c[5] == QLatin1Char('m')
-                    && c[6] == QLatin1Char('e') && c[7] == QLatin1Char('n')
-                    && c[8] == QLatin1Char('t') && c[9] == QLatin1Char('s'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
-        }
-    }   break;
-
-    case 12: {
-        if (check_reserved) {
-            if (c[0] == QLatin1Char('s') && c[1] == QLatin1Char('y')
-                    && c[2] == QLatin1Char('n') && c[3] == QLatin1Char('c')
-                    && c[4] == QLatin1Char('h') && c[5] == QLatin1Char('r')
-                    && c[6] == QLatin1Char('o') && c[7] == QLatin1Char('n')
-                    && c[8] == QLatin1Char('i') && c[9] == QLatin1Char('z')
-                    && c[10] == QLatin1Char('e') && c[11] == QLatin1Char('d'))
-                return QDeclarativeJSGrammar::T_RESERVED_WORD;
+    _tokenSpell = QStringRef();
+    int token = scanToken();
+    _tokenLength = _codePtr - _tokenStartPtr - 1;
+
+    _delimited = false;
+    _restrictedKeyword = false;
+
+    // update the flags
+    switch (token) {
+    case T_LBRACE:
+    case T_SEMICOLON:
+        _delimited = true;
+        break;
+
+    case T_IF:
+    case T_FOR:
+    case T_WHILE:
+    case T_WITH:
+        _parenthesesState = CountParentheses;
+        _parenthesesCount = 0;
+        break;
+
+    case T_DO:
+        _parenthesesState = BalancedParentheses;
+        break;
+
+    case T_CONTINUE:
+    case T_BREAK:
+    case T_RETURN:
+    case T_THROW:
+        _restrictedKeyword = true;
+        break;
+    } // switch
+
+    // update the parentheses state
+    switch (_parenthesesState) {
+    case IgnoreParentheses:
+        break;
+
+    case CountParentheses:
+        if (token == T_RPAREN) {
+            --_parenthesesCount;
+            if (_parenthesesCount == 0)
+                _parenthesesState = BalancedParentheses;
+        } else if (token == T_LPAREN) {
+            ++_parenthesesCount;
         }
-    }   break;
+        break;
 
+    case BalancedParentheses:
+        _parenthesesState = IgnoreParentheses;
+        break;
     } // switch
 
-    return -1;
+    return token;
 }
 
-int Lexer::lex()
+bool Lexer::isUnicodeEscapeSequence(const QChar *chars)
+{
+    if (isHexDigit(chars[0]) && isHexDigit(chars[1]) && isHexDigit(chars[2]) && isHexDigit(chars[3]))
+        return true;
+
+    return false;
+}
+
+QChar Lexer::decodeUnicodeEscapeCharacter(bool *ok)
 {
-    int token = 0;
-    state = Start;
-    ushort stringType = 0; // either single or double quotes
-    bool multiLineString = false;
-    pos8 = pos16 = 0;
-    done = false;
-    terminator = false;
-
-    // did we push a token on the stack previously ?
-    // (after an automatic semicolon insertion)
-    if (stackToken >= 0) {
-        setDone(Other);
-        token = stackToken;
-        stackToken = -1;
+    if (_char == QLatin1Char('u') && isUnicodeEscapeSequence(&_codePtr[0])) {
+        scanChar(); // skip u
+
+        const QChar c1 = _char;
+        scanChar();
+
+        const QChar c2 = _char;
+        scanChar();
+
+        const QChar c3 = _char;
+        scanChar();
+
+        const QChar c4 = _char;
+        scanChar();
+
+        if (ok)
+            *ok = true;
+
+        return convertUnicode(c1, c2, c3, c4);
     }
 
-    bool identifierWithEscapedUnicode = false;
-
-    while (!done) {
-        switch (state) {
-        case Start:
-            if (isWhiteSpace()) {
-                // do nothing
-            } else if (current == '/' && next1 == '/') {
-                recordStartPos();
-                shift(1);
-                state = InSingleLineComment;
-            } else if (current == '/' && next1 == '*') {
-                recordStartPos();
-                shift(1);
-                state = InMultiLineComment;
-            } else if (current == 0) {
-                syncProhibitAutomaticSemicolon();
-                if (!terminator && !delimited && !prohibitAutomaticSemicolon) {
-                    // automatic semicolon insertion if program incomplete
-                    token = QDeclarativeJSGrammar::T_SEMICOLON;
-                    stackToken = 0;
-                    setDone(Other);
-                } else {
-                    setDone(Eof);
-                }
-            } else if (isLineTerminator()) {
-                if (restrKeyword) {
-                    // automatic semicolon insertion
-                    recordStartPos();
-                    token = QDeclarativeJSGrammar::T_SEMICOLON;
-                    setDone(Other);
-                } else {
-                    shiftWindowsLineBreak();
-                    yylineno++;
-                    yycolumn = 0;
-                    bol = true;
-                    terminator = true;
-                    syncProhibitAutomaticSemicolon();
-                }
-            } else if (current == '"' || current == '\'') {
-                recordStartPos();
-                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;
-                }
+    *ok = false;
+    return QChar();
+}
 
-            } else if (isIdentLetter(current)) {
-                identifierWithEscapedUnicode = false;
-                recordStartPos();
-                record16(current);
-                state = InIdentifier;
-            } else if (current == '0') {
-                recordStartPos();
-                record8(current);
-                state = InNum0;
-            } else if (isDecimalDigit(current)) {
-                recordStartPos();
-                record8(current);
-                state = InNum;
-            } else if (current == '.' && isDecimalDigit(next1)) {
-                recordStartPos();
-                record8(current);
-                state = InDecimal;
-            } else {
-                recordStartPos();
-                token = matchPunctuator(current, next1, next2, next3);
-                if (token != -1) {
-                    if (terminator && !delimited && !prohibitAutomaticSemicolon
-                        && (token == QDeclarativeJSGrammar::T_PLUS_PLUS
-                            || token == QDeclarativeJSGrammar::T_MINUS_MINUS)) {
-                        // automatic semicolon insertion
-                        stackToken = token;
-                        token = QDeclarativeJSGrammar::T_SEMICOLON;
-                    }
-                    setDone(Other);
-                }
-                else {
-                    setDone(Bad);
-                    err = IllegalCharacter;
-                    errmsg = QCoreApplication::translate("QDeclarativeParser", "Illegal character");
-                }
-            }
-            break;
-        case InString:
-            if (current == stringType) {
-                shift(1);
-                setDone(String);
-            } else if (isLineTerminator()) {
-                multiLineString = true;
-                record16(current);
-            } else if (current == 0 || isLineTerminator()) {
-                setDone(Bad);
-                err = UnclosedStringLiteral;
-                errmsg = QCoreApplication::translate("QDeclarativeParser", "Unclosed string at end of line");
-            } else if (current == '\\') {
-                state = InEscapeSequence;
+int Lexer::scanToken()
+{
+    if (_stackToken != -1) {
+        int tk = _stackToken;
+        _stackToken = -1;
+        return tk;
+    }
+
+    _terminator = false;
+
+again:
+    _validTokenText = false;
+    _tokenLinePtr = _lastLinePtr;
+
+    while (_char.isSpace()) {
+        if (_char == QLatin1Char('\n')) {
+            _tokenLinePtr = _codePtr;
+
+            if (_restrictedKeyword) {
+                // automatic semicolon insertion
+                _tokenLine = _currentLineNumber;
+                _tokenStartPtr = _codePtr - 1; // ### TODO: insert it before the optional \r sequence.
+                return T_SEMICOLON;
             } else {
-                record16(current);
+                _terminator = true;
+                syncProhibitAutomaticSemicolon();
             }
-            break;
-            // Escape Sequences inside of strings
-        case InEscapeSequence:
-            if (isOctalDigit(current)) {
-                if (current >= '0' && current <= '3' &&
-                     isOctalDigit(next1) && isOctalDigit(next2)) {
-                    record16(convertOctal(current, next1, next2));
-                    shift(2);
-                    state = InString;
-                } else if (isOctalDigit(current) &&
-                            isOctalDigit(next1)) {
-                    record16(convertOctal('0', current, next1));
-                    shift(1);
-                    state = InString;
-                } else if (isOctalDigit(current)) {
-                    record16(convertOctal('0', '0', current));
-                    state = InString;
-                } else {
-                    setDone(Bad);
-                    err = IllegalEscapeSequence;
-                    errmsg = QCoreApplication::translate("QDeclarativeParser", "Illegal escape sequence");
-                }
-            } else if (current == 'x')
-                state = InHexEscape;
-            else if (current == 'u')
-                state = InUnicodeEscape;
-            else {
-                if (isLineTerminator()) {
-                    shiftWindowsLineBreak();
-                    yylineno++;
-                    yycolumn = 0;
-                    bol = true;
-                } else {
-                    record16(singleEscape(current));
+        }
+
+        scanChar();
+    }
+
+    _tokenStartPtr = _codePtr - 1;
+    _tokenLine = _currentLineNumber;
+
+    if (_char.isNull())
+        return EOF_SYMBOL;
+
+    const QChar ch = _char;
+    scanChar();
+
+    switch (ch.unicode()) {
+    case '~': return T_TILDE;
+    case '}': return T_RBRACE;
+
+    case '|':
+        if (_char == QLatin1Char('|')) {
+            scanChar();
+            return T_OR_OR;
+        } else if (_char == QLatin1Char('=')) {
+            scanChar();
+            return T_OR_EQ;
+        }
+        return T_OR;
+
+    case '{': return T_LBRACE;
+
+    case '^':
+        if (_char == QLatin1Char('=')) {
+            scanChar();
+            return T_XOR_EQ;
+        }
+        return T_XOR;
+
+    case ']': return T_RBRACKET;
+    case '[': return T_LBRACKET;
+    case '?': return T_QUESTION;
+
+    case '>':
+        if (_char == QLatin1Char('>')) {
+            scanChar();
+            if (_char == QLatin1Char('>')) {
+                scanChar();
+                if (_char == QLatin1Char('=')) {
+                    scanChar();
+                    return T_GT_GT_GT_EQ;
                 }
-                state = InString;
+                return T_GT_GT_GT;
+            } else if (_char == QLatin1Char('=')) {
+                scanChar();
+                return T_GT_GT_EQ;
             }
-            break;
-        case InHexEscape:
-            if (isHexDigit(current) && isHexDigit(next1)) {
-                state = InString;
-                record16(QLatin1Char(convertHex(current, next1)));
-                shift(1);
-            } else if (current == stringType) {
-                record16(QLatin1Char('x'));
-                shift(1);
-                setDone(String);
-            } else {
-                record16(QLatin1Char('x'));
-                record16(current);
-                state = InString;
-            }
-            break;
-        case InUnicodeEscape:
-            if (isHexDigit(current) && isHexDigit(next1) &&
-                 isHexDigit(next2) && isHexDigit(next3)) {
-                record16(convertUnicode(current, next1, next2, next3));
-                shift(3);
-                state = InString;
-            } else if (current == stringType) {
-                record16(QLatin1Char('u'));
-                shift(1);
-                setDone(String);
-            } else {
-                setDone(Bad);
-                err = IllegalUnicodeEscapeSequence;
-                errmsg = QCoreApplication::translate("QDeclarativeParser", "Illegal unicode escape sequence");
-            }
-            break;
-        case InSingleLineComment:
-            if (isLineTerminator()) {
-                shiftWindowsLineBreak();
-                yylineno++;
-                yycolumn = 0;
-                terminator = true;
-                bol = true;
-                if (restrKeyword) {
-                    token = QDeclarativeJSGrammar::T_SEMICOLON;
-                    setDone(Other);
-                } else
-                    state = Start;
-                if (driver) driver->addComment(startpos+2, tokenLength()-2, startlineno, startcolumn+2);
-            } else if (current == 0) {
-                if (driver) driver->addComment(startpos+2, tokenLength()-2, startlineno, startcolumn+2);
-                setDone(Eof);
+            return T_GT_GT;
+        } else if (_char == QLatin1Char('=')) {
+            scanChar();
+            return T_GE;
+        }
+        return T_GT;
+
+    case '=':
+        if (_char == QLatin1Char('=')) {
+            scanChar();
+            if (_char == QLatin1Char('=')) {
+                scanChar();
+                return T_EQ_EQ_EQ;
             }
-
-            break;
-        case InMultiLineComment:
-            if (current == 0) {
-                setDone(Bad);
-                err = UnclosedComment;
-                errmsg = QCoreApplication::translate("QDeclarativeParser", "Unclosed comment at end of file");
-                if (driver) driver->addComment(startpos+2, tokenLength()-2, startlineno, startcolumn+2);
-            } else if (isLineTerminator()) {
-                shiftWindowsLineBreak();
-                yylineno++;
-            } else if (current == '*' && next1 == '/') {
-                state = Start;
-                shift(1);
-                if (driver) driver->addComment(startpos+2, tokenLength()-3, startlineno, startcolumn+2);
+            return T_EQ_EQ;
+        }
+        return T_EQ;
+
+    case '<':
+        if (_char == QLatin1Char('=')) {
+            scanChar();
+            return T_LE;
+        } else if (_char == QLatin1Char('<')) {
+            scanChar();
+            if (_char == QLatin1Char('=')) {
+                scanChar();
+                return T_LT_LT_EQ;
             }
-
-            break;
-        case InIdentifier:
-            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;
+            return T_LT_LT;
+        }
+        return T_LT;
+
+    case ';': return T_SEMICOLON;
+    case ':': return T_COLON;
+
+    case '/':
+        if (_char == QLatin1Char('*')) {
+            scanChar();
+            while (!_char.isNull()) {
+                if (_char == QLatin1Char('*')) {
+                    scanChar();
+                    if (_char == QLatin1Char('/')) {
+                        scanChar();
+                        goto again;
+                    }
                 } else {
-                    setDone(Bad);
-                    err = IllegalUnicodeEscapeSequence;
-                    errmsg = QCoreApplication::translate("QDeclarativeParser", "Illegal unicode escape sequence");
-                    break;
+                    scanChar();
                 }
             }
-            setDone(Identifier);
-            break;
-        case InNum0:
-            if (current == 'x' || current == 'X') {
-                record8(current);
-                state = InHex;
-            } else if (current == '.') {
-                record8(current);
-                state = InDecimal;
-            } else if (current == 'e' || current == 'E') {
-                record8(current);
-                state = InExponentIndicator;
-            } else if (isOctalDigit(current)) {
-                record8(current);
-                state = InOctal;
-            } else if (isDecimalDigit(current)) {
-                record8(current);
-                state = InDecimal;
-            } else {
-                setDone(Number);
+        } else if (_char == QLatin1Char('/')) {
+            while (!_char.isNull() && _char != QLatin1Char('\n')) {
+                scanChar();
             }
-            break;
-        case InHex:
-            if (isHexDigit(current))
-                record8(current);
-            else
-                setDone(Hex);
-            break;
-        case InOctal:
-            if (isOctalDigit(current)) {
-                record8(current);
-            } else if (isDecimalDigit(current)) {
-                record8(current);
-                state = InDecimal;
-            } else {
-                setDone(Octal);
-            }
-            break;
-        case InNum:
-            if (isDecimalDigit(current)) {
-                record8(current);
-            } else if (current == '.') {
-                record8(current);
-                state = InDecimal;
-            } else if (current == 'e' || current == 'E') {
-                record8(current);
-                state = InExponentIndicator;
-            } else {
-                setDone(Number);
-            }
-            break;
-        case InDecimal:
-            if (isDecimalDigit(current)) {
-                record8(current);
-            } else if (current == 'e' || current == 'E') {
-                record8(current);
-                state = InExponentIndicator;
-            } else {
-                setDone(Number);
+            goto again;
+        } if (_char == QLatin1Char('=')) {
+            scanChar();
+            return T_DIVIDE_EQ;
+        }
+        return T_DIVIDE_;
+
+    case '.':
+        if (_char.isDigit()) {
+            QByteArray chars;
+            chars.reserve(32);
+            while (_char.isLetterOrNumber() || _char == QLatin1Char('.')) {
+                if (_char == QLatin1Char('e') || _char == QLatin1Char('E')) {
+                    chars += _char.unicode();
+                    scanChar(); // skip e
+
+                    if (_char == QLatin1Char('+') || _char == QLatin1Char('-')) {
+                        chars += _char.unicode();
+                        scanChar(); // skip +/-
+                    }
+                } else {
+                    chars += _char.unicode();
+                    scanChar();
+                }
             }
-            break;
-        case InExponentIndicator:
-            if (current == '+' || current == '-') {
-                record8(current);
-            } else if (isDecimalDigit(current)) {
-                record8(current);
-                state = InExponent;
-            } else {
-                setDone(Bad);
-                err = IllegalExponentIndicator;
-                errmsg = QCoreApplication::translate("QDeclarativeParser", "Illegal syntax for exponential number");
+            const char *begin = chars.constData();
+            const char *end = 0;
+            bool ok = false;
+            _tokenValue = qstrtod(begin, &end, &ok);
+
+            if (! ok || end != chars.end()) {
+                _errorCode = IllegalExponentIndicator;
+                _errorMessage = QCoreApplication::translate("QDeclarativeParser", "Illegal syntax for exponential number");
+                return T_ERROR;
             }
-            break;
-        case InExponent:
-            if (isDecimalDigit(current)) {
-                record8(current);
-            } else {
-                setDone(Number);
+
+            return T_NUMERIC_LITERAL;
+        }
+        return T_DOT;
+
+    case '-':
+        if (_char == QLatin1Char('=')) {
+            scanChar();
+            return T_MINUS_EQ;
+        } else if (_char == QLatin1Char('-')) {
+            scanChar();
+
+            if (_terminator && !_delimited && !_prohibitAutomaticSemicolon) {
+                _stackToken = T_PLUS_PLUS;
+                return T_SEMICOLON;
             }
-            break;
-        default:
-            Q_ASSERT_X(0, "Lexer::lex", "Unhandled state in switch statement");
+
+            return T_MINUS_MINUS;
         }
+        return T_MINUS;
 
-        // move on to the next character
-        if (!done)
-            shift(1);
-        if (state != Start && state != InSingleLineComment)
-            bol = false;
-    }
+    case ',': return T_COMMA;
 
-    // no identifiers allowed directly after numeric literal, e.g. "3in" is bad
-    if ((state == Number || state == Octal || state == Hex)
-         && isIdentLetter(current)) {
-        state = Bad;
-        err = IllegalIdentifier;
-        errmsg = QCoreApplication::translate("QDeclarativeParser", "Identifier cannot start with numeric literal");
-    }
+    case '+':
+        if (_char == QLatin1Char('=')) {
+            scanChar();
+            return T_PLUS_EQ;
+        } else if (_char == QLatin1Char('+')) {
+            scanChar();
 
-    // terminate string
-    buffer8[pos8] = '\0';
-
-    double dval = 0;
-    if (state == Number) {
-        dval = qstrtod(buffer8, 0, 0);
-    } else if (state == Hex) { // scan hex numbers
-        dval = integerFromString(buffer8, pos8, 16);
-        state = Number;
-    } else if (state == Octal) {   // scan octal number
-        dval = integerFromString(buffer8, pos8, 8);
-        state = Number;
-    }
+            if (_terminator && !_delimited && !_prohibitAutomaticSemicolon) {
+                _stackToken = T_PLUS_PLUS;
+                return T_SEMICOLON;
+            }
 
-    restrKeyword = false;
-    delimited = false;
+            return T_PLUS_PLUS;
+        }
+        return T_PLUS;
 
-    switch (parenthesesState) {
-    case IgnoreParentheses:
-        break;
-    case CountParentheses:
-        if (token == QDeclarativeJSGrammar::T_RPAREN) {
-            --parenthesesCount;
-            if (parenthesesCount == 0)
-                parenthesesState = BalancedParentheses;
-        } else if (token == QDeclarativeJSGrammar::T_LPAREN) {
-            ++parenthesesCount;
+    case '*':
+        if (_char == QLatin1Char('=')) {
+            scanChar();
+            return T_STAR_EQ;
         }
-        break;
-    case BalancedParentheses:
-        parenthesesState = IgnoreParentheses;
-        break;
-    }
+        return T_STAR;
+
+    case ')': return T_RPAREN;
+    case '(': return T_LPAREN;
+
+    case '&':
+        if (_char == QLatin1Char('=')) {
+            scanChar();
+            return T_AND_EQ;
+        } else if (_char == QLatin1Char('&')) {
+            scanChar();
+            return T_AND_AND;
+        }
+        return T_AND;
 
-    switch (state) {
-    case Eof:
-        return 0;
-    case Other:
-        if (token == QDeclarativeJSGrammar::T_RBRACE || token == QDeclarativeJSGrammar::T_SEMICOLON)
-            delimited = true;
-        return token;
-    case Identifier:
-        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);
-            else
-                qsyylval.ustr = 0;
-            return QDeclarativeJSGrammar::T_IDENTIFIER;
+    case '%':
+        if (_char == QLatin1Char('=')) {
+            scanChar();
+            return T_REMAINDER_EQ;
         }
-        if (token == QDeclarativeJSGrammar::T_CONTINUE || token == QDeclarativeJSGrammar::T_BREAK
-            || token == QDeclarativeJSGrammar::T_RETURN || token == QDeclarativeJSGrammar::T_THROW) {
-            restrKeyword = true;
-        } else if (token == QDeclarativeJSGrammar::T_IF || token == QDeclarativeJSGrammar::T_FOR
-                   || token == QDeclarativeJSGrammar::T_WHILE || token == QDeclarativeJSGrammar::T_WITH) {
-            parenthesesState = CountParentheses;
-            parenthesesCount = 0;
-        } else if (token == QDeclarativeJSGrammar::T_DO) {
-            parenthesesState = BalancedParentheses;
+        return T_REMAINDER;
+
+    case '!':
+        if (_char == QLatin1Char('=')) {
+            scanChar();
+            if (_char == QLatin1Char('=')) {
+                scanChar();
+                return T_NOT_EQ_EQ;
+            }
+            return T_NOT_EQ;
         }
-        return token;
-    case String:
-        if (driver)
-            qsyylval.ustr = driver->intern(buffer16, pos16);
-        else
-            qsyylval.ustr = 0;
-        return multiLineString?QDeclarativeJSGrammar::T_MULTILINE_STRING_LITERAL:QDeclarativeJSGrammar::T_STRING_LITERAL;
-    case Number:
-        qsyylval.dval = dval;
-        return QDeclarativeJSGrammar::T_NUMERIC_LITERAL;
-    case Bad:
-        return -1;
-    default:
-        Q_ASSERT(!"unhandled numeration value in switch");
-        return -1;
-    }
-}
+        return T_NOT;
 
-bool Lexer::isWhiteSpace() const
-{
-    return (current == ' ' || current == '\t' ||
-             current == 0x0b || current == 0x0c);
-}
+    case '\'':
+    case '"': {
+        const QChar quote = ch;
+        _tokenText.clear();
+        _validTokenText = true;
+
+        bool multilineStringLiteral = false;
+
+        while (! _char.isNull()) {
+            if (_char == QLatin1Char('\n')) {
+                multilineStringLiteral = true;
+                _tokenText += _char;
+                scanChar();
+            } else if (_char == quote) {
+                scanChar();
+
+                if (_engine)
+                    _tokenSpell = _engine->newStringRef(_tokenText);
+
+                return multilineStringLiteral ? T_MULTILINE_STRING_LITERAL : T_STRING_LITERAL;
+            } else if (_char == QLatin1Char('\\')) {
+                scanChar();
+
+                QChar u;
+                bool ok = false;
+
+                switch (_char.unicode()) {
+                // unicode escape sequence
+                case 'u':
+                    u = decodeUnicodeEscapeCharacter(&ok);
+                    if (! ok)
+                        u = _char;
+                    break;
 
-bool Lexer::isLineTerminator() const
-{
-    return (current == '\n' || current == '\r');
-}
+                // hex escape sequence
+                case 'x':
+                case 'X':
+                    if (isHexDigit(_codePtr[0]) && isHexDigit(_codePtr[1])) {
+                        scanChar();
 
-bool Lexer::isIdentLetter(ushort c)
-{
-    // ASCII-biased, since all reserved words are ASCII, aand hence the
-    // bulk of content to be parsed.
-    if ((c >= 'a' && c <= 'z')
-            || (c >= 'A' && c <= 'Z')
-            || c == '$'
-            || c == '_')
-        return true;
-    if (c < 128)
-        return false;
-    return QChar(c).isLetterOrNumber();
-}
+                        const QChar c1 = _char;
+                        scanChar();
 
-bool Lexer::isDecimalDigit(ushort c)
-{
-    return (c >= '0' && c <= '9');
-}
+                        const QChar c2 = _char;
+                        scanChar();
 
-bool Lexer::isHexDigit(ushort c) const
-{
-    return ((c >= '0' && c <= '9')
-            || (c >= 'a' && c <= 'f')
-            || (c >= 'A' && c <= 'F'));
-}
+                        u = convertHex(c1, c2);
+                    } else {
+                        u = _char;
+                    }
+                    break;
 
-bool Lexer::isOctalDigit(ushort c) const
-{
-    return (c >= '0' && c <= '7');
-}
+                // single character escape sequence
+                case '\\': u = QLatin1Char('\''); scanChar(); break;
+                case '\'': u = QLatin1Char('\''); scanChar(); break;
+                case '\"': u = QLatin1Char('\"'); scanChar(); break;
+                case 'b':  u = QLatin1Char('\b'); scanChar(); break;
+                case 'f':  u = QLatin1Char('\f'); scanChar(); break;
+                case 'n':  u = QLatin1Char('\n'); scanChar(); break;
+                case 'r':  u = QLatin1Char('\r'); scanChar(); break;
+                case 't':  u = QLatin1Char('\t'); scanChar(); break;
+                case 'v':  u = QLatin1Char('\v'); scanChar(); break;
+
+                case '0':
+                    if (! _codePtr[1].isDigit()) {
+                        scanChar();
+                        u = QLatin1Char('\0');
+                    } else {
+                        // ### parse deprecated octal escape sequence ?
+                        u = _char;
+                    }
+                    break;
 
-int Lexer::matchPunctuator(ushort c1, ushort c2,
-                            ushort c3, ushort c4)
-{
-    if (c1 == '>' && c2 == '>' && c3 == '>' && c4 == '=') {
-        shift(4);
-        return QDeclarativeJSGrammar::T_GT_GT_GT_EQ;
-    } else if (c1 == '=' && c2 == '=' && c3 == '=') {
-        shift(3);
-        return QDeclarativeJSGrammar::T_EQ_EQ_EQ;
-    } else if (c1 == '!' && c2 == '=' && c3 == '=') {
-        shift(3);
-        return QDeclarativeJSGrammar::T_NOT_EQ_EQ;
-    } else if (c1 == '>' && c2 == '>' && c3 == '>') {
-        shift(3);
-        return QDeclarativeJSGrammar::T_GT_GT_GT;
-    } else if (c1 == '<' && c2 == '<' && c3 == '=') {
-        shift(3);
-        return QDeclarativeJSGrammar::T_LT_LT_EQ;
-    } else if (c1 == '>' && c2 == '>' && c3 == '=') {
-        shift(3);
-        return QDeclarativeJSGrammar::T_GT_GT_EQ;
-    } else if (c1 == '<' && c2 == '=') {
-        shift(2);
-        return QDeclarativeJSGrammar::T_LE;
-    } else if (c1 == '>' && c2 == '=') {
-        shift(2);
-        return QDeclarativeJSGrammar::T_GE;
-    } else if (c1 == '!' && c2 == '=') {
-        shift(2);
-        return QDeclarativeJSGrammar::T_NOT_EQ;
-    } else if (c1 == '+' && c2 == '+') {
-        shift(2);
-        return QDeclarativeJSGrammar::T_PLUS_PLUS;
-    } else if (c1 == '-' && c2 == '-') {
-        shift(2);
-        return QDeclarativeJSGrammar::T_MINUS_MINUS;
-    } else if (c1 == '=' && c2 == '=') {
-        shift(2);
-        return QDeclarativeJSGrammar::T_EQ_EQ;
-    } else if (c1 == '+' && c2 == '=') {
-        shift(2);
-        return QDeclarativeJSGrammar::T_PLUS_EQ;
-    } else if (c1 == '-' && c2 == '=') {
-        shift(2);
-        return QDeclarativeJSGrammar::T_MINUS_EQ;
-    } else if (c1 == '*' && c2 == '=') {
-        shift(2);
-        return QDeclarativeJSGrammar::T_STAR_EQ;
-    } else if (c1 == '/' && c2 == '=') {
-        shift(2);
-        return QDeclarativeJSGrammar::T_DIVIDE_EQ;
-    } else if (c1 == '&' && c2 == '=') {
-        shift(2);
-        return QDeclarativeJSGrammar::T_AND_EQ;
-    } else if (c1 == '^' && c2 == '=') {
-        shift(2);
-        return QDeclarativeJSGrammar::T_XOR_EQ;
-    } else if (c1 == '%' && c2 == '=') {
-        shift(2);
-        return QDeclarativeJSGrammar::T_REMAINDER_EQ;
-    } else if (c1 == '|' && c2 == '=') {
-        shift(2);
-        return QDeclarativeJSGrammar::T_OR_EQ;
-    } else if (c1 == '<' && c2 == '<') {
-        shift(2);
-        return QDeclarativeJSGrammar::T_LT_LT;
-    } else if (c1 == '>' && c2 == '>') {
-        shift(2);
-        return QDeclarativeJSGrammar::T_GT_GT;
-    } else if (c1 == '&' && c2 == '&') {
-        shift(2);
-        return QDeclarativeJSGrammar::T_AND_AND;
-    } else if (c1 == '|' && c2 == '|') {
-        shift(2);
-        return QDeclarativeJSGrammar::T_OR_OR;
-    }
+                case '\r':
+                    while (_char == QLatin1Char('\r'))
+                        scanChar();
+
+                    if (_char == '\n') {
+                        u = _char;
+                        scanChar();
+                    } else {
+                        u = QLatin1Char('\n');
+                    }
 
-    switch(c1) {
-        case '=': shift(1); return QDeclarativeJSGrammar::T_EQ;
-        case '>': shift(1); return QDeclarativeJSGrammar::T_GT;
-        case '<': shift(1); return QDeclarativeJSGrammar::T_LT;
-        case ',': shift(1); return QDeclarativeJSGrammar::T_COMMA;
-        case '!': shift(1); return QDeclarativeJSGrammar::T_NOT;
-        case '~': shift(1); return QDeclarativeJSGrammar::T_TILDE;
-        case '?': shift(1); return QDeclarativeJSGrammar::T_QUESTION;
-        case ':': shift(1); return QDeclarativeJSGrammar::T_COLON;
-        case '.': shift(1); return QDeclarativeJSGrammar::T_DOT;
-        case '+': shift(1); return QDeclarativeJSGrammar::T_PLUS;
-        case '-': shift(1); return QDeclarativeJSGrammar::T_MINUS;
-        case '*': shift(1); return QDeclarativeJSGrammar::T_STAR;
-        case '/': shift(1); return QDeclarativeJSGrammar::T_DIVIDE_;
-        case '&': shift(1); return QDeclarativeJSGrammar::T_AND;
-        case '|': shift(1); return QDeclarativeJSGrammar::T_OR;
-        case '^': shift(1); return QDeclarativeJSGrammar::T_XOR;
-        case '%': shift(1); return QDeclarativeJSGrammar::T_REMAINDER;
-        case '(': shift(1); return QDeclarativeJSGrammar::T_LPAREN;
-        case ')': shift(1); return QDeclarativeJSGrammar::T_RPAREN;
-        case '{': shift(1); return QDeclarativeJSGrammar::T_LBRACE;
-        case '}': shift(1); return QDeclarativeJSGrammar::T_RBRACE;
-        case '[': shift(1); return QDeclarativeJSGrammar::T_LBRACKET;
-        case ']': shift(1); return QDeclarativeJSGrammar::T_RBRACKET;
-        case ';': shift(1); return QDeclarativeJSGrammar::T_SEMICOLON;
-
-        default: return -1;
+                    break;
+
+                case '\n':
+                    u = _char;
+                    scanChar();
+                    break;
+
+                default:
+                    // non escape character
+                    u = _char;
+                    scanChar();
+                }
+
+                _tokenText += u;
+            } else {
+                _tokenText += _char;
+                scanChar();
+            }
+        }
+
+        _errorCode = UnclosedStringLiteral;
+        _errorMessage = QCoreApplication::translate("QDeclarativeParser", "Unclosed string at end of line");
+        return T_ERROR;
     }
-}
 
-ushort Lexer::singleEscape(ushort c) const
-{
-    switch(c) {
-    case 'b':
-        return 0x08;
-    case 't':
-        return 0x09;
-    case 'n':
-        return 0x0A;
-    case 'v':
-        return 0x0B;
-    case 'f':
-        return 0x0C;
-    case 'r':
-        return 0x0D;
-    case '"':
-        return 0x22;
-    case '\'':
-        return 0x27;
-    case '\\':
-        return 0x5C;
     default:
-        return c;
-    }
-}
+        if (ch.isLetter() || ch == QLatin1Char('$') || ch == QLatin1Char('_') || (ch == QLatin1Char('\\') && _char == QLatin1Char('u'))) {
+            bool identifierWithEscapeChars = false;
+            if (ch == QLatin1Char('\\')) {
+                identifierWithEscapeChars = true;
+                _tokenText.clear();
+                bool ok = false;
+                _tokenText += decodeUnicodeEscapeCharacter(&ok);
+                _validTokenText = true;
+                if (! ok) {
+                    _errorCode = IllegalUnicodeEscapeSequence;
+                    _errorMessage = QCoreApplication::translate("QDeclarativeParser", "Illegal unicode escape sequence");
+                    return T_ERROR;
+                }
+            }
+            while (true) {
+                if (_char.isLetterOrNumber() || _char == QLatin1Char('$') || _char == QLatin1Char('_')) {
+                    if (identifierWithEscapeChars)
+                        _tokenText += _char;
+
+                    scanChar();
+                } else if (_char == QLatin1Char('\\') && _codePtr[0] == QLatin1Char('u')) {
+                    if (! identifierWithEscapeChars) {
+                        identifierWithEscapeChars = true;
+                        _tokenText = QString(_tokenStartPtr, _codePtr - _tokenStartPtr - 1);
+                        _validTokenText = true;
+                    }
 
-ushort Lexer::convertOctal(ushort c1, ushort c2,
-                            ushort c3) const
-{
-    return ((c1 - '0') * 64 + (c2 - '0') * 8 + c3 - '0');
-}
+                    scanChar(); // skip '\\'
+                    bool ok = false;
+                    _tokenText += decodeUnicodeEscapeCharacter(&ok);
+                    if (! ok) {
+                        _errorCode = IllegalUnicodeEscapeSequence;
+                        _errorMessage = QCoreApplication::translate("QDeclarativeParser", "Illegal unicode escape sequence");
+                        return T_ERROR;
+                    }
+                } else {
+                    _tokenLength = _codePtr - _tokenStartPtr - 1;
 
-unsigned char Lexer::convertHex(ushort c)
-{
-    if (c >= '0' && c <= '9')
-        return (c - '0');
-    else if (c >= 'a' && c <= 'f')
-        return (c - 'a' + 10);
-    else
-        return (c - 'A' + 10);
-}
+                    int kind = T_IDENTIFIER;
 
-unsigned char Lexer::convertHex(ushort c1, ushort c2)
-{
-    return ((convertHex(c1) << 4) + convertHex(c2));
-}
+                    if (! identifierWithEscapeChars)
+                        kind = classify(_tokenStartPtr, _tokenLength);
 
-QChar Lexer::convertUnicode(ushort c1, ushort c2,
-                             ushort c3, ushort c4)
-{
-    return QChar((convertHex(c3) << 4) + convertHex(c4),
-                  (convertHex(c1) << 4) + convertHex(c2));
-}
+                    if (_engine) {
+                        if (kind == T_IDENTIFIER && identifierWithEscapeChars)
+                            _tokenSpell = _engine->newStringRef(_tokenText);
+                        else
+                            _tokenSpell = _engine->midRef(_tokenStartPtr - _code.unicode(), _tokenLength);
+                    }
 
-void Lexer::record8(ushort c)
-{
-    Q_ASSERT(c <= 0xff);
-
-    // enlarge buffer if full
-    if (pos8 >= size8 - 1) {
-        char *tmp = new char[2 * size8];
-        memcpy(tmp, buffer8, size8 * sizeof(char));
-        delete [] buffer8;
-        buffer8 = tmp;
-        size8 *= 2;
-    }
+                    return kind;
+                }
+            }
+        } else if (ch.isDigit()) {
+            QByteArray chars;
+            chars.reserve(32);
+            chars += ch.unicode();
+
+            while (_char.isLetterOrNumber() || _char == QLatin1Char('.')) {
+                if (_char == QLatin1Char('e') || _char == QLatin1Char('E')) {
+                    chars += _char.unicode();
+                    scanChar(); // skip e
+
+                    if (_char == QLatin1Char('+') || _char == QLatin1Char('-')) {
+                        chars += _char.unicode();
+                        scanChar(); // skip +/-
+                    }
+                } else {
+                    chars += _char.unicode();
+                    scanChar();
+                }
+            }
+            const char *begin = chars.constData();
+            const char *end = 0;
+            bool ok = false;
 
-    buffer8[pos8++] = (char) c;
-}
+            _tokenValue = qstrtod(begin, &end, &ok);
 
-void Lexer::record16(QChar c)
-{
-    // enlarge buffer if full
-    if (pos16 >= size16 - 1) {
-        QChar *tmp = new QChar[2 * size16];
-        memcpy(tmp, buffer16, size16 * sizeof(QChar));
-        delete [] buffer16;
-        buffer16 = tmp;
-        size16 *= 2;
-    }
+            if (! ok || end != chars.end()) {
+                _errorCode = IllegalExponentIndicator;
+                _errorMessage = QCoreApplication::translate("QDeclarativeParser", "Illegal syntax for exponential number");
+                return T_ERROR;
+            }
 
-    buffer16[pos16++] = c;
-}
+            return T_NUMERIC_LITERAL;
+        }
 
-void Lexer::recordStartPos()
-{
-    startpos = pos;
-    startlineno = yylineno;
-    startcolumn = yycolumn;
+        break;
+    }
+
+    return T_ERROR;
 }
 
 bool Lexer::scanRegExp(RegExpBodyPrefix prefix)
 {
-    pos16 = 0;
-    pattern = 0;
+    _tokenText.clear();
+    _validTokenText = true;
+    _patternFlags = 0;
 
     if (prefix == EqualPrefix)
-        record16(QLatin1Char('='));
+        _tokenText += QLatin1Char('=');
 
     while (true) {
-        switch (current) {
-
+        switch (_char.unicode()) {
         case 0: // eof
         case '\n': case '\r': // line terminator
-            errmsg = QCoreApplication::translate("QDeclarativeParser", "Unterminated regular expression literal");
+            _errorMessage = QCoreApplication::translate("QDeclarativeParser", "Unterminated regular expression literal");
             return false;
 
         case '/':
-            shift(1);
-
-            if (driver) // create the pattern
-                pattern = driver->intern(buffer16, pos16);
+            scanChar();
 
             // scan the flags
-            pos16 = 0;
-            flags = 0;
-            while (isIdentLetter(current)) {
-                int flag = Ecma::RegExp::flagFromChar(current);
+            _patternFlags = 0;
+            while (isIdentLetter(_char)) {
+                int flag = flagFromChar(_char);
                 if (flag == 0) {
-                    errmsg = QCoreApplication::translate("QDeclarativeParser", "Invalid regular expression flag '%0'")
-                             .arg(QChar(current));
+                    _errorMessage = QCoreApplication::translate("QDeclarativeParser", "Invalid regular expression flag '%0'")
+                             .arg(QChar(_char));
                     return false;
                 }
-                flags |= flag;
-                record16(current);
-                shift(1);
+                _patternFlags |= flag;
+                scanChar();
             }
             return true;
 
         case '\\':
             // regular expression backslash sequence
-            record16(current);
-            shift(1);
+            _tokenText += _char;
+            scanChar();
 
-            if (! current || isLineTerminator()) {
-                errmsg = QCoreApplication::translate("QDeclarativeParser", "Unterminated regular expression backslash sequence");
+            if (_char.isNull() || isLineTerminator()) {
+                _errorMessage = QCoreApplication::translate("QDeclarativeParser", "Unterminated regular expression backslash sequence");
                 return false;
             }
 
-            record16(current);
-            shift(1);
+            _tokenText += _char;
+            scanChar();
             break;
 
         case '[':
             // regular expression class
-            record16(current);
-            shift(1);
+            _tokenText += _char;
+            scanChar();
 
-            while (current && ! isLineTerminator()) {
-                if (current == ']')
+            while (! _char.isNull() && ! isLineTerminator()) {
+                if (_char == QLatin1Char(']'))
                     break;
-                else if (current == '\\') {
+                else if (_char == QLatin1Char('\\')) {
                     // regular expression backslash sequence
-                    record16(current);
-                    shift(1);
+                    _tokenText += _char;
+                    scanChar();
 
-                    if (! current || isLineTerminator()) {
-                        errmsg = QCoreApplication::translate("QDeclarativeParser", "Unterminated regular expression backslash sequence");
+                    if (_char.isNull() || isLineTerminator()) {
+                        _errorMessage = QCoreApplication::translate("QDeclarativeParser", "Unterminated regular expression backslash sequence");
                         return false;
                     }
 
-                    record16(current);
-                    shift(1);
+                    _tokenText += _char;
+                    scanChar();
                 } else {
-                    record16(current);
-                    shift(1);
+                    _tokenText += _char;
+                    scanChar();
                 }
             }
 
-            if (current != ']') {
-                errmsg = QCoreApplication::translate("QDeclarativeParser", "Unterminated regular expression class");
+            if (_char != QLatin1Char(']')) {
+                _errorMessage = QCoreApplication::translate("QDeclarativeParser", "Unterminated regular expression class");
                 return false;
             }
 
-            record16(current);
-            shift(1); // skip ]
+            _tokenText += _char;
+            scanChar(); // skip ]
             break;
 
         default:
-            record16(current);
-            shift(1);
+            _tokenText += _char;
+            scanChar();
         } // switch
     } // while
 
     return false;
 }
 
+bool Lexer::isLineTerminator() const
+{
+    return (_char == QLatin1Char('\n') || _char == QLatin1Char('\r'));
+}
+
+bool Lexer::isIdentLetter(QChar ch)
+{
+    // ASCII-biased, since all reserved words are ASCII, aand hence the
+    // bulk of content to be parsed.
+    if ((ch >= QLatin1Char('a') && ch <= QLatin1Char('z'))
+            || (ch >= QLatin1Char('A') && ch <= QLatin1Char('Z'))
+            || ch == QLatin1Char('$')
+            || ch == QLatin1Char('_'))
+        return true;
+    if (ch.unicode() < 128)
+        return false;
+    return ch.isLetterOrNumber();
+}
+
+bool Lexer::isDecimalDigit(ushort c)
+{
+    return (c >= '0' && c <= '9');
+}
+
+bool Lexer::isHexDigit(QChar c)
+{
+    return ((c >= QLatin1Char('0') && c <= QLatin1Char('9'))
+            || (c >= QLatin1Char('a') && c <= QLatin1Char('f'))
+            || (c >= QLatin1Char('A') && c <= QLatin1Char('F')));
+}
+
+bool Lexer::isOctalDigit(ushort c)
+{
+    return (c >= '0' && c <= '7');
+}
+
+int Lexer::tokenOffset() const
+{
+    return _tokenStartPtr - _code.unicode();
+}
+
+int Lexer::tokenLength() const
+{
+    return _tokenLength;
+}
+
+int Lexer::tokenStartLine() const
+{
+    return _tokenLine;
+}
+
+int Lexer::tokenStartColumn() const
+{
+    return _tokenStartPtr - _tokenLinePtr + 1;
+}
+
+int Lexer::tokenEndLine() const
+{
+    return _currentLineNumber;
+}
+
+int Lexer::tokenEndColumn() const
+{
+    return _codePtr - _lastLinePtr;
+}
+
+QStringRef Lexer::tokenSpell() const
+{
+    return _tokenSpell;
+}
+
+double Lexer::tokenValue() const
+{
+    return _tokenValue;
+}
+
+QString Lexer::tokenText() const
+{
+    if (_validTokenText)
+        return _tokenText;
+
+    return QString(_tokenStartPtr, _tokenLength);
+}
+
+Lexer::Error Lexer::errorCode() const
+{
+    return _errorCode;
+}
+
+QString Lexer::errorMessage() const
+{
+    return _errorMessage;
+}
+
 void Lexer::syncProhibitAutomaticSemicolon()
 {
-    if (parenthesesState == BalancedParentheses) {
+    if (_parenthesesState == BalancedParentheses) {
         // we have seen something like "if (foo)", which means we should
         // never insert an automatic semicolon at this point, since it would
         // then be expanded into an empty statement (ECMA-262 7.9.1)
-        prohibitAutomaticSemicolon = true;
-        parenthesesState = IgnoreParentheses;
+        _prohibitAutomaticSemicolon = true;
+        _parenthesesState = IgnoreParentheses;
     } else {
-        prohibitAutomaticSemicolon = false;
+        _prohibitAutomaticSemicolon = false;
     }
 }
 
-QT_QML_END_NAMESPACE
-
+bool Lexer::prevTerminator() const
+{
+    return _terminator;
+}
 
+#include "qdeclarativejskeywords_p.h"
index 5147df1..4bc5cc5 100644 (file)
@@ -54,7 +54,7 @@
 //
 
 #include "qdeclarativejsglobal_p.h"
-
+#include "qdeclarativejsgrammar_p.h"
 #include <QtCore/QString>
 
 QT_QML_BEGIN_NAMESPACE
@@ -62,55 +62,41 @@ QT_QML_BEGIN_NAMESPACE
 namespace QDeclarativeJS {
 
 class Engine;
-class NameId;
 
-class QML_PARSER_EXPORT Lexer
+class QML_PARSER_EXPORT Lexer: public QDeclarativeJSGrammar
 {
 public:
-    Lexer(Engine *eng, bool tokenizeComments = false);
-    ~Lexer();
-
-    void setCode(const QString &c, int lineno);
-    int lex();
-
-    int currentLineNo() const { return yylineno; }
-    int currentColumnNo() const { return yycolumn; }
-
-    int tokenOffset() const { return startpos; }
-    int tokenLength() const { return pos - startpos; }
-
-    int startLineNo() const { return startlineno; }
-    int startColumnNo() const { return startcolumn; }
-
-    int endLineNo() const { return currentLineNo(); }
-    int endColumnNo() const
-    { int col = currentColumnNo(); return (col > 0) ? col - 1 : col; }
-
-    bool prevTerminator() const { return terminator; }
-
-    enum State { Start,
-                 Identifier,
-                 InIdentifier,
-                 InSingleLineComment,
-                 InMultiLineComment,
-                 InNum,
-                 InNum0,
-                 InHex,
-                 InOctal,
-                 InDecimal,
-                 InExponentIndicator,
-                 InExponent,
-                 Hex,
-                 Octal,
-                 Number,
-                 String,
-                 Eof,
-                 InString,
-                 InEscapeSequence,
-                 InHexEscape,
-                 InUnicodeEscape,
-                 Other,
-                 Bad };
+    enum {
+        T_ABSTRACT = T_RESERVED_WORD,
+        T_BOOLEAN = T_RESERVED_WORD,
+        T_BYTE = T_RESERVED_WORD,
+        T_CHAR = T_RESERVED_WORD,
+        T_CLASS = T_RESERVED_WORD,
+        T_DOUBLE = T_RESERVED_WORD,
+        T_ENUM = T_RESERVED_WORD,
+        T_EXPORT = T_RESERVED_WORD,
+        T_EXTENDS = T_RESERVED_WORD,
+        T_FINAL = T_RESERVED_WORD,
+        T_FLOAT = T_RESERVED_WORD,
+        T_GOTO = T_RESERVED_WORD,
+        T_IMPLEMENTS = T_RESERVED_WORD,
+        T_INT = T_RESERVED_WORD,
+        T_INTERFACE = T_RESERVED_WORD,
+        T_LET = T_RESERVED_WORD,
+        T_LONG = T_RESERVED_WORD,
+        T_NATIVE = T_RESERVED_WORD,
+        T_PACKAGE = T_RESERVED_WORD,
+        T_PRIVATE = T_RESERVED_WORD,
+        T_PROTECTED = T_RESERVED_WORD,
+        T_SHORT = T_RESERVED_WORD,
+        T_STATIC = T_RESERVED_WORD,
+        T_SUPER = T_RESERVED_WORD,
+        T_SYNCHRONIZED = T_RESERVED_WORD,
+        T_THROWS = T_RESERVED_WORD,
+        T_TRANSIENT = T_RESERVED_WORD,
+        T_VOLATILE = T_RESERVED_WORD,
+        T_YIELD = T_RESERVED_WORD
+    };
 
     enum Error {
         NoError,
@@ -123,127 +109,102 @@ public:
         IllegalIdentifier
     };
 
-    enum ParenthesesState {
-        IgnoreParentheses,
-        CountParentheses,
-        BalancedParentheses
-    };
-
     enum RegExpBodyPrefix {
         NoPrefix,
         EqualPrefix
     };
 
+public:
+    Lexer(Engine *engine);
+
+    QString code() const;
+    void setCode(const QString &code, int lineno);
+
+    int lex();
+
     bool scanRegExp(RegExpBodyPrefix prefix = NoPrefix);
 
-    NameId *pattern;
-    int flags;
+    int regExpFlags() const { return _patternFlags; }
+    QString regExpPattern() const { return _tokenText; }
+
+    int tokenOffset() const;
+    int tokenLength() const;
 
-    State lexerState() const
-        { return state; }
+    int tokenStartLine() const;
+    int tokenStartColumn() const;
 
-    QString errorMessage() const
-        { return errmsg; }
-    void setErrorMessage(const QString &err)
-        { errmsg = err; }
-    void setErrorMessage(const char *err)
-        { setErrorMessage(QString::fromLatin1(err)); }
+    int tokenEndLine() const;
+    int tokenEndColumn() const;
 
-    Error error() const
-        { return err; }
-    void clearError()
-        { err = NoError; }
+    QStringRef tokenSpell() const;
+    double tokenValue() const;
+    QString tokenText() const;
+
+    Error errorCode() const;
+    QString errorMessage() const;
+
+    bool prevTerminator() const;
+
+    enum ParenthesesState {
+        IgnoreParentheses,
+        CountParentheses,
+        BalancedParentheses
+    };
 
 private:
-    Engine *driver;
-    int yylineno;
-    bool done;
-    char *buffer8;
-    QChar *buffer16;
-    uint size8, size16;
-    uint pos8, pos16;
-    bool terminator;
-    bool restrKeyword;
-    // encountered delimiter like "'" and "}" on last run
-    bool delimited;
-    int stackToken;
-
-    State state;
-    void setDone(State s);
-    uint pos;
-    void shift(uint p);
-    int lookupKeyword(const char *);
-
-    bool isWhiteSpace() const;
+    void scanChar();
+    int scanToken();
+
+    int classify(const QChar *s, int n);
+
     bool isLineTerminator() const;
-    bool isHexDigit(ushort c) const;
-    bool isOctalDigit(ushort c) const;
-
-    int matchPunctuator(ushort c1, ushort c2,
-                         ushort c3, ushort c4);
-    ushort singleEscape(ushort c) const;
-    ushort convertOctal(ushort c1, ushort c2,
-                         ushort c3) const;
-public:
-    static unsigned char convertHex(ushort c1);
-    static unsigned char convertHex(ushort c1, ushort c2);
-    static QChar convertUnicode(ushort c1, ushort c2,
-                                 ushort c3, ushort c4);
-    static bool isIdentLetter(ushort c);
+    static bool isIdentLetter(QChar c);
     static bool isDecimalDigit(ushort c);
+    static bool isHexDigit(QChar c);
+    static bool isOctalDigit(ushort c);
+    static bool isUnicodeEscapeSequence(const QChar *chars);
 
-    inline int ival() const { return qsyylval.ival; }
-    inline double dval() const { return qsyylval.dval; }
-    inline NameId *ustr() const { return qsyylval.ustr; }
-
-    const QChar *characterBuffer() const { return buffer16; }
-    int characterCount() const { return pos16; }
+    void syncProhibitAutomaticSemicolon();
+    QChar decodeUnicodeEscapeCharacter(bool *ok);
 
 private:
-    void record8(ushort c);
-    void record16(QChar c);
-    void recordStartPos();
+    Engine *_engine;
 
-    int findReservedWord(const QChar *buffer, int size) const;
+    QString _code;
+    QString _tokenText;
+    QString _errorMessage;
+    QStringRef _tokenSpell;
 
-    void syncProhibitAutomaticSemicolon();
+    const QChar *_codePtr;
+    const QChar *_lastLinePtr;
+    const QChar *_tokenLinePtr;
+    const QChar *_tokenStartPtr;
 
-    const QChar *code;
-    uint length;
-    int yycolumn;
-    int startpos;
-    int startlineno;
-    int startcolumn;
-    int bol;     // begin of line
-
-    union {
-        int ival;
-        double dval;
-        NameId *ustr;
-    } qsyylval;
-
-    // current and following unicode characters
-    ushort current, next1, next2, next3;
-
-    struct keyword {
-        const char *name;
-        int token;
-    };
+    QChar _char;
+    Error _errorCode;
+
+    int _currentLineNumber;
+    double _tokenValue;
+
+    // parentheses state
+    ParenthesesState _parenthesesState;
+    int _parenthesesCount;
 
-    QString errmsg;
-    Error err;
+    int _stackToken;
 
-    bool wantRx;
-    bool check_reserved;
+    int _patternFlags;
+    int _tokenLength;
+    int _tokenLine;
 
-    ParenthesesState parenthesesState;
-    int parenthesesCount;
-    bool prohibitAutomaticSemicolon;
-    bool tokenizeComments;
+    bool _validTokenText;
+    bool _prohibitAutomaticSemicolon;
+    bool _restrictedKeyword;
+    bool _terminator;
+    bool _delimited;
 };
 
-} // namespace QDeclarativeJS
+} // end of namespace QDeclarativeJS
 
 QT_QML_END_NAMESPACE
 
-#endif
+#endif // LEXER_H
index d820c5d..309d07c 100644 (file)
@@ -73,6 +73,7 @@ void Parser::reallocateStack()
     sym_stack = reinterpret_cast<Value*> (qRealloc(sym_stack, stack_size * sizeof(Value)));
     state_stack = reinterpret_cast<int*> (qRealloc(state_stack, stack_size * sizeof(int)));
     location_stack = reinterpret_cast<AST::SourceLocation*> (qRealloc(location_stack, stack_size * sizeof(AST::SourceLocation)));
+    string_stack = reinterpret_cast<QStringRef*> (qRealloc(string_stack, stack_size * sizeof(QStringRef)));
 }
 
 inline static bool automatic(Engine *driver, int token)
@@ -90,6 +91,7 @@ Parser::Parser(Engine *engine):
     sym_stack(0),
     state_stack(0),
     location_stack(0),
+    string_stack(0),
     first_token(0),
     last_token(0)
 {
@@ -101,6 +103,7 @@ Parser::~Parser()
         qFree(sym_stack);
         qFree(state_stack);
         qFree(location_stack);
+        qFree(string_stack);
     }
 }
 
@@ -109,14 +112,14 @@ static inline AST::SourceLocation location(Lexer *lexer)
     AST::SourceLocation loc;
     loc.offset = lexer->tokenOffset();
     loc.length = lexer->tokenLength();
-    loc.startLine = lexer->startLineNo();
-    loc.startColumn = lexer->startColumnNo();
+    loc.startLine = lexer->tokenStartLine();
+    loc.startColumn = lexer->tokenStartColumn();
     return loc;
 }
 
 AST::UiQualifiedId *Parser::reparseAsQualifiedId(AST::ExpressionNode *expr)
 {
-    QVarLengthArray<NameId *, 4> nameIds;
+    QVarLengthArray<QStringRef, 4> nameIds;
     QVarLengthArray<AST::SourceLocation, 4> locations;
 
     AST::ExpressionNode *it = expr;
@@ -168,11 +171,13 @@ bool Parser::parse(int startToken)
 
             if (first_token == last_token) {
                 yytoken = lexer->lex();
-                yylval = lexer->dval();
+                yylval = lexer->tokenValue();
+                yytokenspell = lexer->tokenSpell();
                 yylloc = location(lexer);
             } else {
                 yytoken = first_token->token;
                 yylval = first_token->dval;
+                yytokenspell = first_token->spell;
                 yylloc = first_token->loc;
                 ++first_token;
             }
@@ -183,6 +188,7 @@ bool Parser::parse(int startToken)
             if (action != ACCEPT_STATE) {
                 yytoken = -1;
                 sym(1).dval = yylval;
+                stringRef(1) = yytokenspell;
                 loc(1) = yylloc;
             } else {
               --tos;
@@ -255,14 +261,14 @@ case 17: {
     sym(1).UiImport->versionToken = loc(2);
     sym(1).UiImport->asToken = loc(3);
     sym(1).UiImport->importIdToken = loc(4);
-    sym(1).UiImport->importId = sym(4).sval;
+    sym(1).UiImport->importId = stringRef(4);
     sym(1).UiImport->semicolonToken = loc(5);
 } break;
 
 case 19: {
     sym(1).UiImport->asToken = loc(2);
     sym(1).UiImport->importIdToken = loc(3);
-    sym(1).UiImport->importId = sym(3).sval;
+    sym(1).UiImport->importId = stringRef(3);
     sym(1).UiImport->semicolonToken = loc(4);
 } break;
 
@@ -370,13 +376,6 @@ case 38:
     sym(1).Node = node;
 }   break;
 
-case 39:
-
-case 40: {
-    sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount());
-    break;
-}
-
 case 42: {
   sym(1).Node = 0;
 } break;
@@ -386,20 +385,20 @@ case 43: {
 } break;
 
 case 44: {
-  AST::UiParameterList *node = makeAstNode<AST::UiParameterList> (driver->nodePool(), sym(1).sval, sym(2).sval);
+  AST::UiParameterList *node = makeAstNode<AST::UiParameterList> (driver->nodePool(), stringRef(1), stringRef(2));
   node->identifierToken = loc(2);
   sym(1).Node = node;
 } break;
 
 case 45: {
-  AST::UiParameterList *node = makeAstNode<AST::UiParameterList> (driver->nodePool(), sym(1).UiParameterList, sym(3).sval, sym(4).sval);
+  AST::UiParameterList *node = makeAstNode<AST::UiParameterList> (driver->nodePool(), sym(1).UiParameterList, stringRef(3), stringRef(4));
   node->commaToken = loc(2);
   node->identifierToken = loc(4);
   sym(1).Node = node;
 } break;
 
 case 47: {
-    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), (NameId *)0, sym(2).sval);
+    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), QStringRef(), stringRef(2));
     node->type = AST::UiPublicMember::Signal;
     node->propertyToken = loc(1);
     node->typeToken = loc(2);
@@ -410,7 +409,7 @@ case 47: {
 }   break;
 
 case 49: {
-    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), (NameId *)0, sym(2).sval);
+    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), QStringRef(), stringRef(2));
     node->type = AST::UiPublicMember::Signal;
     node->propertyToken = loc(1);
     node->typeToken = loc(2);
@@ -420,8 +419,8 @@ case 49: {
 }   break;
 
 case 51: {
-    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(4).sval, sym(6).sval);
-    node->typeModifier = sym(2).sval;
+    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), stringRef(4), stringRef(6));
+    node->typeModifier = stringRef(2);
     node->propertyToken = loc(1);
     node->typeModifierToken = loc(2);
     node->typeToken = loc(4);
@@ -431,7 +430,7 @@ case 51: {
 }   break;
 
 case 53: {
-    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval);
+    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), stringRef(2), stringRef(3));
     node->propertyToken = loc(1);
     node->typeToken = loc(2);
     node->identifierToken = loc(3);
@@ -440,7 +439,7 @@ case 53: {
 }   break;
 
 case 55: {
-    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval);
+    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), stringRef(3), stringRef(4));
     node->isDefaultMember = true;
     node->defaultToken = loc(1);
     node->propertyToken = loc(2);
@@ -451,7 +450,7 @@ case 55: {
 }   break;
 
 case 56: {
-    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval,
+    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), stringRef(2), stringRef(3),
         sym(5).Statement);
     node->propertyToken = loc(1);
     node->typeToken = loc(2);
@@ -461,7 +460,7 @@ case 56: {
 }   break;
 
 case 57: {
-    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval,
+    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), stringRef(3), stringRef(4),
         sym(6).Statement);
     node->isReadonlyMember = true;
     node->readonlyToken = loc(1);
@@ -473,7 +472,7 @@ case 57: {
 }   break;
 
 case 58: {
-    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval,
+    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), stringRef(3), stringRef(4),
         sym(6).Statement);
     node->isDefaultMember = true;
     node->defaultToken = loc(1);
@@ -485,15 +484,15 @@ case 58: {
 }   break;
 
 case 59: {
-    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(4).sval, sym(6).sval);
-    node->typeModifier = sym(2).sval;
+    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), stringRef(4), stringRef(6));
+    node->typeModifier = stringRef(2);
     node->propertyToken = loc(1);
     node->typeModifierToken = loc(2);
     node->typeToken = loc(4);
     node->identifierToken = loc(6);
     node->semicolonToken = loc(7); // insert a fake ';' before ':'
 
-    AST::UiQualifiedId *propertyName = makeAstNode<AST::UiQualifiedId>(driver->nodePool(), sym(6).sval);
+    AST::UiQualifiedId *propertyName = makeAstNode<AST::UiQualifiedId>(driver->nodePool(), stringRef(6));
     propertyName->identifierToken = loc(6);
     propertyName->next = 0;
 
@@ -509,13 +508,13 @@ case 59: {
 }   break;
 
 case 60: {
-    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval);
+    AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), stringRef(2), stringRef(3));
     node->propertyToken = loc(1);
     node->typeToken = loc(2);
     node->identifierToken = loc(3);
     node->semicolonToken = loc(4); // insert a fake ';' before ':'
 
-    AST::UiQualifiedId *propertyName = makeAstNode<AST::UiQualifiedId>(driver->nodePool(), sym(3).sval);
+    AST::UiQualifiedId *propertyName = makeAstNode<AST::UiQualifiedId>(driver->nodePool(), stringRef(3));
     propertyName->identifierToken = loc(3);
     propertyName->next = 0;
 
@@ -536,30 +535,6 @@ case 62: {
     sym(1).Node = makeAstNode<AST::UiSourceElement>(driver->nodePool(), sym(1).Node);
 }   break;
 
-case 64: {
-    QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_PROPERTY]);
-    sym(1).sval = driver->intern(s.constData(), s.length());
-    break;
-}
-
-case 65: {
-    QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_SIGNAL]);
-    sym(1).sval = driver->intern(s.constData(), s.length());
-    break;
-}
-
-case 66: {
-    QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_READONLY]);
-    sym(1).sval = driver->intern(s.constData(), s.length());
-    break;
-}
-
-case 67: {
-    QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_ON]);
-    sym(1).sval = driver->intern(s.constData(), s.length());
-    break;
-}
-
 case 68: {
   AST::ThisExpression *node = makeAstNode<AST::ThisExpression> (driver->nodePool());
   node->thisToken = loc(1);
@@ -567,7 +542,7 @@ case 68: {
 } break;
 
 case 69: {
-  AST::IdentifierExpression *node = makeAstNode<AST::IdentifierExpression> (driver->nodePool(), sym(1).sval);
+  AST::IdentifierExpression *node = makeAstNode<AST::IdentifierExpression> (driver->nodePool(), stringRef(1));
   node->identifierToken = loc(1);
   sym(1).Node = node;
 } break;
@@ -597,7 +572,7 @@ case 73: {
 } break;
 case 74:
 case 75: {
-  AST::StringLiteral *node = makeAstNode<AST::StringLiteral> (driver->nodePool(), sym(1).sval);
+  AST::StringLiteral *node = makeAstNode<AST::StringLiteral> (driver->nodePool(), stringRef(1));
   node->literalToken = loc(1);
   sym(1).Node = node;
 } break;
@@ -611,7 +586,8 @@ case 76: {
 
   loc(1).length = lexer->tokenLength();
 
-  AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
+  AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(),
+    driver->newStringRef(lexer->regExpPattern()), lexer->regExpFlags());
   node->literalToken = loc(1);
   sym(1).Node = node;
 } break;
@@ -625,7 +601,8 @@ case 77: {
 
   loc(1).length = lexer->tokenLength();
 
-  AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
+  AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(),
+    driver->newStringRef(lexer->regExpPattern()), lexer->regExpFlags());
   node->literalToken = loc(1);
   sym(1).Node = node;
 } break;
@@ -766,19 +743,19 @@ case 94: {
 } break;
 
 case 95: {
-  AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval);
+  AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), stringRef(1));
   node->propertyNameToken = loc(1);
   sym(1).Node = node;
 } break;
 case 96:
 case 97: {
-  AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount()));
+  AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), stringRef(1));
   node->propertyNameToken = loc(1);
   sym(1).Node = node;
 } break;
 
 case 98: {
-  AST::StringLiteralPropertyName *node = makeAstNode<AST::StringLiteralPropertyName> (driver->nodePool(), sym(1).sval);
+  AST::StringLiteralPropertyName *node = makeAstNode<AST::StringLiteralPropertyName> (driver->nodePool(), stringRef(1));
   node->propertyNameToken = loc(1);
   sym(1).Node = node;
 } break;
@@ -790,76 +767,11 @@ case 99: {
 } break;
 
 case 100: {
-  AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval);
+  AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), stringRef(1));
   node->propertyNameToken = loc(1);
   sym(1).Node = node;
 } break;
 
-case 101:
-
-case 102:
-
-case 103:
-
-case 104:
-
-case 105:
-
-case 106:
-
-case 107:
-
-case 108:
-
-case 109:
-
-case 110:
-
-case 111:
-
-case 112:
-
-case 113:
-
-case 114:
-
-case 115:
-
-case 116:
-
-case 117:
-
-case 118:
-
-case 119:
-
-case 120:
-
-case 121:
-
-case 122:
-
-case 123:
-
-case 124:
-
-case 125:
-
-case 126:
-
-case 127:
-
-case 128:
-
-case 129:
-
-case 130:
-
-case 131:
-{
-  sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount());
-} break;
-
 case 136: {
   AST::ArrayMemberExpression *node = makeAstNode<AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression);
   node->lbracketToken = loc(2);
@@ -868,7 +780,7 @@ case 136: {
 } break;
 
 case 137: {
-  AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval);
+  AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, stringRef(3));
   node->dotToken = loc(2);
   node->identifierToken = loc(3);
   sym(1).Node = node;
@@ -910,7 +822,7 @@ case 143: {
 } break;
 
 case 144: {
-  AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval);
+  AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, stringRef(3));
   node->dotToken = loc(2);
   node->identifierToken = loc(3);
   sym(1).Node = node;
@@ -1416,13 +1328,13 @@ case 273: {
 } break;
 
 case 274: {
-  AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression);
+  AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), stringRef(1), sym(2).Expression);
   node->identifierToken = loc(1);
   sym(1).Node = node;
 } break;
 
 case 275: {
-  AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression);
+  AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), stringRef(1), sym(2).Expression);
   node->identifierToken = loc(1);
   sym(1).Node = node;
 } break;
@@ -1545,7 +1457,7 @@ case 295: {
 } break;
 
 case 297: {
-  AST::ContinueStatement *node = makeAstNode<AST::ContinueStatement> (driver->nodePool(), sym(2).sval);
+  AST::ContinueStatement *node = makeAstNode<AST::ContinueStatement> (driver->nodePool(), stringRef(2));
   node->continueToken = loc(1);
   node->identifierToken = loc(2);
   node->semicolonToken = loc(3);
@@ -1553,14 +1465,14 @@ case 297: {
 } break;
 
 case 299: {
-  AST::BreakStatement *node = makeAstNode<AST::BreakStatement> (driver->nodePool());
+  AST::BreakStatement *node = makeAstNode<AST::BreakStatement> (driver->nodePool(), QStringRef());
   node->breakToken = loc(1);
   node->semicolonToken = loc(2);
   sym(1).Node = node;
 } break;
 
 case 301: {
-  AST::BreakStatement *node = makeAstNode<AST::BreakStatement> (driver->nodePool(), sym(2).sval);
+  AST::BreakStatement *node = makeAstNode<AST::BreakStatement> (driver->nodePool(), stringRef(2));
   node->breakToken = loc(1);
   node->identifierToken = loc(2);
   node->semicolonToken = loc(3);
@@ -1635,14 +1547,14 @@ case 313: {
 } break;
 case 314:
 case 315: {
-  AST::LabelledStatement *node = makeAstNode<AST::LabelledStatement> (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount()), sym(3).Statement);
+  AST::LabelledStatement *node = makeAstNode<AST::LabelledStatement> (driver->nodePool(), stringRef(1), sym(3).Statement);
   node->identifierToken = loc(1);
   node->colonToken = loc(2);
   sym(1).Node = node;
 } break;
 
 case 316: {
-  AST::LabelledStatement *node = makeAstNode<AST::LabelledStatement> (driver->nodePool(), sym(1).sval, sym(3).Statement);
+  AST::LabelledStatement *node = makeAstNode<AST::LabelledStatement> (driver->nodePool(), stringRef(1), sym(3).Statement);
   node->identifierToken = loc(1);
   node->colonToken = loc(2);
   sym(1).Node = node;
@@ -1674,7 +1586,7 @@ case 321: {
 } break;
 
 case 322: {
-  AST::Catch *node = makeAstNode<AST::Catch> (driver->nodePool(), sym(3).sval, sym(5).Block);
+  AST::Catch *node = makeAstNode<AST::Catch> (driver->nodePool(), stringRef(3), sym(5).Block);
   node->catchToken = loc(1);
   node->lparenToken = loc(2);
   node->identifierToken = loc(3);
@@ -1696,7 +1608,7 @@ case 325: {
 } break;
 
 case 326: {
-  AST::FunctionDeclaration *node = makeAstNode<AST::FunctionDeclaration> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody);
+  AST::FunctionDeclaration *node = makeAstNode<AST::FunctionDeclaration> (driver->nodePool(), stringRef(2), sym(4).FormalParameterList, sym(7).FunctionBody);
   node->functionToken = loc(1);
   node->identifierToken = loc(2);
   node->lparenToken = loc(3);
@@ -1707,9 +1619,9 @@ case 326: {
 } break;
 
 case 327: {
-  AST::FunctionExpression *node = makeAstNode<AST::FunctionExpression> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody);
+  AST::FunctionExpression *node = makeAstNode<AST::FunctionExpression> (driver->nodePool(), stringRef(2), sym(4).FormalParameterList, sym(7).FunctionBody);
   node->functionToken = loc(1);
-  if (sym(2).sval)
+  if (! stringRef(2).isNull())
       node->identifierToken = loc(2);
   node->lparenToken = loc(3);
   node->rparenToken = loc(5);
@@ -1719,13 +1631,13 @@ case 327: {
 } break;
 
 case 328: {
-  AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), sym(1).sval);
+  AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), stringRef(1));
   node->identifierToken = loc(1);
   sym(1).Node = node;
 } break;
 
 case 329: {
-  AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), sym(1).FormalParameterList, sym(3).sval);
+  AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), sym(1).FormalParameterList, stringRef(3));
   node->commaToken = loc(2);
   node->identifierToken = loc(3);
   sym(1).Node = node;
@@ -1768,7 +1680,7 @@ case 339: {
 } break;
 
 case 340: {
-  sym(1).sval = 0;
+  stringRef(1) = QStringRef();
 } break;
 
 case 342: {
@@ -1788,6 +1700,7 @@ case 342: {
             SavedToken &tk = token_buffer[0];
             tk.token = yytoken;
             tk.dval = yylval;
+            tk.spell = yytokenspell;
             tk.loc = yylloc;
 
             yylloc = yyprevlloc;
@@ -1813,11 +1726,13 @@ case 342: {
 
         token_buffer[0].token = yytoken;
         token_buffer[0].dval = yylval;
+        token_buffer[0].spell = yytokenspell;
         token_buffer[0].loc = yylloc;
 
-        token_buffer[1].token = yytoken = lexer->lex();
-        token_buffer[1].dval  = yylval  = lexer->dval();
-        token_buffer[1].loc   = yylloc  = location(lexer);
+        token_buffer[1].token = yytoken       = lexer->lex();
+        token_buffer[1].dval  = yylval        = lexer->tokenValue();
+        token_buffer[1].spell = yytokenspell  = lexer->tokenSpell();
+        token_buffer[1].loc   = yylloc        = location(lexer);
 
         if (t_action(errorState, yytoken)) {
             QString msg;
index 0cbd76a..f77d13a 100644 (file)
@@ -72,7 +72,6 @@ QT_QML_BEGIN_NAMESPACE
 namespace QDeclarativeJS {
 
 class Engine;
-class NameId;
 
 class QML_PARSER_EXPORT Parser: protected QDeclarativeJSGrammar
 {
@@ -80,7 +79,6 @@ public:
     union Value {
       int ival;
       double dval;
-      NameId *sval;
       AST::ArgumentList *ArgumentList;
       AST::CaseBlock *CaseBlock;
       AST::CaseClause *CaseClause;
@@ -196,6 +194,9 @@ protected:
     inline Value &sym(int index)
     { return sym_stack [tos + index - 1]; }
 
+    inline QStringRef &stringRef(int index)
+    { return string_stack [tos + index - 1]; }
+
     inline AST::SourceLocation &loc(int index)
     { return location_stack [tos + index - 1]; }
 
@@ -208,6 +209,7 @@ protected:
     Value *sym_stack;
     int *state_stack;
     AST::SourceLocation *location_stack;
+    QStringRef *string_stack;
 
     AST::Node *program;
 
@@ -218,9 +220,11 @@ protected:
        int token;
        double dval;
        AST::SourceLocation loc;
+       QStringRef spell;
     };
 
     double yylval;
+    QStringRef yytokenspell;
     AST::SourceLocation yylloc;
     AST::SourceLocation yyprevlloc;
 
index 0f78b0c..29f8845 100644 (file)
@@ -123,6 +123,11 @@ QList<QDeclarativeError> QDeclarativeCompiler::errors() const
 */
 bool QDeclarativeCompiler::isAttachedPropertyName(const QString &name)
 {
+    return isAttachedPropertyName(QStringRef(&name));
+}
+
+bool QDeclarativeCompiler::isAttachedPropertyName(const QStringRef &name)
+{
     return !name.isEmpty() && name.at(0) >= 'A' && name.at(0) <= 'Z';
 }
 
@@ -139,6 +144,11 @@ bool QDeclarativeCompiler::isAttachedPropertyName(const QString &name)
 */
 bool QDeclarativeCompiler::isSignalPropertyName(const QString &name)
 {
+    return isSignalPropertyName(QStringRef(&name));
+}
+
+bool QDeclarativeCompiler::isSignalPropertyName(const QStringRef &name)
+{
     if (name.length() < 3) return false;
     if (!name.startsWith(on_string)) return false;
     int ns = name.size();
@@ -769,6 +779,15 @@ void QDeclarativeCompiler::compileTree(QDeclarativeParser::Object *tree)
         enginePrivate->registerCompositeType(output);
 }
 
+static bool QStringList_contains(const QStringList &list, const QStringRef &string)
+{
+    for (int ii = 0; ii < list.count(); ++ii)
+        if (list.at(ii) == string)
+            return true;
+
+    return false;
+}
+
 bool QDeclarativeCompiler::buildObject(QDeclarativeParser::Object *obj, const BindingContext &ctxt)
 {
     if (componentStats)
@@ -913,7 +932,7 @@ bool QDeclarativeCompiler::buildObject(QDeclarativeParser::Object *obj, const Bi
             canDefer = ids == compileState->ids.count();
         }
 
-        if (canDefer && !deferredList.isEmpty() && deferredList.contains(prop->name()))
+        if (canDefer && !deferredList.isEmpty() && QStringList_contains(deferredList, prop->name()))
             prop->isDeferred = true;
     }
 
@@ -1042,7 +1061,8 @@ void QDeclarativeCompiler::genObjectBody(QDeclarativeParser::Object *obj)
         ss.storeScriptString.propertyIndex = prop->index;
         ss.storeScriptString.value = output->indexForString(script);
         ss.storeScriptString.scope = prop->scriptStringScope;
-        ss.storeScriptString.bindingId = rewriteBinding(script, prop->name());
+//        ss.storeScriptString.bindingId = rewriteBinding(script, prop->name());
+        ss.storeScriptString.bindingId = rewriteBinding(script, QString()); // XXX
         ss.storeScriptString.line = prop->location.start.line;
         output->addInstruction(ss);
     }
@@ -1095,8 +1115,7 @@ void QDeclarativeCompiler::genObjectBody(QDeclarativeParser::Object *obj)
             QDeclarativeInstruction assign;
             assign.setType(QDeclarativeInstruction::AssignSignalObject);
             assign.assignSignalObject.line = v->location.start.line;
-            assign.assignSignalObject.signal =
-                output->indexForString(prop->name());
+            assign.assignSignalObject.signal = output->indexForString(prop->name().toString());
             output->addInstruction(assign);
 
         } else if (v->type == Value::SignalExpression) {
@@ -1396,7 +1415,7 @@ bool QDeclarativeCompiler::buildSignal(QDeclarativeParser::Property *prop, QDecl
 {
     Q_ASSERT(obj->metaObject());
 
-    QString name = prop->name();
+    QString name = prop->name().toString();
     Q_ASSERT(name.startsWith(on_string));
     name = name.mid(2);
 
@@ -1419,9 +1438,9 @@ bool QDeclarativeCompiler::buildSignal(QDeclarativeParser::Property *prop, QDecl
             const QList<QDeclarativeTypeData::TypeReference>  &resolvedTypes = unit->resolvedTypes();
             const QDeclarativeTypeData::TypeReference &type = resolvedTypes.at(obj->type);
             if (type.type) {
-                COMPILE_EXCEPTION(prop, tr("\"%1.%2\" is not available in %3 %4.%5.").arg(elementName(obj)).arg(prop->name()).arg(QString::fromUtf8(type.type->module())).arg(type.majorVersion).arg(type.minorVersion));
+                COMPILE_EXCEPTION(prop, tr("\"%1.%2\" is not available in %3 %4.%5.").arg(elementName(obj)).arg(prop->name().toString()).arg(QString::fromUtf8(type.type->module())).arg(type.majorVersion).arg(type.minorVersion));
             } else {
-                COMPILE_EXCEPTION(prop, tr("\"%1.%2\" is not available due to component versioning.").arg(elementName(obj)).arg(prop->name()));
+                COMPILE_EXCEPTION(prop, tr("\"%1.%2\" is not available due to component versioning.").arg(elementName(obj)).arg(prop->name().toString()));
             }
         }
 
@@ -1538,9 +1557,9 @@ bool QDeclarativeCompiler::buildProperty(QDeclarativeParser::Property *prop,
                 const QList<QDeclarativeTypeData::TypeReference>  &resolvedTypes = unit->resolvedTypes();
                 const QDeclarativeTypeData::TypeReference &type = resolvedTypes.at(obj->type);
                 if (type.type) {
-                    COMPILE_EXCEPTION(prop, tr("\"%1.%2\" is not available in %3 %4.%5.").arg(elementName(obj)).arg(prop->name()).arg(QString::fromUtf8(type.type->module())).arg(type.majorVersion).arg(type.minorVersion));
+                    COMPILE_EXCEPTION(prop, tr("\"%1.%2\" is not available in %3 %4.%5.").arg(elementName(obj)).arg(prop->name().toString()).arg(QString::fromUtf8(type.type->module())).arg(type.majorVersion).arg(type.minorVersion));
                 } else {
-                    COMPILE_EXCEPTION(prop, tr("\"%1.%2\" is not available due to component versioning.").arg(elementName(obj)).arg(prop->name()));
+                    COMPILE_EXCEPTION(prop, tr("\"%1.%2\" is not available due to component versioning.").arg(elementName(obj)).arg(prop->name().toString()));
                 }
             }
 
@@ -1594,7 +1613,7 @@ bool QDeclarativeCompiler::buildProperty(QDeclarativeParser::Property *prop,
         if (prop->isDefault) {
             COMPILE_EXCEPTION(prop->values.first(), tr("Cannot assign to non-existent default property"));
         } else {
-            COMPILE_EXCEPTION(prop, tr("Cannot assign to non-existent property \"%1\"").arg(prop->name()));
+            COMPILE_EXCEPTION(prop, tr("Cannot assign to non-existent property \"%1\"").arg(prop->name().toString()));
         }
 
     } else if (prop->value) {
@@ -1898,7 +1917,7 @@ bool QDeclarativeCompiler::buildGroupedProperty(QDeclarativeParser::Property *pr
             }
 
             if (!obj->metaObject()->property(prop->index).isWritable()) {
-                COMPILE_EXCEPTION(prop, tr( "Invalid property assignment: \"%1\" is a read-only property").arg(prop->name()));
+                COMPILE_EXCEPTION(prop, tr( "Invalid property assignment: \"%1\" is a read-only property").arg(prop->name().toString()));
             }
 
 
@@ -1944,10 +1963,10 @@ bool QDeclarativeCompiler::buildValueTypeProperty(QObject *type,
     for (Property *prop = obj->properties.first(); prop; prop = obj->properties.next(prop)) {
         int idx = type->metaObject()->indexOfProperty(prop->name().toUtf8().constData());
         if (idx == -1)
-            COMPILE_EXCEPTION(prop, tr("Cannot assign to non-existent property \"%1\"").arg(prop->name()));
+            COMPILE_EXCEPTION(prop, tr("Cannot assign to non-existent property \"%1\"").arg(prop->name().toString()));
         QMetaProperty p = type->metaObject()->property(idx);
         if (!p.isScriptable())
-            COMPILE_EXCEPTION(prop, tr("Cannot assign to non-existent property \"%1\"").arg(prop->name()));
+            COMPILE_EXCEPTION(prop, tr("Cannot assign to non-existent property \"%1\"").arg(prop->name().toString()));
         prop->index = idx;
         prop->type = p.userType();
         prop->isValueTypeSubProperty = true;
@@ -2100,7 +2119,7 @@ bool QDeclarativeCompiler::buildPropertyObjectAssignment(QDeclarativeParser::Pro
     Q_ASSERT(v->object->type != -1);
 
     if (!obj->metaObject()->property(prop->index).isWritable())
-        COMPILE_EXCEPTION(v, tr("Invalid property assignment: \"%1\" is a read-only property").arg(prop->name()));
+        COMPILE_EXCEPTION(v, tr("Invalid property assignment: \"%1\" is a read-only property").arg(prop->name().toString()));
 
     if (QDeclarativeMetaType::isInterface(prop->type)) {
 
@@ -2181,7 +2200,7 @@ bool QDeclarativeCompiler::buildPropertyOnAssignment(QDeclarativeParser::Propert
     Q_ASSERT(v->object->type != -1);
 
     if (!obj->metaObject()->property(prop->index).isWritable())
-        COMPILE_EXCEPTION(v, tr("Invalid property assignment: \"%1\" is a read-only property").arg(prop->name()));
+        COMPILE_EXCEPTION(v, tr("Invalid property assignment: \"%1\" is a read-only property").arg(prop->name().toString()));
 
 
     // Normally buildObject() will set this up, but we need the static
@@ -2208,7 +2227,7 @@ bool QDeclarativeCompiler::buildPropertyOnAssignment(QDeclarativeParser::Propert
             buildDynamicMeta(baseObj, ForceCreation);
         v->type = isPropertyValue ? Value::ValueSource : Value::ValueInterceptor;
     } else {
-        COMPILE_EXCEPTION(v, tr("\"%1\" cannot operate on \"%2\"").arg(QString::fromUtf8(v->object->typeName)).arg(prop->name()));
+        COMPILE_EXCEPTION(v, tr("\"%1\" cannot operate on \"%2\"").arg(QString::fromUtf8(v->object->typeName)).arg(prop->name().toString()));
     }
 
     return true;
@@ -2715,7 +2734,7 @@ static QStringList astNodeToStringList(QDeclarativeJS::AST::Node *node)
 {
     if (node->kind == QDeclarativeJS::AST::Node::Kind_IdentifierExpression) {
         QString name =
-            static_cast<QDeclarativeJS::AST::IdentifierExpression *>(node)->name->asString();
+            static_cast<QDeclarativeJS::AST::IdentifierExpression *>(node)->name.toString();
         return QStringList() << name;
     } else if (node->kind == QDeclarativeJS::AST::Node::Kind_FieldMemberExpression) {
         QDeclarativeJS::AST::FieldMemberExpression *expr = static_cast<QDeclarativeJS::AST::FieldMemberExpression *>(node);
@@ -2723,7 +2742,7 @@ static QStringList astNodeToStringList(QDeclarativeJS::AST::Node *node)
         QStringList rv = astNodeToStringList(expr->base);
         if (rv.isEmpty())
             return rv;
-        rv.append(expr->name->asString());
+        rv.append(expr->name.toString());
         return rv;
     }
     return QStringList();
@@ -2762,7 +2781,7 @@ bool QDeclarativeCompiler::compileAlias(QMetaObjectBuilder &builder,
     bool writable = false;
     bool resettable = false;
     if (alias.count() == 2 || alias.count() == 3) {
-        propIdx = indexOfProperty(idObject, alias.at(1).toUtf8());
+        propIdx = indexOfProperty(idObject, alias.at(1));
 
         if (-1 == propIdx) {
             COMPILE_EXCEPTION(prop.defaultValue, tr("Invalid alias location"));
@@ -2834,7 +2853,7 @@ bool QDeclarativeCompiler::buildBinding(QDeclarativeParser::Value *value,
 
     QMetaProperty mp = prop->parent->metaObject()->property(prop->index);
     if (!mp.isWritable() && !QDeclarativeMetaType::isList(prop->type))
-        COMPILE_EXCEPTION(prop, tr("Invalid property assignment: \"%1\" is a read-only property").arg(prop->name()));
+        COMPILE_EXCEPTION(prop, tr("Invalid property assignment: \"%1\" is a read-only property").arg(prop->name().toString()));
 
     BindingReference *reference = pool->New<BindingReference>();
     reference->expression = value->value;
@@ -3177,7 +3196,7 @@ int QDeclarativeCompiler::indexOfSignal(QDeclarativeParser::Object *object, cons
         if (name.endsWith(Changed_string)) {
             QString propName = name.mid(0, name.length() - 7);
 
-            int propIndex = indexOfProperty(object, propName, notInRevision);
+            int propIndex = indexOfProperty(object, QStringRef(&propName), notInRevision);
             if (propIndex != -1) {
                 d = cache->property(propIndex);
                 return d->notifyIndex;
@@ -3194,6 +3213,12 @@ int QDeclarativeCompiler::indexOfSignal(QDeclarativeParser::Object *object, cons
 int QDeclarativeCompiler::indexOfProperty(QDeclarativeParser::Object *object, const QString &name, 
                                           bool *notInRevision)
 {
+    return indexOfProperty(object, QStringRef(&name), notInRevision);
+}
+
+int QDeclarativeCompiler::indexOfProperty(QDeclarativeParser::Object *object, const QStringRef &name, 
+                                          bool *notInRevision)
+{
     if (notInRevision) *notInRevision = false;
 
     QDeclarativePropertyCache *cache = 0;
@@ -3205,7 +3230,8 @@ int QDeclarativeCompiler::indexOfProperty(QDeclarativeParser::Object *object, co
     else
         cache = QDeclarativeEnginePrivate::get(engine)->cache(object->metaObject());
 
-    QDeclarativePropertyCache::Data *d = cache->property(name);
+    QDeclarativePropertyCache::Data *d = cache->property(QHashedStringRef(name.constData(), name.length()));
+
     // Find the first property
     while (d && d->isFunction())
         d = cache->overrideData(d);
index 0d800ba..fcff96b 100644 (file)
@@ -230,6 +230,8 @@ public:
 
     static bool isAttachedPropertyName(const QString &);
     static bool isSignalPropertyName(const QString &);
+    static bool isAttachedPropertyName(const QStringRef &);
+    static bool isSignalPropertyName(const QStringRef &);
 
     int evaluateEnum(const QByteArray& script) const; // for QDeclarativeCustomParser::evaluateEnum
     const QMetaObject *resolveType(const QByteArray& name) const; // for QDeclarativeCustomParser::resolveType
@@ -335,6 +337,7 @@ private:
     QString elementName(QDeclarativeParser::Object *);
 
     QStringList deferredProperties(QDeclarativeParser::Object *);
+    int indexOfProperty(QDeclarativeParser::Object *, const QStringRef &, bool *notInRevision = 0);
     int indexOfProperty(QDeclarativeParser::Object *, const QString &, bool *notInRevision = 0);
     int indexOfSignal(QDeclarativeParser::Object *, const QString &, bool *notInRevision = 0);
 
index eca0858..9f08ae8 100644 (file)
@@ -132,17 +132,17 @@ void QDeclarativeParser::Object::addScriptStringProperty(Property *p)
     scriptStringProperties.append(p);
 }
 
-Property *QDeclarativeParser::Object::getProperty(const QString *name, bool create)
+Property *QDeclarativeParser::Object::getProperty(const QStringRef &name, bool create)
 {
     for (Property *p = properties.first(); p; p = properties.next(p)) {
-        if (p->name() == *name)
+        if (p->name() == name)
             return p;
     }
 
     if (create) {
         Property *property = pool()->New<Property>();
         property->parent = this;
-        property->_name = const_cast<QString *>(name);
+        property->_name = name;
         property->isDefault = false;
         properties.prepend(property);
         return property;
@@ -161,7 +161,7 @@ Property *QDeclarativeParser::Object::getProperty(const QString &name, bool crea
     if (create) {
         Property *property = pool()->New<Property>();
         property->parent = this;
-        property->_name = pool()->NewString(name);
+        property->_name = QStringRef(pool()->NewString(name));
         property->isDefault = false;
         properties.prepend(property);
         return property;
@@ -288,7 +288,8 @@ bool QDeclarativeParser::Variant::asBoolean() const
 QString QDeclarativeParser::Variant::asString() const
 {
     if (t == String) {
-        return l->value->asString();
+        // XXX aakenned
+        return l->value.toString();
     } else {
         return asWritten.toString();
     }
@@ -358,9 +359,10 @@ QString QDeclarativeParser::Variant::asScript() const
     case String:
         return escapedString(asString());
     case Script:
-        if (AST::IdentifierExpression *i = AST::cast<AST::IdentifierExpression *>(n)) 
-            return i->name->asString();
-        else
+        if (AST::IdentifierExpression *i = AST::cast<AST::IdentifierExpression *>(n)) {
+            // XXX aakenned
+            return i->name.toString();
+        } else
             return asWritten.toString();
     }
 }
@@ -416,7 +418,7 @@ QStringList QDeclarativeParser::Variant::asStringList() const
         AST::StringLiteral *string = AST::cast<AST::StringLiteral *>(elements->expression);
         if (!string)
             return QStringList();
-        rv.append(string->value->asString());
+        rv.append(string->value.toString());
 
         elements = elements->next;
     }
index f7b71c4..2386f85 100644 (file)
@@ -245,8 +245,8 @@ namespace QDeclarativeParser
         // Content in value and values are mutually exclusive.
         Object *value;
         // The property name
-        QString name() const { return _name?*_name:QString(); }
-        void setName(const QString &n) { _name = pool()->NewString(n); }
+        QStringRef name() const { return _name; }
+        void setName(const QString &n) { _name = QStringRef(pool()->NewString(n)); }
         // True if this property was accessed as the default property.  
         bool isDefault;
         // True if the setting of this property will be deferred.  Set by the
@@ -272,7 +272,7 @@ namespace QDeclarativeParser
 
     private:
         friend class Object;
-        QString *_name;
+        QStringRef _name;
     };
 
     class Object : public QDeclarativePool::Class
@@ -312,7 +312,7 @@ namespace QDeclarativeParser
 
         Property *getDefaultProperty();
         // name ptr must be guarenteed to remain valid
-        Property *getProperty(const QString *name, bool create=true);
+        Property *getProperty(const QStringRef &name, bool create=true);
         Property *getProperty(const QString &name, bool create=true);
 
         Property *defaultProperty;
index 0d44b58..09c441d 100644 (file)
@@ -475,6 +475,14 @@ QDeclarativePropertyCache::method(int index) const
 }
 
 QDeclarativePropertyCache::Data *
+QDeclarativePropertyCache::property(const QHashedStringRef &str) const
+{
+    QDeclarativePropertyCache::Data **rv = stringCache.value(str);
+    if (rv && (*rv)->notFullyResolved()) resolve(*rv);
+    return rv?*rv:0;
+}
+
+QDeclarativePropertyCache::Data *
 QDeclarativePropertyCache::property(const QString &str) const
 {
     QDeclarativePropertyCache::Data **rv = stringCache.value(str);
index 7e677a5..dcb8ad6 100644 (file)
@@ -181,6 +181,7 @@ public:
     static Data create(const QMetaObject *, const QString &);
 
     inline Data *property(const QHashedV8String &) const;
+    Data *property(const QHashedStringRef &) const;
     Data *property(const QString &) const;
     Data *property(int) const;
     Data *method(int) const;
index b541511..306a979 100644 (file)
@@ -111,7 +111,7 @@ class ProcessAST: protected AST::Visitor
             }
         }
 
-        void pushProperty(const QString *name, const LocationSpan &location)
+        void pushProperty(const QStringRef &name, const LocationSpan &location)
         {
             const State &state = top();
             if (state.property) {
@@ -274,7 +274,7 @@ QString ProcessAST::asString(AST::UiQualifiedId *node) const
     QString s;
 
     for (AST::UiQualifiedId *it = node; it; it = it->next) {
-        s.append(it->name->asString());
+        s.append(it->name.toString());
 
         if (it->next)
             s.append(QLatin1Char('.'));
@@ -299,7 +299,7 @@ ProcessAST::defineObjectBinding(AST::UiQualifiedId *propertyName,
     int propertyCount = 0;
     for (AST::UiQualifiedId *name = propertyName; name; name = name->next){
         ++propertyCount;
-        _stateStack.pushProperty(&name->name->asString(),
+        _stateStack.pushProperty(name->name,
                                  this->location(name));
     }
 
@@ -429,8 +429,8 @@ bool ProcessAST::visit(AST::UiImport *node)
     QString uri;
     QDeclarativeScriptParser::Import import;
 
-    if (node->fileName) {
-        uri = node->fileName->asString();
+    if (!node->fileName.isNull()) {
+        uri = node->fileName.toString();
 
         if (uri.endsWith(QLatin1String(".js"))) {
             import.type = QDeclarativeScriptParser::Import::Script;
@@ -446,8 +446,8 @@ bool ProcessAST::visit(AST::UiImport *node)
     AST::SourceLocation endLoc = node->semicolonToken;
 
     // Qualifier
-    if (node->importId) {
-        import.qualifier = node->importId->asString();
+    if (!node->importId.isNull()) {
+        import.qualifier = node->importId.toString();
         if (!import.qualifier.at(0).isUpper()) {
             QDeclarativeError error;
             error.setDescription(QCoreApplication::translate("QDeclarativeParser","Invalid import qualifier ID"));
@@ -537,14 +537,14 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
                                          sizeof(propTypeNameToTypes[0]);
 
     if(node->type == AST::UiPublicMember::Signal) {
-        const QString name = node->name->asString();
+        const QString name = node->name.toString();
 
         Object::DynamicSignal signal;
         signal.name = name.toUtf8();
 
         AST::UiParameterList *p = node->parameters;
         while (p) {
-            const QString memberType = p->type->asString();
+            const QString memberType = p->type.toString();
             const char *qtType = 0;
             for(int ii = 0; !qtType && ii < propTypeNameToTypesCount; ++ii) {
                 if(QLatin1String(propTypeNameToTypes[ii].name) == memberType)
@@ -561,15 +561,15 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
             }
             
             signal.parameterTypes << qtType;
-            signal.parameterNames << p->name->asString().toUtf8();
+            signal.parameterNames << p->name.toUtf8();
             p = p->finish();
         }
 
         signal.location = location(node->typeToken, node->semicolonToken);
         _stateStack.top().object->dynamicSignals << signal;
     } else {
-        const QString memberType = node->memberType->asString();
-        const QString name = node->name->asString();
+        const QString memberType = node->memberType.toString();
+        const QString name = node->name.toString();
 
         bool typeFound = false;
         Object::DynamicProperty::Type type;
@@ -588,8 +588,8 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
 
         if (!typeFound && memberType.at(0).isUpper()) {
             QString typemodifier;
-            if(node->typeModifier)
-                typemodifier = node->typeModifier->asString();
+            if(!node->typeModifier.isNull())
+                typemodifier = node->typeModifier.toString();
             if (typemodifier.isEmpty()) {
                 type = Object::DynamicProperty::Custom;
             } else if(typemodifier == QLatin1String("list")) {
@@ -603,7 +603,7 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
                 return false;
             }
             typeFound = true;
-        } else if (node->typeModifier) {
+        } else if (!node->typeModifier.isNull()) {
             QDeclarativeError error;
             error.setDescription(QCoreApplication::translate("QDeclarativeParser","Unexpected property type modifier"));
             error.setLine(node->typeModifierToken.startLine);
@@ -739,7 +739,7 @@ bool ProcessAST::visit(AST::UiScriptBinding *node)
     AST::UiQualifiedId *propertyName = node->qualifiedId;
     for (AST::UiQualifiedId *name = propertyName; name; name = name->next){
         ++propertyCount;
-        _stateStack.pushProperty(&name->name->asString(),
+        _stateStack.pushProperty(name->name,
                                  location(name));
     }
 
@@ -784,7 +784,7 @@ bool ProcessAST::visit(AST::UiArrayBinding *node)
     AST::UiQualifiedId *propertyName = node->qualifiedId;
     for (AST::UiQualifiedId *name = propertyName; name; name = name->next){
         ++propertyCount;
-        _stateStack.pushProperty(&name->name->asString(),
+        _stateStack.pushProperty(name->name,
                                  location(name));
     }
 
@@ -822,7 +822,7 @@ bool ProcessAST::visit(AST::UiSourceElement *node)
 
         AST::FormalParameterList *f = funDecl->formals;
         while (f) {
-            slot.parameterNames << f->name->asString().toUtf8();
+            slot.parameterNames << f->name.toUtf8();
             f = f->finish();
         }
 
@@ -830,7 +830,7 @@ bool ProcessAST::visit(AST::UiSourceElement *node)
         loc.offset = loc.end();
         loc.startColumn += 1;
         QString body = textAt(loc, funDecl->rbraceToken);
-        slot.name = funDecl->name->asString().toUtf8();
+        slot.name = funDecl->name.toUtf8();
         slot.body = body;
         obj->dynamicSlots << slot;
 
@@ -952,7 +952,7 @@ locationFromLexer(const QDeclarativeJS::Lexer &lex, int startLine, int startColu
     QDeclarativeParser::LocationSpan l;
 
     l.start.line = startLine; l.start.column = startColumn;
-    l.end.line = lex.endLineNo(); l.end.column = lex.endColumnNo();
+    l.end.line = lex.tokenEndLine(); l.end.column = lex.tokenEndColumn();
     l.range.offset = startOffset;
     l.range.length = lex.tokenOffset() + lex.tokenLength() - startOffset;
 
@@ -981,26 +981,26 @@ QDeclarativeParser::Object::ScriptBlock::Pragmas QDeclarativeScriptParser::extra
             return rv;
 
         int startOffset = l.tokenOffset();
-        int startLine = l.currentLineNo();
+        int startLine = l.tokenStartLine();
 
         token = l.lex();
 
         if (token != QDeclarativeJSGrammar::T_IDENTIFIER ||
-            l.currentLineNo() != startLine ||
+            l.tokenStartLine() != startLine ||
             script.mid(l.tokenOffset(), l.tokenLength()) != pragma)
             return rv;
 
         token = l.lex();
 
         if (token != QDeclarativeJSGrammar::T_IDENTIFIER ||
-            l.currentLineNo() != startLine)
+            l.tokenStartLine() != startLine)
             return rv;
 
         QString pragmaValue = script.mid(l.tokenOffset(), l.tokenLength());
         int endOffset = l.tokenLength() + l.tokenOffset();
 
         token = l.lex();
-        if (l.currentLineNo() == startLine)
+        if (l.tokenStartLine() == startLine)
             return rv;
 
         if (pragmaValue == library) {
@@ -1013,7 +1013,7 @@ QDeclarativeParser::Object::ScriptBlock::Pragmas QDeclarativeScriptParser::extra
     return rv;
 }
 
-#define CHECK_LINE if(l.currentLineNo() != startLine) return rv;
+#define CHECK_LINE if (l.tokenStartLine() != startLine) return rv;
 #define CHECK_TOKEN(t) if (token != QDeclarativeJSGrammar:: t) return rv;
 
 static const int uriTokens[] = {
@@ -1087,8 +1087,8 @@ QDeclarativeScriptParser::JavaScriptMetaData QDeclarativeScriptParser::extractMe
             return rv;
 
         int startOffset = l.tokenOffset();
-        int startLine = l.startLineNo();
-        int startColumn = l.startColumnNo();
+        int startLine = l.tokenStartLine();
+        int startColumn = l.tokenStartColumn();
 
         token = l.lex();
 
@@ -1105,7 +1105,8 @@ QDeclarativeScriptParser::JavaScriptMetaData QDeclarativeScriptParser::extractMe
 
             if (token == QDeclarativeJSGrammar::T_STRING_LITERAL) {
 
-                QString file(l.characterBuffer(), l.characterCount());
+                QString file = l.tokenText();
+
                 if (!file.endsWith(js))
                     return rv;
 
@@ -1130,7 +1131,7 @@ QDeclarativeScriptParser::JavaScriptMetaData QDeclarativeScriptParser::extractMe
                     locationFromLexer(l, startLine, startColumn, startOffset);
 
                 token = l.lex();
-                if (l.startLineNo() == startLine)
+                if (l.tokenStartLine() == startLine)
                     return rv;
 
                 replaceWithSpace(script, startOffset, endOffset - startOffset);
@@ -1151,7 +1152,7 @@ QDeclarativeScriptParser::JavaScriptMetaData QDeclarativeScriptParser::extractMe
                     if (!isUriToken(token))
                         return rv;
 
-                    uri.append(QString(l.characterBuffer(), l.characterCount()));
+                    uri.append(l.tokenText());
 
                     token = l.lex();
                     CHECK_LINE;
@@ -1188,7 +1189,7 @@ QDeclarativeScriptParser::JavaScriptMetaData QDeclarativeScriptParser::extractMe
                     locationFromLexer(l, startLine, startColumn, startOffset);
 
                 token = l.lex();
-                if (l.startLineNo() == startLine)
+                if (l.tokenStartLine() == startLine)
                     return rv;
 
                 replaceWithSpace(script, startOffset, endOffset - startOffset);
@@ -1222,7 +1223,7 @@ QDeclarativeScriptParser::JavaScriptMetaData QDeclarativeScriptParser::extractMe
             }
 
             token = l.lex();
-            if (l.currentLineNo() == startLine)
+            if (l.tokenStartLine() == startLine)
                 return rv;
 
         } else {
index 86eeeec..c9c2c08 100644 (file)
@@ -407,10 +407,8 @@ BasicBlock *Function::newBasicBlock()
 
 void Function::dump(QTextStream &out)
 {
-    QString fname;
-    if (name)
-        fname = name->asString();
-    else
+    QString fname = name;
+    if (fname.isEmpty())
         fname = QLatin1String("$anonymous");
     out << "function " << fname << "() {" << endl;
     foreach (BasicBlock *bb, basicBlocks) {
index 87891bf..e8fde4f 100644 (file)
@@ -407,7 +407,7 @@ struct Ret: Stmt {
 
 struct Function {
     Module *module;
-    const NameId *name;
+    QString name;
     int tempCount;
     QVector<BasicBlock *> basicBlocks;
     QVector<Expr *> temps;
@@ -415,7 +415,7 @@ struct Function {
     template <typename BB> inline BB i(BB i) { basicBlocks.append(i); return i; }
     template <typename E> inline E e(E e) { temps.append(e); return e; }
 
-    Function(Module *module, const NameId *name = 0): module(module), name(name), tempCount(0) {}
+    Function(Module *module, const QString &name): module(module), name(name), tempCount(0) {}
     ~Function();
 
     BasicBlock *newBasicBlock();
@@ -487,7 +487,7 @@ struct Module {
 
     template <typename BB> inline BB i(BB i) { functions.append(i); return i; }
 
-    Function *newFunction(const NameId *name = 0) { return i(new Function(this, name)); }
+    Function *newFunction(const QString &name = QString()) { return i(new Function(this, name)); }
 
     virtual void dump(QTextStream &out);
 };
index fbee5a6..9e66ff4 100644 (file)
@@ -140,7 +140,7 @@ bool QDeclarativeV4IRBuilder::buildName(QStringList &name,
                                               QList<AST::ExpressionNode *> *nodes)
 {
     if (node->kind == AST::Node::Kind_IdentifierExpression) {
-        name << static_cast<AST::IdentifierExpression*>(node)->name->asString();
+        name << static_cast<AST::IdentifierExpression*>(node)->name.toString();
         if (nodes) *nodes << static_cast<AST::IdentifierExpression*>(node);
     } else if (node->kind == AST::Node::Kind_FieldMemberExpression) {
         AST::FieldMemberExpression *expr =
@@ -149,7 +149,7 @@ bool QDeclarativeV4IRBuilder::buildName(QStringList &name,
         if (!buildName(name, expr->base, nodes))
             return false;
 
-        name << expr->name->asString();
+        name << expr->name.toString();
         if (nodes) *nodes << expr;
     } else {
         return false;
@@ -432,7 +432,7 @@ bool QDeclarativeV4IRBuilder::visit(AST::IdentifierExpression *ast)
     const quint32 line = ast->identifierToken.startLine;
     const quint32 column = ast->identifierToken.startColumn;
 
-    const QString name = ast->name->asString();
+    const QString name = ast->name.toString();
 
     if (name.at(0) == QLatin1Char('u') && name.length() == 9 && name == QLatin1String("undefined")) {
         _expr.code = _block->CONST(IR::UndefinedType, 0); // ### undefined value
@@ -543,7 +543,7 @@ bool QDeclarativeV4IRBuilder::visit(AST::FalseLiteral *)
 bool QDeclarativeV4IRBuilder::visit(AST::StringLiteral *ast)
 {
     // ### TODO: cx format
-    _expr.code = _block->STRING(ast->value->asString());
+    _expr.code = _block->STRING(ast->value.toString());
     return false;
 }
 
@@ -580,7 +580,7 @@ bool QDeclarativeV4IRBuilder::visit(AST::FieldMemberExpression *ast)
             const quint32 line = ast->identifierToken.startLine;
             const quint32 column = ast->identifierToken.startColumn;
 
-            QString name = ast->name->asString();
+            QString name = ast->name.toString();
 
             switch(baseName->symbol) {
             case IR::Name::Unbound:
@@ -605,7 +605,7 @@ bool QDeclarativeV4IRBuilder::visit(AST::FieldMemberExpression *ast)
 
                     if (!found && qmlVerboseCompiler())
                         qWarning() << "*** unresolved enum:" 
-                                   << (baseName->id + QLatin1String(".") + ast->name->asString());
+                                   << (baseName->id + QLatin1String(".") + ast->name.toString());
                 } else if(const QMetaObject *attachedMeta = baseName->declarativeType->attachedPropertiesType()) {
                     QDeclarativePropertyCache *cache = m_engine->cache(attachedMeta);
                     QDeclarativePropertyCache::Data *data = cache->property(name);
@@ -616,7 +616,7 @@ bool QDeclarativeV4IRBuilder::visit(AST::FieldMemberExpression *ast)
                     if(!data->isFinal()) {
                         if (qmlVerboseCompiler())
                             qWarning() << "*** non-final attached property:"
-                                       << (baseName->id + QLatin1String(".") + ast->name->asString());
+                                       << (baseName->id + QLatin1String(".") + ast->name.toString());
                         return false; // We don't know enough about this property
                     }
 
@@ -662,7 +662,7 @@ bool QDeclarativeV4IRBuilder::visit(AST::FieldMemberExpression *ast)
                     if(!data->isFinal()) {
                         if (qmlVerboseCompiler())
                             qWarning() << "*** non-final property access:"
-                                << (baseName->id + QLatin1String(".") + ast->name->asString());
+                                << (baseName->id + QLatin1String(".") + ast->name.toString());
                         return false; // We don't know enough about this property
                     }