From 03e18459dbe8dabc6b504ea675260e23c9540f6c Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 29 Apr 2009 14:32:41 +1000 Subject: Re-enable property syntax and add a "default" specifier --- src/declarative/qml/parser/javascript.g | 26 + src/declarative/qml/parser/javascriptast_p.h | 5 +- src/declarative/qml/parser/javascriptgrammar.cpp | 1035 +++++++++++----------- src/declarative/qml/parser/javascriptgrammar_p.h | 10 +- src/declarative/qml/parser/javascriptlexer.cpp | 2 +- src/declarative/qml/parser/javascriptparser.cpp | 380 ++++---- src/declarative/qml/parser/javascriptparser_p.h | 4 +- src/declarative/qml/qmlcompiler.cpp | 4 +- src/declarative/qml/qmlscriptparser.cpp | 5 + 9 files changed, 768 insertions(+), 703 deletions(-) diff --git a/src/declarative/qml/parser/javascript.g b/src/declarative/qml/parser/javascript.g index 961041e..2284e93 100644 --- a/src/declarative/qml/parser/javascript.g +++ b/src/declarative/qml/parser/javascript.g @@ -630,6 +630,18 @@ case $rule_number: { } break; ./ +UiObjectMember: T_PUBLIC T_DEFAULT T_IDENTIFIER T_IDENTIFIER ; +/. +case $rule_number: { + AST::UiPublicMember *node = makeAstNode (driver->nodePool(), sym(3).sval, sym(4).sval); + node->isDefaultMember = true; + node->publicToken = loc(1); + node->attributeTypeToken = loc(3); + node->identifierToken = loc(4); + sym(1).Node = node; +} break; +./ + UiObjectMember: T_PUBLIC T_IDENTIFIER T_IDENTIFIER T_COLON Expression ; /. case $rule_number: { @@ -643,6 +655,20 @@ case $rule_number: { } break; ./ +UiObjectMember: T_PUBLIC T_DEFAULT T_IDENTIFIER T_IDENTIFIER T_COLON Expression ; +/. +case $rule_number: { + AST::UiPublicMember *node = makeAstNode (driver->nodePool(), sym(3).sval, sym(4).sval, + sym(6).Expression); + node->isDefaultMember = true; + node->publicToken = loc(1); + node->attributeTypeToken = loc(3); + node->identifierToken = loc(4); + node->colonToken = loc(5); + sym(1).Node = node; +} break; +./ + UiObjectMember: FunctionDeclaration ; /. case $rule_number: { diff --git a/src/declarative/qml/parser/javascriptast_p.h b/src/declarative/qml/parser/javascriptast_p.h index 69958e5..dabc0e0 100644 --- a/src/declarative/qml/parser/javascriptast_p.h +++ b/src/declarative/qml/parser/javascriptast_p.h @@ -2236,13 +2236,13 @@ public: UiPublicMember(JavaScriptNameIdImpl *memberType, JavaScriptNameIdImpl *name) - : memberType(memberType), name(name), expression(0) + : memberType(memberType), name(name), expression(0), isDefaultMember(false) { kind = K; } UiPublicMember(JavaScriptNameIdImpl *memberType, JavaScriptNameIdImpl *name, ExpressionNode *expression) - : memberType(memberType), name(name), expression(expression) + : memberType(memberType), name(name), expression(expression), isDefaultMember(false) { kind = K; } virtual void accept0(Visitor *visitor); @@ -2251,6 +2251,7 @@ public: JavaScriptNameIdImpl *memberType; JavaScriptNameIdImpl *name; ExpressionNode *expression; + bool isDefaultMember; SourceLocation publicToken; SourceLocation attributeTypeToken; SourceLocation identifierToken; diff --git a/src/declarative/qml/parser/javascriptgrammar.cpp b/src/declarative/qml/parser/javascriptgrammar.cpp index b06fd32..afbec36 100644 --- a/src/declarative/qml/parser/javascriptgrammar.cpp +++ b/src/declarative/qml/parser/javascriptgrammar.cpp @@ -56,312 +56,335 @@ const char *const JavaScriptGrammar::spell [] = { const int JavaScriptGrammar::lhs [] = { 88, 89, 89, 92, 92, 93, 93, 91, 90, 90, 95, 95, 97, 97, 96, 94, 96, 94, 96, 94, - 96, 94, 94, 94, 94, 94, 98, 98, 103, 103, + 96, 94, 94, 94, 94, 94, 94, 94, 98, 98, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, - 103, 103, 103, 105, 105, 109, 109, 104, 104, 107, - 107, 110, 110, 110, 110, 111, 111, 111, 111, 111, + 103, 103, 103, 103, 103, 105, 105, 109, 109, 104, + 104, 107, 107, 110, 110, 110, 110, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 112, 112, 113, 113, - 113, 113, 113, 116, 116, 117, 117, 117, 117, 115, - 115, 118, 118, 119, 119, 120, 120, 120, 121, 121, - 121, 121, 121, 121, 121, 121, 121, 121, 122, 122, - 122, 122, 123, 123, 123, 124, 124, 124, 124, 125, - 125, 125, 125, 125, 125, 125, 126, 126, 126, 126, - 126, 126, 127, 127, 127, 127, 127, 128, 128, 128, - 128, 128, 129, 129, 130, 130, 131, 131, 132, 132, - 133, 133, 134, 134, 135, 135, 136, 136, 137, 137, - 138, 138, 139, 139, 140, 140, 108, 108, 141, 141, - 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, - 142, 142, 100, 100, 143, 143, 144, 144, 145, 145, - 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 146, 161, 161, 160, 160, - 102, 102, 162, 162, 163, 163, 165, 165, 164, 166, - 169, 167, 167, 170, 168, 168, 147, 148, 148, 149, - 149, 150, 150, 150, 150, 150, 150, 150, 151, 151, - 151, 151, 152, 152, 152, 152, 153, 153, 154, 156, - 171, 171, 174, 174, 172, 172, 175, 173, 155, 157, - 157, 158, 158, 158, 176, 177, 159, 159, 101, 114, - 181, 181, 178, 178, 179, 179, 182, 183, 183, 184, - 184, 180, 180, 106, 106, 185}; + 111, 111, 111, 111, 111, 111, 111, 111, 112, 112, + 113, 113, 113, 113, 113, 116, 116, 117, 117, 117, + 117, 115, 115, 118, 118, 119, 119, 120, 120, 120, + 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, + 122, 122, 122, 122, 123, 123, 123, 124, 124, 124, + 124, 125, 125, 125, 125, 125, 125, 125, 126, 126, + 126, 126, 126, 126, 127, 127, 127, 127, 127, 128, + 128, 128, 128, 128, 129, 129, 130, 130, 131, 131, + 132, 132, 133, 133, 134, 134, 135, 135, 136, 136, + 137, 137, 138, 138, 139, 139, 140, 140, 108, 108, + 141, 141, 142, 142, 142, 142, 142, 142, 142, 142, + 142, 142, 142, 142, 100, 100, 143, 143, 144, 144, + 145, 145, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 146, 161, 161, + 160, 160, 102, 102, 162, 162, 163, 163, 165, 165, + 164, 166, 169, 167, 167, 170, 168, 168, 147, 148, + 148, 149, 149, 150, 150, 150, 150, 150, 150, 150, + 151, 151, 151, 151, 152, 152, 152, 152, 153, 153, + 154, 156, 171, 171, 174, 174, 172, 172, 175, 173, + 155, 157, 157, 158, 158, 158, 176, 177, 159, 159, + 101, 114, 181, 181, 178, 178, 179, 179, 182, 183, + 183, 184, 184, 180, 180, 106, 106, 185}; const int JavaScriptGrammar:: rhs[] = { 2, 1, 1, 1, 2, 3, 3, 0, 1, 2, 1, 3, 2, 3, 4, 4, 2, 2, 5, 5, - 3, 3, 3, 5, 1, 1, 1, 3, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 3, 3, 5, - 3, 4, 3, 2, 4, 1, 2, 0, 1, 3, - 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 3, 3, 3, 4, 5, 6, 1, 1, 1, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, + 3, 5, 3, 4, 3, 2, 4, 1, 2, 0, + 1, 3, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 4, 3, 5, 1, 2, 4, 4, 4, 3, 0, - 1, 1, 3, 1, 1, 1, 2, 2, 1, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 1, 3, - 3, 3, 1, 3, 3, 1, 3, 3, 3, 1, - 3, 3, 3, 3, 3, 3, 1, 3, 3, 3, - 3, 3, 1, 3, 3, 3, 3, 1, 3, 3, - 3, 3, 1, 3, 1, 3, 1, 3, 1, 3, + 1, 1, 4, 3, 5, 1, 2, 4, 4, 4, + 3, 0, 1, 1, 3, 1, 1, 1, 2, 2, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 1, 3, 3, 3, 1, 3, 3, 1, 3, 3, + 3, 1, 3, 3, 3, 3, 3, 3, 1, 3, + 3, 3, 3, 3, 1, 3, 3, 3, 3, 1, + 3, 3, 3, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, - 1, 3, 1, 5, 1, 5, 1, 3, 1, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 3, 0, 1, 1, 3, 0, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 3, 1, 2, 0, 1, - 3, 3, 1, 1, 1, 3, 1, 3, 2, 2, - 2, 0, 1, 2, 0, 1, 1, 2, 2, 7, - 5, 7, 7, 5, 9, 10, 7, 8, 2, 2, - 3, 3, 2, 2, 3, 3, 3, 3, 5, 5, - 3, 5, 1, 2, 0, 1, 4, 3, 3, 3, - 3, 3, 3, 4, 5, 2, 2, 2, 8, 8, - 1, 3, 0, 1, 0, 1, 1, 1, 2, 1, - 1, 0, 1, 0, 1, 2}; + 1, 3, 1, 3, 1, 5, 1, 5, 1, 3, + 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 3, 0, 1, 1, 3, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 3, 1, 2, + 0, 1, 3, 3, 1, 1, 1, 3, 1, 3, + 2, 2, 2, 0, 1, 2, 0, 1, 1, 2, + 2, 7, 5, 7, 7, 5, 9, 10, 7, 8, + 2, 2, 3, 3, 2, 2, 3, 3, 3, 3, + 5, 5, 3, 5, 1, 2, 0, 1, 4, 3, + 3, 3, 3, 3, 3, 4, 5, 2, 2, 2, + 8, 8, 1, 3, 0, 1, 0, 1, 1, 1, + 2, 1, 1, 0, 1, 0, 1, 2}; const int JavaScriptGrammar::action_default [] = { - 8, 2, 0, 0, 4, 3, 0, 296, 0, 6, - 7, 5, 25, 223, 0, 27, 0, 224, 9, 1, - 0, 0, 26, 0, 283, 284, 0, 281, 0, 282, - 0, 285, 126, 193, 157, 165, 161, 201, 208, 105, - 177, 207, 215, 203, 153, 0, 204, 286, 0, 291, - 90, 205, 206, 211, 106, 169, 173, 94, 123, 104, - 109, 89, 143, 209, 130, 288, 287, 290, 212, 0, - 0, 0, 0, 36, 37, 0, 33, 0, 292, 30, - 0, 294, 48, 0, 0, 0, 0, 0, 31, 34, - 0, 0, 195, 237, 35, 0, 29, 0, 0, 32, - 0, 0, 0, 0, 0, 213, 214, 119, 202, 210, - 0, 0, 106, 125, 292, 30, 294, 108, 107, 0, - 0, 0, 121, 122, 120, 0, 293, 283, 0, 0, - 285, 0, 280, 0, 295, 0, 55, 56, 57, 58, - 83, 59, 84, 60, 61, 62, 63, 64, 65, 66, - 67, 52, 68, 69, 70, 71, 72, 54, 85, 73, - 53, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 86, 0, 50, 0, 0, 42, 0, 51, 41, 124, - 0, 154, 0, 0, 0, 0, 144, 0, 0, 0, - 0, 0, 0, 134, 0, 0, 0, 128, 129, 127, - 132, 136, 135, 133, 131, 146, 145, 147, 0, 162, - 0, 158, 0, 0, 100, 99, 88, 87, 0, 0, - 98, 194, 101, 0, 102, 0, 103, 97, 238, 239, - 279, 0, 190, 183, 181, 188, 189, 187, 186, 192, - 185, 184, 182, 191, 178, 0, 166, 0, 0, 170, - 0, 0, 174, 0, 0, 100, 92, 0, 91, 0, - 96, 289, 253, 0, 254, 255, 256, 249, 0, 250, - 251, 252, 277, 278, 110, 0, 0, 0, 0, 0, - 242, 243, 199, 197, 159, 167, 163, 179, 155, 200, - 0, 106, 171, 175, 148, 137, 0, 0, 156, 0, - 0, 0, 0, 149, 0, 0, 0, 0, 0, 141, - 139, 142, 140, 138, 151, 150, 152, 0, 164, 0, - 160, 0, 198, 106, 0, 180, 195, 196, 0, 195, - 0, 0, 245, 0, 0, 0, 247, 0, 168, 0, - 0, 172, 0, 0, 176, 235, 0, 227, 236, 230, - 0, 234, 0, 195, 228, 0, 195, 0, 0, 246, - 0, 0, 0, 248, 293, 0, 269, 0, 0, 0, - 241, 0, 240, 217, 220, 0, 56, 83, 59, 84, - 61, 62, 33, 66, 67, 30, 68, 71, 31, 34, - 195, 35, 74, 29, 76, 32, 78, 79, 80, 81, - 82, 86, 218, 216, 94, 95, 100, 0, 93, 0, - 257, 258, 0, 0, 0, 260, 265, 263, 266, 0, - 0, 264, 265, 0, 261, 0, 262, 219, 268, 0, - 219, 267, 0, 270, 271, 0, 219, 272, 273, 0, - 0, 274, 0, 0, 0, 275, 276, 112, 111, 0, - 0, 0, 244, 0, 0, 0, 259, 0, 49, 0, - 46, 48, 39, 0, 45, 40, 47, 44, 38, 0, - 43, 116, 114, 118, 115, 113, 117, 0, 18, 13, - 0, 14, 10, 0, 23, 0, 24, 0, 0, 22, - 30, 48, 16, 27, 0, 11, 0, 17, 0, 20, - 12, 0, 21, 30, 48, 15, 0, 19, 28, 232, - 225, 0, 233, 229, 0, 231, 221, 0, 222, 226}; + 8, 2, 0, 0, 4, 3, 0, 298, 0, 6, + 7, 5, 27, 225, 0, 29, 0, 226, 9, 1, + 0, 0, 28, 0, 285, 286, 0, 283, 0, 284, + 0, 287, 128, 195, 159, 167, 163, 203, 210, 107, + 179, 209, 217, 205, 155, 0, 206, 288, 0, 293, + 92, 207, 208, 213, 108, 171, 175, 96, 125, 106, + 111, 91, 145, 211, 132, 290, 289, 292, 214, 0, + 0, 0, 0, 38, 39, 0, 35, 0, 294, 32, + 0, 296, 50, 0, 0, 0, 0, 0, 33, 36, + 0, 0, 197, 239, 37, 0, 31, 0, 0, 34, + 0, 0, 0, 0, 0, 215, 216, 121, 204, 212, + 0, 0, 108, 127, 294, 32, 296, 110, 109, 0, + 0, 0, 123, 124, 122, 0, 295, 285, 0, 0, + 287, 0, 282, 0, 297, 0, 57, 58, 59, 60, + 85, 61, 86, 62, 63, 64, 65, 66, 67, 68, + 69, 54, 70, 71, 72, 73, 74, 56, 87, 75, + 55, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 88, 0, 52, 0, 0, 44, 0, 53, 43, 126, + 0, 156, 0, 0, 0, 0, 146, 0, 0, 0, + 0, 0, 0, 136, 0, 0, 0, 130, 131, 129, + 134, 138, 137, 135, 133, 148, 147, 149, 0, 164, + 0, 160, 0, 0, 102, 101, 90, 89, 0, 0, + 100, 196, 103, 0, 104, 0, 105, 99, 240, 241, + 281, 0, 192, 185, 183, 190, 191, 189, 188, 194, + 187, 186, 184, 193, 180, 0, 168, 0, 0, 172, + 0, 0, 176, 0, 0, 102, 94, 0, 93, 0, + 98, 291, 255, 0, 256, 257, 258, 251, 0, 252, + 253, 254, 279, 280, 112, 0, 0, 0, 0, 0, + 244, 245, 201, 199, 161, 169, 165, 181, 157, 202, + 0, 108, 173, 177, 150, 139, 0, 0, 158, 0, + 0, 0, 0, 151, 0, 0, 0, 0, 0, 143, + 141, 144, 142, 140, 153, 152, 154, 0, 166, 0, + 162, 0, 200, 108, 0, 182, 197, 198, 0, 197, + 0, 0, 247, 0, 0, 0, 249, 0, 170, 0, + 0, 174, 0, 0, 178, 237, 0, 229, 238, 232, + 0, 236, 0, 197, 230, 0, 197, 0, 0, 248, + 0, 0, 0, 250, 295, 0, 271, 0, 0, 0, + 243, 0, 242, 219, 222, 0, 58, 85, 61, 86, + 63, 64, 35, 68, 69, 32, 70, 73, 33, 36, + 197, 37, 76, 31, 78, 34, 80, 81, 82, 83, + 84, 88, 220, 218, 96, 97, 102, 0, 95, 0, + 259, 260, 0, 0, 0, 262, 267, 265, 268, 0, + 0, 266, 267, 0, 263, 0, 264, 221, 270, 0, + 221, 269, 0, 272, 273, 0, 221, 274, 275, 0, + 0, 276, 0, 0, 0, 277, 278, 114, 113, 0, + 0, 0, 246, 0, 0, 0, 261, 0, 51, 0, + 48, 50, 41, 0, 47, 42, 49, 46, 40, 0, + 45, 118, 116, 120, 117, 115, 119, 0, 18, 13, + 0, 14, 10, 0, 0, 0, 24, 0, 26, 23, + 0, 25, 0, 0, 22, 32, 50, 16, 29, 0, + 11, 0, 17, 0, 20, 12, 0, 21, 32, 50, + 15, 0, 19, 30, 234, 227, 0, 235, 231, 0, + 233, 223, 0, 224, 228}; const int JavaScriptGrammar::goto_default [] = { - 2, 6, 19, 1, 5, 4, 18, 494, 495, 478, + 2, 6, 19, 1, 5, 4, 18, 499, 500, 478, 20, 373, 45, 12, 108, 61, 459, 457, 135, 134, 33, 458, 133, 136, 215, 57, 50, 223, 59, 39, 222, 54, 60, 107, 58, 32, 64, 62, 294, 44, 288, 34, 284, 36, 286, 35, 285, 55, 292, 56, 293, 40, 287, 283, 324, 409, 289, 290, 37, 43, 46, 51, 52, 41, 38, 63, 109, 53, 68, 105, - 106, 42, 375, 374, 21, 511, 510, 346, 347, 513, - 349, 512, 348, 415, 419, 422, 418, 417, 437, 438, + 106, 42, 375, 374, 21, 516, 515, 346, 347, 518, + 349, 517, 348, 415, 419, 422, 418, 417, 437, 438, 26, 48, 125, 25, 47, 66, 65, 0}; const int JavaScriptGrammar::action_index [] = { - -25, -88, 89, 70, -88, -15, 251, -88, 85, -88, - -88, -88, -88, -88, 56, 48, 46, -88, -88, 262, - 127, 72, -88, -17, -9, 20, -29, -88, -3, -88, - -6, 1289, 112, -88, 13, -44, -76, -88, -88, 212, - -88, -88, -88, -88, 253, 228, -88, -88, -10, -88, - -88, -88, -88, -88, 347, 53, 87, 154, 274, -88, - -88, -88, 287, -88, 191, -88, 1289, -88, -88, 199, - 194, 115, 557, -88, -88, 1205, -88, 66, 71, 77, - 63, 1541, 79, 557, 557, 557, 480, 557, -88, -88, - 557, 557, 557, -88, -88, 60, -88, 557, 557, -88, - 41, 557, 557, 42, 44, -88, -88, -88, -88, -88, - 557, 557, 83, 177, -24, -88, 1037, -88, -88, 557, - 557, 557, -88, -88, -88, 25, -88, -18, -58, -8, - 1289, -26, -88, 58, 64, 67, -88, -88, -88, -88, + -8, -88, 76, 23, -88, 35, 267, -88, 62, -88, + -88, -88, -88, -88, 49, 58, 122, -88, -88, 257, + 124, -17, -88, -22, -16, 12, -39, -88, 0, -88, + -2, 1331, 132, -88, 8, -47, -69, -88, -88, 209, + -88, -88, -88, -88, 255, 177, -88, -88, -10, -88, + -88, -88, -88, -88, 522, 45, 92, 236, 224, -88, + -88, -88, 437, -88, 215, -88, 1331, -88, -88, 164, + 206, 107, 599, -88, -88, 1247, -88, 78, 77, 87, + 69, 1583, 60, 599, 599, 599, 398, 599, -88, -88, + 599, 599, 599, -88, -88, 80, -88, 599, 599, -88, + 63, 599, 599, 66, 59, -88, -88, -88, -88, -88, + 599, 599, 123, 174, -1, -88, 1079, -88, -88, 599, + 599, 599, -88, -88, -88, 16, -88, -24, -54, -11, + 1331, 18, -88, 86, 84, 20, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, - -88, 557, -88, 1121, 55, -88, 557, -88, -88, 175, - 557, 250, 557, 557, 557, 557, 404, 557, 557, 557, - 557, 557, 557, 158, 557, 557, 557, 80, 73, 81, - 197, 238, 220, 159, 167, 277, 404, 317, 557, 14, - 557, 90, 953, 557, 557, -88, -88, -88, 108, 557, - -88, -88, 65, 49, -88, 557, -88, -88, -88, -88, - -88, 557, -88, -88, -88, -88, -88, -88, -88, -88, - -88, -88, -88, -88, -88, 557, 45, 557, 557, 75, - 69, 557, -88, 953, 557, 557, -88, 153, -88, 6, - -88, -88, -88, 105, -88, -88, -88, -88, 111, -88, - -88, -88, -88, -88, -88, 21, 62, 557, 122, 95, - -88, -88, 634, -88, 39, -30, -59, -88, 259, 8, - -46, 417, 19, 125, 339, 188, -7, 557, 248, 557, - 557, 557, 557, 339, 557, 557, 557, 557, 557, 187, - 166, 192, 206, 232, 339, 339, 339, 557, -59, 557, - 39, 557, -88, 380, 557, -88, 557, -5, -60, 557, - -48, 1205, -88, 557, 142, 1205, -88, 557, -38, 557, - 557, 7, 0, 557, -88, 17, 84, 22, -88, -88, - 557, -88, 27, 557, -88, -13, 557, 52, 1205, -88, - 557, 102, 1205, -88, 28, 1205, -88, 557, 100, 1205, - 34, 1205, -88, -88, 1205, -19, 139, 9, 149, 82, - 557, 1205, 23, 1, 119, 36, 10, 480, 40, 120, - 869, 35, 5, 26, 557, 37, -1, 557, 29, 557, - 31, 33, -88, -88, 205, -88, 557, -11, -88, 78, - -88, -88, 557, 98, 38, -88, 47, -88, 54, 198, - 557, -88, 30, 32, -88, -4, -88, 1205, -88, 107, - 1205, -88, 213, -88, -88, 113, 1205, 43, -88, 18, - 24, -88, -21, -54, -20, -88, -88, -88, -88, 557, - 143, 1205, -88, 557, 110, 1205, -88, 118, 16, 788, - -88, 15, -88, 711, -88, -88, -88, -88, -88, 121, - -88, -88, -88, -88, -88, -88, -88, 298, -88, -88, - 284, -88, -88, 59, 76, 557, 74, 1373, 57, -88, - 147, 130, -88, 61, 97, -88, 96, -88, 50, -88, - -88, 1457, -88, 116, 99, -88, 109, -88, -88, 51, - -88, 190, -88, -88, 557, -88, -88, 68, -88, -88, + -88, 599, -88, 1163, 52, -88, 599, -88, -88, 191, + 599, 266, 599, 599, 599, 599, 329, 599, 599, 599, + 599, 599, 599, 157, 599, 599, 599, 120, 103, 90, + 196, 192, 175, 163, 195, 345, 366, 312, 599, 22, + 599, 73, 995, 599, 599, -88, -88, -88, 148, 599, + -88, -88, 64, 48, -88, 599, -88, -88, -88, -88, + -88, 599, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, 599, 34, 599, 599, 171, + 74, 599, -88, 995, 599, 599, -88, 154, -88, 40, + -88, -88, -88, 116, -88, -88, -88, -88, 88, -88, + -88, -88, -88, -88, -88, 37, 65, 599, 129, 97, + -88, -88, 676, -88, 53, -33, -59, -88, 258, 11, + -43, 478, 85, 113, 282, 225, -13, 599, 247, 599, + 599, 599, 599, 286, 599, 599, 599, 599, 599, 219, + 222, 231, 307, 237, 372, 372, 372, 599, -46, 599, + 24, 599, -88, 522, 599, -88, 599, 15, -50, 599, + -60, 1247, -88, 599, 156, 1247, -88, 599, -44, 599, + 599, 85, 1, 599, -88, -14, 119, -29, -88, -88, + 599, -88, 6, 599, -88, -3, 599, -5, 1247, -88, + 599, 101, 1247, -88, 26, 1247, -88, 599, 95, 1247, + 51, 1247, -88, -88, 1247, 14, 146, 31, 150, 72, + 599, 1247, 57, 27, 81, 54, 29, 406, 44, 43, + 834, 30, 7, 32, 599, 25, 5, 599, 4, 599, + 10, 13, -88, -88, 244, -88, 599, -12, -88, 83, + -88, -88, 599, 139, 9, -88, 36, -88, 21, 126, + 599, -88, 39, 33, -88, -21, -88, 1247, -88, 118, + 1247, -88, 221, -88, -88, 109, 1247, 46, -88, 17, + 3, -88, 28, -4, -9, -88, -88, -88, -88, 599, + 145, 1247, -88, 599, 149, 1247, -88, 162, 2, 753, + -88, 19, -88, 911, -88, -88, -88, -88, -88, 127, + -88, -88, -88, -88, -88, -88, -88, 302, -88, -88, + 291, -88, -88, 41, 42, 61, 79, 599, 75, 82, + 599, 71, 1499, 56, -88, 115, 111, -88, 47, 110, + -88, 106, -88, 70, -88, -88, 1415, -88, 105, 99, + -88, 96, -88, -88, 67, -88, 166, -88, -88, 599, + -88, -88, 68, -88, -88, - -98, -98, -98, -98, -98, 30, 13, -98, -98, -98, - -98, -98, -98, -98, -98, -98, -98, -98, -98, 87, + -98, -98, -98, -98, -98, 2, 9, -98, -98, -98, + -98, -98, -98, -98, -98, -98, -98, -98, -98, 70, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, - -98, 83, -98, -98, -98, -98, -98, -98, -98, -98, + -98, 157, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, - -98, -98, -98, -98, -43, -98, -98, -98, -98, -98, - -98, -98, -98, -98, -98, -98, 184, -98, -98, -98, - -98, -98, 113, -98, -98, -9, -98, -98, -98, -98, - -98, -98, -98, 42, 116, 112, 127, 146, -98, -98, - 151, 147, 40, -98, -98, -98, -98, 37, 89, -98, - -10, 90, 86, -98, -98, -98, -98, -98, -98, -98, - 77, 94, -98, -98, -98, -98, -98, -98, -98, 106, - 103, 98, -98, -98, -98, -98, -98, -47, -98, -98, - 253, -98, -98, -98, -98, -98, -98, -98, -98, -98, + -98, -98, -98, -98, -39, -98, -98, -98, -98, -98, + -98, -98, -98, -98, -98, -98, 258, -98, -98, -98, + -98, -98, 100, -98, -98, 15, -98, -98, -98, -98, + -98, -98, -98, 51, 81, 90, 91, 103, -98, -98, + 76, 60, 44, -98, -98, -98, -98, 50, 114, -98, + -13, 133, 125, -98, -98, -98, -98, -98, -98, -98, + 171, 128, -98, -98, -98, -98, -98, -98, -98, 107, + 120, 117, -98, -98, -98, -98, -98, -61, -98, -98, + 173, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, - -98, -7, -98, 0, -98, -98, -3, -98, -98, -98, - 136, -98, 117, 119, 132, 134, -98, 130, 49, 36, - 35, 61, 64, -98, 47, 46, 38, -98, -98, -98, - -98, -98, -98, -98, -98, -98, -98, -98, 59, -98, - 58, -98, 24, 32, 17, -98, -98, -98, -98, 21, - -98, -98, -98, -98, -98, 8, -98, -98, -98, -98, - -98, 4, -98, -98, -98, -98, -98, -98, -98, -98, - -98, -98, -98, -98, -98, 60, -98, 57, -19, -98, - -98, -17, -98, 118, 44, 133, -98, -98, -98, -98, + -98, 34, -98, 36, -98, -98, 40, -98, -98, -98, + 63, -98, 55, 64, 66, 68, -98, 54, 42, 43, + 46, 52, 93, -98, 97, 95, 69, -98, -98, -98, + -98, -98, -98, -98, -98, -98, -98, -98, 75, -98, + 79, -98, 19, 32, 16, -98, -98, -98, -98, 12, + -98, -98, -98, -98, -98, 27, -98, -98, -98, -98, + -98, 33, -98, -98, -98, -98, -98, -98, -98, -98, + -98, -98, -98, -98, -98, 80, -98, 96, 35, -98, + -98, 39, -98, 47, 37, 48, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, - -98, -98, -98, -98, -98, -98, -98, 3, -98, -98, - -98, -98, 67, -98, -98, -98, -98, -98, -98, -98, - -98, -98, -98, -98, -98, -98, -98, 186, -98, 196, - 183, 177, 187, -98, 82, 76, 79, 96, 99, -98, - -98, -98, -98, -98, -98, -98, -98, 168, -98, 158, - -98, 156, -98, -98, 175, -98, 102, -98, -98, 104, - -98, 25, -98, 27, -98, 29, -98, 155, -98, 154, - 157, -98, -98, 167, -98, -98, -98, -98, -98, -98, - 193, -98, -48, 126, -98, -98, 128, -98, 15, -98, - 19, -98, 22, -98, -98, 23, -98, 20, -98, 18, - -98, 34, -98, -98, 53, -98, -98, -98, -98, -98, - 93, 52, -98, -98, -98, -98, -98, 81, -98, -98, - 45, -98, -98, -98, 43, -98, -35, 137, -98, 141, - -98, -98, -98, -98, -98, -98, 131, -98, -98, -98, - -98, -98, -8, -98, -98, -98, -98, -98, -77, -98, - 6, -98, -76, -98, -98, -98, -98, -52, -98, -98, - -51, -98, -98, -98, -98, -98, -98, -75, -98, -98, - -46, -98, -98, -98, -49, -98, -98, -98, -98, 7, - -98, 5, -98, -12, -98, 75, -98, -98, -98, -14, - -98, -11, -98, -13, -98, -98, -98, -98, -98, -98, - -98, -98, -98, -98, -98, -98, -98, 73, -98, -98, - 56, -98, -98, -98, -98, 41, -98, 39, -98, -98, - 50, 48, -98, 51, -98, -98, -98, -98, 66, -98, - -98, 31, -98, 16, 166, -98, -98, -98, -98, -98, - -98, -98, -98, -98, 26, -98, -98, -38, -98, -98}; + -98, -98, -98, -98, -98, -98, -98, 31, -98, -98, + -98, -98, 86, -98, -98, -98, -98, -98, -98, -98, + -98, -98, -98, -98, -98, -98, -98, 190, -98, 176, + 172, 180, 168, -98, 124, 136, 138, 106, 121, -98, + -98, -98, -98, -98, -98, -98, -98, 152, -98, 159, + -98, 186, -98, -98, 192, -98, 134, -98, -98, 137, + -98, 30, -98, 18, -98, 22, -98, 196, -98, 188, + 184, -98, -98, 145, -98, -98, -98, -98, -98, -98, + 144, -98, -51, 127, -98, -98, 123, -98, 23, -98, + 25, -98, 28, -98, -98, 29, -98, 26, -98, 24, + -98, 17, -98, -98, 41, -98, -98, -98, -98, -98, + 130, 53, -98, -98, -98, -98, -98, 116, -98, -98, + 45, -98, -98, -98, 49, -98, -12, 65, -98, 56, + -98, -98, -98, -98, -98, -98, 88, -98, -98, -98, + -98, -98, 38, -98, -98, -98, -98, -98, -81, -98, + -7, -98, -83, -98, -98, -98, -98, -72, -98, -98, + -64, -98, -98, -98, -98, -98, -98, -70, -98, -98, + -42, -98, -98, -98, -33, -98, -98, -98, -98, -2, + -98, 0, -98, 5, -98, 7, -98, -98, -98, -6, + -98, 6, -98, 11, -98, -98, -98, -98, -98, -98, + -98, -98, -98, -98, -98, -98, -98, 163, -98, -98, + 165, -98, -98, -98, -98, -98, -98, -8, -98, -98, + 8, -98, 10, -98, -98, 4, -1, -98, 3, -98, + -98, -98, -98, 57, -98, -98, 13, -98, 104, 59, + -98, -98, -98, -98, -98, -98, -98, -98, -98, -17, + -98, -98, -74, -98, -98}; const int JavaScriptGrammar::action_info [] = { - 210, 329, 129, 219, 208, 126, 444, 343, 443, 337, - 317, 27, 331, 436, 180, 326, 321, 319, 317, 24, - 27, 337, 345, 460, 466, 130, 29, 31, 28, 132, - -64, 30, 436, -75, 350, 420, 403, 282, -223, 427, - 297, 412, -53, -52, -77, 230, 367, -72, 356, 408, - 371, 426, 420, 360, 442, 245, 345, 436, -224, 420, - 3, 127, 176, 440, 24, 171, 260, 449, 514, 453, - 3, 416, 173, 225, 436, 483, 251, 245, 449, 493, - 453, 477, 219, 485, 365, 23, 508, 460, 484, 7, - 210, 180, 352, 208, 477, 276, 412, 509, 277, 367, - 364, 509, 282, 501, 0, 498, 219, 460, 219, 227, - 219, 488, 358, 110, 430, 219, 219, 498, 219, 439, - 110, 110, 178, 365, 111, 117, 461, -54, 493, 219, - 219, 111, 111, 440, 487, 8, 118, 247, 460, 411, - 410, 248, 488, 273, 272, 353, 10, 9, 126, 477, - 219, 219, 110, 499, 365, -292, 281, 280, 414, 493, - 369, 219, 362, 111, 220, 507, 266, 265, 263, 253, - 455, 0, 271, 270, 462, 339, 273, 272, 268, 340, - 477, 470, 279, 194, 194, 195, 195, 119, 254, 119, - 255, 194, 194, 195, 195, 0, 196, 196, 517, 0, - 264, 262, 335, 451, 196, 196, 0, 0, 423, 258, - 269, 267, 194, 194, 195, 195, 194, 194, 195, 195, - 253, 219, 194, 268, 195, 196, 196, 212, 263, 196, - 196, 194, 120, 195, 120, 196, 219, 0, 121, 254, - 121, 406, 0, 0, 196, 194, 213, 195, 214, 0, - 0, 518, 516, 424, 0, 269, 267, 194, 196, 195, - 264, 262, 0, 194, 0, 195, 299, 300, 182, 183, - 196, 182, 183, 14, 434, 433, 196, 299, 300, 0, - 15, 0, 0, 0, 14, 0, 119, 0, 0, 229, - 228, 15, 0, 301, 302, 184, 185, 0, 184, 185, - 187, 188, 0, 0, 301, 302, 14, 0, 189, 190, - 187, 188, 191, 15, 192, 0, 0, 0, 189, 190, - 14, 0, 191, 17, 192, 0, 0, 15, 0, 0, - 0, 120, 13, 0, 17, 16, 0, 121, 0, 481, - 187, 188, 0, 13, 0, 0, 16, 0, 189, 190, - 232, 0, 191, 479, 192, 0, 17, 0, 0, 0, - 233, 0, 304, 305, 234, 13, 0, 0, 16, 0, - 17, 306, 0, 235, 307, 236, 308, 0, 0, 13, - 0, 0, 16, 232, 0, 0, 237, 0, 238, 117, - 0, 0, 0, 233, 0, 0, 239, 234, 0, 240, - 118, 0, 0, 0, 0, 241, 235, 0, 236, 0, - 0, 242, 0, 0, 0, 0, 0, 0, 0, 237, - 232, 238, 117, 0, 243, 0, 0, 187, 188, 239, - 233, 0, 240, 118, 234, 189, 190, 0, 241, 191, - 0, 192, 0, 235, 242, 236, 0, 0, 333, 0, - 0, 0, 0, 0, 0, 0, 237, 243, 238, 117, - 0, 0, 0, 0, 0, 0, 239, 0, 0, 240, - 118, 0, 0, 0, 0, 241, 0, 0, 0, 0, - 0, 242, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 73, 74, 243, 0, 0, 0, 0, 0, - 0, 0, 114, 0, 0, 0, 0, 0, 0, 115, - 0, 0, 0, 116, 82, 0, 83, 0, 0, 0, - 0, 0, 0, 86, 0, 0, 0, 89, 0, 0, + 331, 208, 360, 350, 317, 27, 129, 210, 343, 180, + 466, 329, 514, 27, 24, 317, 345, 319, 326, 321, + 28, 30, 130, 219, 436, 297, 420, 460, 126, 29, + 319, 31, -79, -226, 426, 345, 436, -55, 436, -77, + 427, 420, 416, 412, 420, 230, 449, 245, 408, 453, + -56, -74, 127, 442, 297, 358, 444, 443, 356, 176, + -225, -54, 24, 282, -66, 367, 440, 371, 460, 403, + 485, 489, 225, 132, 180, 178, 7, 3, 23, 219, + 477, 251, 208, 219, 519, 513, 487, 337, 8, 490, + 486, 477, 173, 171, 365, 453, 436, 514, 210, 498, + 260, 277, 449, 219, 503, 367, 364, 460, 227, 219, + 126, 276, 365, 506, 282, 439, 412, -294, 503, 460, + 3, 493, 365, 10, 9, 430, 219, 352, 498, 440, + 110, 492, 483, 273, 272, 219, 423, 219, 477, 493, + 498, 111, 247, 110, 411, 410, 248, 219, 477, 271, + 270, 484, 512, 219, 111, 369, 219, 219, 281, 280, + 110, 362, 219, 339, 219, 117, 504, 340, 273, 272, + 461, 111, 110, 245, 522, 263, 118, 266, 265, 268, + 353, 424, 194, 111, 195, 219, 119, 470, 194, 279, + 195, 0, 0, 263, 0, 196, 0, 0, 0, 414, + 194, 196, 195, 119, 220, 451, 0, 264, 262, 455, + 258, 269, 267, 196, 0, 0, 335, 194, 462, 195, + 194, 194, 195, 195, 212, 264, 262, 523, 521, 219, + 196, 120, 0, 196, 196, 268, 119, 121, 229, 228, + 194, 0, 195, 213, 194, 214, 195, 194, 120, 195, + 194, 253, 195, 196, 121, 0, 194, 196, 195, 253, + 196, 0, 194, 196, 195, 299, 300, 269, 267, 196, + 254, 0, 255, 182, 183, 196, 299, 300, 254, 14, + 406, 120, 434, 433, 182, 183, 15, 121, 0, 14, + 0, 0, 301, 302, 0, 0, 15, 0, 0, 0, + 184, 185, 0, 301, 302, 304, 305, 0, 0, 304, + 305, 184, 185, 14, 306, 0, 0, 307, 306, 308, + 15, 307, 0, 308, 14, 0, 0, 0, 0, 17, + 0, 15, 194, 0, 195, 187, 188, 0, 13, 17, + 0, 16, 0, 189, 190, 196, 481, 191, 13, 192, + 0, 16, 187, 188, 0, 0, 0, 479, 0, 0, + 189, 190, 0, 17, 191, 0, 192, 0, 187, 188, + 0, 0, 13, 0, 17, 16, 189, 190, 0, 0, + 191, 0, 192, 13, 0, 0, 16, 0, 0, 187, + 188, 0, 0, 0, 0, 304, 305, 189, 190, 0, + 0, 191, 0, 192, 306, 0, 0, 307, 0, 308, + 73, 74, 0, 0, 0, 0, 0, 0, 73, 74, + 114, 0, 0, 0, 0, 0, 0, 115, 114, 0, + 0, 116, 82, 0, 83, 115, 0, 0, 0, 116, + 82, 86, 83, 0, 0, 89, 0, 0, 0, 86, + 0, 0, 0, 89, 0, 0, 0, 0, 0, 0, + 187, 188, 0, 94, 0, 96, 0, 0, 189, 190, + 0, 94, 191, 96, 192, 0, 88, 99, 76, 0, + 0, 232, 0, 0, 88, 99, 76, 0, 0, 0, + 0, 233, 0, 0, 0, 234, 0, 0, 0, 0, + 0, 0, 0, 0, 235, 0, 236, 0, 0, 333, + 0, 0, 0, 0, 0, 0, 0, 237, 0, 238, + 117, 0, 0, 0, 0, 232, 0, 239, 0, 0, + 240, 118, 0, 0, 0, 233, 241, 0, 0, 234, + 0, 0, 242, 0, 0, 0, 0, 0, 235, 0, + 236, 0, 0, 0, 0, 243, 0, 0, 0, 0, + 0, 237, 0, 238, 117, 0, 0, 0, 0, 0, + 0, 239, 0, 0, 240, 118, 0, 0, 0, 0, + 241, 0, 0, 0, 0, 0, 242, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 243, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 94, 0, 96, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 88, 99, - 76, 0, 0, 0, 0, 0, 0, 0, 72, 73, - 74, 0, 0, 0, 0, 0, 0, 0, 0, 114, - 0, 0, 0, 0, 0, 0, 115, 0, 0, 0, - 116, 82, 0, 83, 0, 0, 0, 84, 0, 85, - 86, 87, 0, 0, 89, 0, 0, 0, 90, 0, - 91, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 94, 0, 96, 0, 98, 0, 101, 0, - 102, 0, 0, 0, 0, 88, 99, 76, 0, 0, - 0, 0, 0, 0, 0, 72, 73, 74, 0, 0, + 72, 73, 74, 0, 0, 0, 0, 0, 0, 0, + 0, 114, 0, 0, 0, 0, 0, 0, 115, 0, + 0, 0, 116, 82, 0, 83, 0, 0, 0, 84, + 0, 85, 86, 87, 0, 0, 89, 0, 0, 0, + 90, 0, 91, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 94, 0, 96, 0, 98, 0, + 101, 0, 102, 0, 0, 0, 0, 88, 99, 76, + 0, 0, 0, 0, 0, 0, 0, 72, 73, 74, + 0, 0, 0, 0, 0, 0, 0, 0, 114, 0, + 0, 0, 0, 0, 0, 115, 0, 0, 0, 116, + 82, 0, 83, 0, 0, 0, 84, 0, 85, 86, + 87, 0, 0, 89, 0, 0, 0, 90, 0, 91, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 94, 0, 96, 0, 98, 0, 101, 296, 102, + 0, 0, 0, 0, 88, 99, 76, 0, 0, 0, + 0, 0, 0, 0, 72, 73, 74, 0, 0, 0, + 0, 0, 0, 0, 0, 114, 0, 0, 0, 0, + 0, 0, 115, 0, 0, 0, 116, 82, 0, 83, + 0, 0, 0, 84, 0, 85, 86, 87, 0, 0, + 89, 0, 0, 0, 90, 0, 91, 0, 0, 468, + 0, 0, 0, 0, 0, 0, 0, 0, 94, 0, + 96, 0, 98, 0, 101, 0, 102, 0, 0, 0, + 0, 88, 99, 76, 0, 0, 0, 0, 0, 0, + 0, -75, 0, 0, 0, 72, 73, 74, 0, 0, 0, 0, 0, 0, 0, 0, 114, 0, 0, 0, 0, 0, 0, 115, 0, 0, 0, 116, 82, 0, 83, 0, 0, 0, 84, 0, 85, 86, 87, 0, 0, 89, 0, 0, 0, 90, 0, 91, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 94, - 0, 96, 0, 98, 0, 101, 296, 102, 0, 0, + 0, 96, 0, 98, 0, 101, 0, 102, 0, 0, 0, 0, 88, 99, 76, 0, 0, 0, 0, 0, 0, 0, 72, 73, 74, 0, 0, 0, 0, 0, 0, 0, 0, 114, 0, 0, 0, 0, 0, 0, @@ -370,51 +393,52 @@ const int JavaScriptGrammar::action_info [] = { 0, 0, 90, 0, 91, 0, 0, 465, 0, 0, 0, 0, 0, 0, 0, 0, 94, 0, 96, 0, 98, 0, 101, 0, 102, 0, 0, 0, 0, 88, - 99, 76, 0, 0, 0, 0, 0, 0, 0, 72, - 73, 74, 0, 0, 0, 0, 0, 0, 0, 0, - 114, 0, 0, 0, 0, 0, 0, 115, 0, 0, - 0, 116, 82, 0, 83, 0, 0, 0, 84, 0, - 85, 86, 87, 0, 0, 89, 0, 0, 0, 90, - 0, 91, 0, 0, 468, 0, 0, 0, 0, 0, - 0, 0, 0, 94, 0, 96, 0, 98, 0, 101, - 0, 102, 0, 0, 0, 0, 88, 99, 76, 0, - 0, 0, 0, 0, 0, 0, -73, 0, 0, 0, - 72, 73, 74, 0, 0, 0, 0, 0, 0, 0, - 0, 114, 0, 0, 0, 0, 0, 0, 115, 0, - 0, 0, 116, 82, 0, 83, 0, 0, 0, 84, - 0, 85, 86, 87, 0, 0, 89, 0, 0, 0, - 90, 0, 91, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 94, 0, 96, 0, 98, 0, - 101, 0, 102, 0, 0, 0, 0, 88, 99, 76, - 0, 0, 0, 0, 0, 0, 0, 137, 138, 139, + 99, 76, 0, 0, 0, 0, 0, 0, 0, 137, + 138, 139, 0, 0, 141, 143, 144, 0, 0, 145, + 0, 146, 0, 0, 0, 148, 149, 150, 0, 0, + 0, 0, 0, 0, 217, 152, 153, 154, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 155, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 159, 0, 0, 0, 0, 0, + 0, 161, 162, 163, 0, 165, 166, 167, 168, 169, + 170, 0, 0, 156, 164, 147, 140, 142, 158, 0, + 0, 0, 0, 137, 138, 139, 0, 0, 141, 143, + 144, 0, 0, 145, 0, 146, 0, 0, 0, 148, + 149, 150, 0, 0, 0, 0, 0, 0, 151, 152, + 153, 154, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 155, 0, 0, 0, 157, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 159, 0, + 0, 0, 0, 0, 160, 161, 162, 163, 0, 165, + 166, 167, 168, 169, 170, 0, 0, 156, 164, 147, + 140, 142, 158, 0, 0, 0, 0, 137, 138, 139, 0, 0, 141, 143, 144, 0, 0, 145, 0, 146, 0, 0, 0, 148, 149, 150, 0, 0, 0, 0, - 0, 0, 217, 152, 153, 154, 0, 0, 0, 0, + 0, 0, 151, 152, 153, 154, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 155, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 159, 0, 0, 0, 0, 0, 0, 161, + 157, 0, 0, 0, 0, 0, 0, 0, 175, 0, + 0, 0, 159, 0, 0, 0, 0, 0, 160, 161, 162, 163, 0, 165, 166, 167, 168, 169, 170, 0, 0, 156, 164, 147, 140, 142, 158, 0, 0, 0, - 0, 137, 138, 139, 0, 0, 141, 143, 144, 0, - 0, 145, 0, 146, 0, 0, 0, 148, 149, 150, - 0, 0, 0, 0, 0, 0, 151, 152, 153, 154, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 155, 0, 0, 0, 157, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 159, 0, 0, 0, - 0, 0, 160, 161, 162, 163, 0, 165, 166, 167, - 168, 169, 170, 0, 0, 156, 164, 147, 140, 142, - 158, 0, 0, 0, 0, 137, 138, 139, 0, 0, - 141, 143, 144, 0, 0, 145, 0, 146, 0, 0, - 0, 148, 149, 150, 0, 0, 0, 0, 0, 0, - 151, 152, 153, 154, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 155, 0, 0, 0, 157, 0, - 0, 0, 0, 0, 0, 0, 175, 0, 0, 0, - 159, 0, 0, 0, 0, 0, 160, 161, 162, 163, - 0, 165, 166, 167, 168, 169, 170, 0, 0, 156, - 164, 147, 140, 142, 158, 0, 0, 0, 0, 69, + 0, 69, 0, 0, 0, 0, 70, 0, 72, 73, + 74, 75, 0, 0, 0, 0, 0, 0, 77, 114, + 0, 0, 0, 0, 0, 0, 79, 80, 0, 0, + 81, 82, 0, 83, 0, 0, 0, 84, 0, 85, + 86, 87, 0, 0, 89, 0, 0, 0, 90, 0, + 91, 0, 0, 0, 0, 0, 92, 0, 93, 0, + 0, 0, 94, 95, 96, 97, 98, 100, 101, 17, + 102, 103, 104, 0, 0, 88, 99, 76, 13, 71, + 0, 0, 0, 0, 0, 69, 0, 0, 0, 0, + 70, 0, 72, 73, 74, 75, 0, 0, 0, 0, + 0, 0, 77, 78, 0, 0, 0, 0, 0, 0, + 79, 80, 0, 0, 81, 82, 0, 83, 0, 0, + 0, 84, 0, 85, 86, 87, 0, 0, 89, 0, + 0, 0, 90, 0, 91, 0, 0, 0, 0, 0, + 92, 0, 93, 0, 0, 0, 94, 95, 96, 97, + 98, 100, 101, 17, 102, 103, 104, 0, 0, 88, + 99, 76, 13, 71, 0, 0, 0, 0, 0, 69, 0, 0, 0, 0, 70, 0, 72, 73, 74, 75, 0, 0, 0, 0, 0, 0, 77, 114, 0, 0, - 0, 0, 0, 0, 79, 80, 0, 0, 81, 82, + 0, 0, 0, 0, 508, 80, 0, 0, 81, 509, 0, 83, 0, 0, 0, 84, 0, 85, 86, 87, 0, 0, 89, 0, 0, 0, 90, 0, 91, 0, 0, 0, 0, 0, 92, 0, 93, 0, 0, 0, @@ -422,148 +446,152 @@ const int JavaScriptGrammar::action_info [] = { 104, 0, 0, 88, 99, 76, 13, 71, 0, 0, 0, 0, 0, 69, 0, 0, 0, 0, 70, 0, 72, 73, 74, 75, 0, 0, 0, 0, 0, 0, - 77, 78, 0, 0, 0, 0, 0, 0, 79, 80, - 0, 0, 81, 82, 0, 83, 0, 0, 0, 84, + 77, 114, 0, 0, 0, 0, 0, 0, 495, 80, + 0, 0, 81, 496, 0, 83, 0, 0, 0, 84, 0, 85, 86, 87, 0, 0, 89, 0, 0, 0, 90, 0, 91, 0, 0, 0, 0, 0, 92, 0, 93, 0, 0, 0, 94, 95, 96, 97, 98, 100, 101, 17, 102, 103, 104, 0, 0, 88, 99, 76, - 13, 71, 0, 0, 0, 0, 0, 69, 0, 0, - 0, 0, 70, 0, 72, 73, 74, 75, 0, 0, - 0, 0, 0, 0, 77, 114, 0, 0, 0, 0, - 0, 0, 490, 80, 0, 0, 81, 491, 0, 83, - 0, 0, 0, 84, 0, 85, 86, 87, 0, 0, - 89, 0, 0, 0, 90, 0, 91, 0, 0, 0, - 0, 0, 92, 0, 93, 0, 0, 0, 94, 95, - 96, 97, 98, 100, 101, 17, 102, 103, 104, 0, - 0, 88, 99, 76, 13, 71, 0, 0, 0, 0, - 0, 69, 0, 0, 0, 0, 70, 0, 72, 73, - 74, 75, 0, 0, 0, 0, 0, 0, 77, 114, - 0, 0, 0, 0, 0, 0, 503, 80, 0, 0, - 81, 504, 0, 83, 0, 0, 0, 84, 0, 85, - 86, 87, 0, 0, 89, 0, 0, 0, 90, 0, - 91, 0, 0, 0, 0, 0, 92, 0, 93, 0, - 0, 0, 94, 95, 96, 97, 98, 100, 101, 17, - 102, 103, 104, 0, 0, 88, 99, 76, 13, 71, - 0, 0, 0, 0, 0, 376, 138, 139, 0, 0, - 378, 143, 380, 73, 74, 381, 0, 146, 0, 0, - 0, 148, 383, 384, 0, 0, 0, 0, 0, 0, - 385, 386, 153, 154, 81, 82, 0, 83, 0, 0, - 0, 84, 0, 85, 387, 87, 0, 0, 389, 0, - 0, 0, 90, 0, 91, 0, -219, 0, 0, 0, - 390, 0, 93, 0, 0, 0, 391, 392, 393, 394, - 98, 396, 397, 398, 399, 400, 401, 0, 0, 388, - 395, 382, 377, 379, 158, 0, 0, 0, 0, + 13, 71, 0, 0, 0, 0, 0, 376, 138, 139, + 0, 0, 378, 143, 380, 73, 74, 381, 0, 146, + 0, 0, 0, 148, 383, 384, 0, 0, 0, 0, + 0, 0, 385, 386, 153, 154, 81, 82, 0, 83, + 0, 0, 0, 84, 0, 85, 387, 87, 0, 0, + 389, 0, 0, 0, 90, 0, 91, 0, -221, 0, + 0, 0, 390, 0, 93, 0, 0, 0, 391, 392, + 393, 394, 98, 396, 397, 398, 399, 400, 401, 0, + 0, 388, 395, 382, 377, 379, 158, 0, 0, 0, + 0, - 454, 250, 275, 252, 413, 463, 467, 464, 425, 445, - 421, 231, 446, 172, 441, 278, 452, 177, 429, 450, - 428, 431, 174, 435, 244, 505, 359, 22, 226, 370, - 354, 361, 368, 363, 366, 11, 332, 224, 519, 334, - 336, 221, 502, 128, 218, 372, 515, 216, 435, 432, - 489, 0, 327, 486, 469, 432, 257, 327, 496, 492, - 497, 0, 482, 275, 402, 0, 112, 112, 0, 112, - 22, 202, 201, 199, 500, 480, 496, 112, 112, 0, - 112, 198, 197, 0, 0, 200, 456, 22, 112, 112, - 112, 112, 112, 482, 67, 112, 49, 203, 291, 211, - 204, 22, 209, 295, 249, 246, 404, 112, 112, 405, - 112, 113, 310, 112, 327, 311, 327, 112, 309, 448, - 112, 112, 476, 447, 112, 112, 274, 112, 179, 112, - 112, 124, 312, 0, 112, 313, 123, 112, 327, 122, - 327, 216, 256, 112, 112, 472, 274, 112, 112, 471, - 112, 224, 404, 224, 186, 405, 205, 328, 407, 330, - 259, 112, 0, 112, 0, 112, 193, 112, 112, 206, - 447, 207, 112, 506, 448, 181, 496, 112, 112, 473, - 475, 355, 112, 357, 474, 112, 112, 323, 323, 112, - 295, 295, 295, 295, 295, 67, 0, 49, 323, 112, - 320, 338, 341, 295, 295, 0, 323, 0, 112, 322, - 342, 295, 318, 295, 112, 315, 0, 112, 112, 295, - 344, 314, 295, 295, 323, 316, 298, 112, 325, 295, - 0, 0, 295, 0, 303, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 351, 0, 0, 0, + 428, 425, 524, 520, 488, 429, 421, 11, 431, 501, + 450, 452, 502, 497, 467, 231, 446, 454, 456, 441, + 491, 494, 463, 22, 507, 445, 275, 354, 372, 128, + 334, 464, 221, 336, 359, 370, 224, 361, 368, 363, + 366, 332, 216, 278, 218, 435, 435, 226, 0, 257, + 413, 0, 402, 244, 172, 250, 327, 327, 174, 252, + 177, 432, 432, 469, 275, 505, 511, 501, 224, 501, + 216, 256, 0, 112, 112, 259, 482, 112, 200, 201, + 0, 0, 202, 112, 22, 112, 112, 112, 203, 448, + 193, 112, 186, 475, 112, 112, 112, 112, 447, 112, + 112, 205, 181, 206, 199, 207, 112, 112, 224, 474, + 112, 112, 112, 510, 471, 407, 404, 291, 209, 405, + 211, 112, 295, 472, 112, 246, 112, 112, 112, 204, + 198, 112, 197, 274, 112, 327, 473, 112, 112, 327, + 122, 404, 312, 249, 405, 112, 327, 476, 112, 327, + 124, 112, 112, 123, 0, 112, 112, 313, 448, 112, + 309, 112, 179, 274, 112, 480, 447, 112, 67, 112, + 49, 482, 310, 0, 311, 323, 323, 22, 357, 22, + 295, 295, 355, 112, 67, 0, 49, 0, 295, 328, + 112, 0, 330, 0, 0, 295, 318, 351, 344, 112, + 0, 320, 112, 112, 295, 113, 316, 112, 295, 0, + 314, 112, 295, 0, 303, 323, 295, 323, 315, 112, + 295, 112, 295, 323, 295, 0, 295, 112, 295, 0, + 298, 0, 295, 0, 0, 0, 341, 342, 0, 322, + 0, 0, 338, 0, 0, 325, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 131, 0, 0, 0, 0, 67, + 0, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 67, 0, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 261, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 131, 0, 0, 0, 0, 0, - 0}; + 0, 0, 0, 0, 261, 0}; const int JavaScriptGrammar::action_check [] = { - 76, 61, 60, 8, 48, 29, 60, 7, 29, 2, - 48, 29, 60, 33, 1, 61, 8, 76, 48, 36, - 29, 2, 29, 8, 8, 33, 29, 33, 8, 55, - 7, 60, 33, 7, 17, 5, 55, 36, 29, 7, - 1, 36, 7, 7, 7, 55, 36, 7, 61, 60, - 16, 55, 5, 31, 36, 2, 29, 33, 29, 5, - 85, 36, 7, 20, 36, 7, 60, 36, 17, 36, - 85, 33, 8, 8, 33, 29, 7, 2, 36, 29, - 36, 33, 8, 7, 7, 29, 29, 8, 29, 0, - 76, 1, 8, 48, 33, 74, 36, 29, 36, 36, - 29, 29, 36, 7, -1, 8, 8, 8, 8, 60, - 8, 15, 60, 40, 7, 8, 8, 8, 8, 6, - 40, 40, 55, 7, 51, 42, 8, 7, 29, 8, - 8, 51, 51, 20, 7, 65, 53, 50, 8, 61, - 62, 54, 15, 61, 62, 61, 61, 62, 29, 33, - 8, 8, 40, 56, 7, 36, 61, 62, 60, 29, - 60, 8, 60, 51, 56, 56, 61, 62, 29, 15, - 60, -1, 61, 62, 56, 50, 61, 62, 29, 54, - 33, 60, 60, 25, 25, 27, 27, 12, 34, 12, - 36, 25, 25, 27, 27, -1, 38, 38, 8, -1, - 61, 62, 60, 60, 38, 38, -1, -1, 10, 56, - 61, 62, 25, 25, 27, 27, 25, 25, 27, 27, - 15, 8, 25, 29, 27, 38, 38, 15, 29, 38, - 38, 25, 57, 27, 57, 38, 8, -1, 63, 34, - 63, 36, -1, -1, 38, 25, 34, 27, 36, -1, - -1, 61, 62, 55, -1, 61, 62, 25, 38, 27, - 61, 62, -1, 25, -1, 27, 18, 19, 18, 19, - 38, 18, 19, 22, 61, 62, 38, 18, 19, -1, - 29, -1, -1, -1, 22, -1, 12, -1, -1, 61, - 62, 29, -1, 45, 46, 45, 46, -1, 45, 46, - 23, 24, -1, -1, 45, 46, 22, -1, 31, 32, - 23, 24, 35, 29, 37, -1, -1, -1, 31, 32, - 22, -1, 35, 72, 37, -1, -1, 29, -1, -1, - -1, 57, 81, -1, 72, 84, -1, 63, -1, 55, - 23, 24, -1, 81, -1, -1, 84, -1, 31, 32, - 3, -1, 35, 55, 37, -1, 72, -1, -1, -1, - 13, -1, 23, 24, 17, 81, -1, -1, 84, -1, - 72, 32, -1, 26, 35, 28, 37, -1, -1, 81, - -1, -1, 84, 3, -1, -1, 39, -1, 41, 42, - -1, -1, -1, 13, -1, -1, 49, 17, -1, 52, - 53, -1, -1, -1, -1, 58, 26, -1, 28, -1, - -1, 64, -1, -1, -1, -1, -1, -1, -1, 39, - 3, 41, 42, -1, 77, -1, -1, 23, 24, 49, - 13, -1, 52, 53, 17, 31, 32, -1, 58, 35, - -1, 37, -1, 26, 64, 28, -1, -1, 31, -1, - -1, -1, -1, -1, -1, -1, 39, 77, 41, 42, - -1, -1, -1, -1, -1, -1, 49, -1, -1, 52, - 53, -1, -1, -1, -1, 58, -1, -1, -1, -1, - -1, 64, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 12, 13, 77, -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, + 60, 48, 31, 17, 48, 29, 60, 76, 7, 1, + 8, 61, 29, 29, 36, 48, 29, 76, 61, 8, + 8, 60, 33, 8, 33, 1, 5, 8, 29, 29, + 76, 33, 7, 29, 55, 29, 33, 7, 33, 7, + 7, 5, 33, 36, 5, 55, 36, 2, 60, 36, + 7, 7, 36, 36, 1, 60, 60, 29, 61, 7, + 29, 7, 36, 36, 7, 36, 20, 16, 8, 55, + 29, 29, 8, 55, 1, 55, 0, 85, 29, 8, + 33, 7, 48, 8, 17, 29, 7, 2, 65, 7, + 29, 33, 8, 7, 7, 36, 33, 29, 76, 29, + 60, 36, 36, 8, 8, 36, 29, 8, 60, 8, + 29, 74, 7, 7, 36, 6, 36, 36, 8, 8, + 85, 15, 7, 61, 62, 7, 8, 8, 29, 20, + 40, 7, 10, 61, 62, 8, 10, 8, 33, 15, + 29, 51, 50, 40, 61, 62, 54, 8, 33, 61, + 62, 29, 56, 8, 51, 60, 8, 8, 61, 62, + 40, 60, 8, 50, 8, 42, 56, 54, 61, 62, + 8, 51, 40, 2, 8, 29, 53, 61, 62, 29, + 61, 55, 25, 51, 27, 8, 12, 60, 25, 60, + 27, -1, -1, 29, -1, 38, -1, -1, -1, 60, + 25, 38, 27, 12, 56, 60, -1, 61, 62, 60, + 56, 61, 62, 38, -1, -1, 60, 25, 56, 27, + 25, 25, 27, 27, 15, 61, 62, 61, 62, 8, + 38, 57, -1, 38, 38, 29, 12, 63, 61, 62, + 25, -1, 27, 34, 25, 36, 27, 25, 57, 27, + 25, 15, 27, 38, 63, -1, 25, 38, 27, 15, + 38, -1, 25, 38, 27, 18, 19, 61, 62, 38, + 34, -1, 36, 18, 19, 38, 18, 19, 34, 22, + 36, 57, 61, 62, 18, 19, 29, 63, -1, 22, + -1, -1, 45, 46, -1, -1, 29, -1, -1, -1, + 45, 46, -1, 45, 46, 23, 24, -1, -1, 23, + 24, 45, 46, 22, 32, -1, -1, 35, 32, 37, + 29, 35, -1, 37, 22, -1, -1, -1, -1, 72, + -1, 29, 25, -1, 27, 23, 24, -1, 81, 72, + -1, 84, -1, 31, 32, 38, 55, 35, 81, 37, + -1, 84, 23, 24, -1, -1, -1, 55, -1, -1, + 31, 32, -1, 72, 35, -1, 37, -1, 23, 24, + -1, -1, 81, -1, 72, 84, 31, 32, -1, -1, + 35, -1, 37, 81, -1, -1, 84, -1, -1, 23, + 24, -1, -1, -1, -1, 23, 24, 31, 32, -1, + -1, 35, -1, 37, 32, -1, -1, 35, -1, 37, + 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, + 23, 24, -1, 65, -1, 67, -1, -1, 31, 32, + -1, 65, 35, 67, 37, -1, 78, 79, 80, -1, + -1, 3, -1, -1, 78, 79, 80, -1, -1, -1, + -1, 13, -1, -1, -1, 17, -1, -1, -1, -1, + -1, -1, -1, -1, 26, -1, 28, -1, -1, 31, + -1, -1, -1, -1, -1, -1, -1, 39, -1, 41, + 42, -1, -1, -1, -1, 3, -1, 49, -1, -1, + 52, 53, -1, -1, -1, 13, 58, -1, -1, 17, + -1, -1, 64, -1, -1, -1, -1, -1, 26, -1, + 28, -1, -1, -1, -1, 77, -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, -1, -1, -1, -1, 64, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 77, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 65, -1, 67, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 78, 79, - 80, -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, -1, 67, -1, 69, -1, 71, -1, - 73, -1, -1, -1, -1, 78, 79, 80, -1, -1, - -1, -1, -1, -1, -1, 11, 12, 13, -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, -1, 67, -1, 69, -1, + 71, -1, 73, -1, -1, -1, -1, 78, 79, 80, + -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, -1, 67, -1, 69, -1, 71, 72, 73, + -1, -1, -1, -1, 78, 79, 80, -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, 56, + -1, -1, -1, -1, -1, -1, -1, -1, 65, -1, + 67, -1, 69, -1, 71, -1, 73, -1, -1, -1, + -1, 78, 79, 80, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, - -1, 67, -1, 69, -1, 71, 72, 73, -1, -1, + -1, 67, -1, 69, -1, 71, -1, 73, -1, -1, -1, -1, 78, 79, 80, -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, @@ -572,48 +600,49 @@ const int JavaScriptGrammar::action_check [] = { -1, -1, 51, -1, 53, -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, -1, 65, -1, 67, -1, 69, -1, 71, -1, 73, -1, -1, -1, -1, 78, - 79, 80, -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, 56, -1, -1, -1, -1, -1, - -1, -1, -1, 65, -1, 67, -1, 69, -1, 71, - -1, 73, -1, -1, -1, -1, 78, 79, 80, -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, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 65, -1, 67, -1, 69, -1, - 71, -1, 73, -1, -1, -1, -1, 78, 79, 80, - -1, -1, -1, -1, -1, -1, -1, 4, 5, 6, + 79, 80, -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, -1, 70, 71, 72, 73, 74, + 75, -1, -1, 78, 79, 80, 81, 82, 83, -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, 68, -1, 70, + 71, 72, 73, 74, 75, -1, -1, 78, 79, 80, + 81, 82, 83, -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, + 47, -1, -1, -1, -1, -1, -1, -1, 55, -1, + -1, -1, 59, -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, 71, 72, 73, 74, 75, -1, -1, 78, 79, 80, 81, 82, 83, -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, 68, -1, 70, 71, 72, + -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, -1, -1, 78, 79, 80, 81, 82, - 83, -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, 68, - -1, 70, 71, 72, 73, 74, 75, -1, -1, 78, - 79, 80, 81, 82, 83, -1, -1, -1, -1, 4, + -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, -1, -1, 78, + 79, 80, 81, 82, -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, @@ -630,67 +659,51 @@ const int JavaScriptGrammar::action_check [] = { 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, -1, -1, 78, 79, 80, - 81, 82, -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, + 81, 82, -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, + 47, -1, -1, -1, 51, -1, 53, -1, 55, -1, -1, -1, 59, -1, 61, -1, -1, -1, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, -1, - -1, 78, 79, 80, 81, 82, -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, -1, -1, 78, 79, 80, 81, 82, - -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, 55, -1, -1, -1, - 59, -1, 61, -1, -1, -1, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, -1, -1, 78, - 79, 80, 81, 82, 83, -1, -1, -1, -1, + -1, 78, 79, 80, 81, 82, 83, -1, -1, -1, + -1, - 12, 20, 11, 20, 12, 16, 20, 20, 84, 58, - 87, 54, 58, 20, 89, 12, 11, 20, 12, 12, - 72, 72, 22, 58, 20, 9, 11, 14, 20, 11, - 78, 12, 12, 11, 11, 5, 11, 20, 76, 12, - 11, 20, 11, 90, 12, 11, 20, 23, 58, 12, - 11, -1, 12, 12, 12, 12, 12, 12, 10, 9, - 9, -1, 6, 11, 11, -1, 31, 31, -1, 31, - 14, 36, 36, 35, 8, 2, 10, 31, 31, -1, - 31, 35, 35, -1, -1, 36, 11, 14, 31, 31, - 31, 31, 31, 6, 11, 31, 13, 36, 31, 41, - 36, 14, 43, 36, 47, 45, 25, 31, 31, 28, - 31, 34, 36, 31, 12, 36, 12, 31, 36, 33, - 31, 31, 33, 33, 31, 31, 33, 31, 34, 31, - 31, 33, 36, -1, 31, 36, 33, 31, 12, 33, - 12, 23, 24, 31, 31, 33, 33, 31, 31, 33, - 31, 20, 25, 20, 37, 28, 37, 55, 27, 55, - 27, 31, -1, 31, -1, 31, 36, 31, 31, 37, - 33, 37, 31, 7, 33, 39, 10, 31, 31, 33, - 33, 55, 31, 55, 33, 31, 31, 31, 31, 31, - 36, 36, 36, 36, 36, 11, -1, 13, 31, 31, - 42, 46, 48, 36, 36, -1, 31, -1, 31, 53, - 53, 36, 44, 36, 31, 38, -1, 31, 31, 36, - 53, 38, 36, 36, 31, 38, 40, 31, 53, 36, - -1, -1, 36, -1, 38, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 53, -1, -1, -1, + 72, 84, 76, 20, 12, 12, 87, 5, 72, 10, + 12, 11, 9, 9, 20, 54, 58, 12, 11, 89, + 12, 11, 16, 14, 11, 58, 11, 78, 11, 90, + 12, 20, 20, 11, 11, 11, 20, 12, 12, 11, + 11, 11, 23, 12, 12, 58, 58, 20, -1, 12, + 12, -1, 11, 20, 20, 20, 12, 12, 22, 20, + 20, 12, 12, 12, 11, 8, 7, 10, 20, 10, + 23, 24, -1, 31, 31, 27, 6, 31, 36, 36, + -1, -1, 36, 31, 14, 31, 31, 31, 36, 33, + 36, 31, 37, 33, 31, 31, 31, 31, 33, 31, + 31, 37, 39, 37, 35, 37, 31, 31, 20, 33, + 31, 31, 31, 9, 33, 27, 25, 31, 43, 28, + 41, 31, 36, 33, 31, 45, 31, 31, 31, 36, + 35, 31, 35, 33, 31, 12, 33, 31, 31, 12, + 33, 25, 36, 47, 28, 31, 12, 33, 31, 12, + 33, 31, 31, 33, -1, 31, 31, 36, 33, 31, + 36, 31, 34, 33, 31, 2, 33, 31, 11, 31, + 13, 6, 36, -1, 36, 31, 31, 14, 55, 14, + 36, 36, 55, 31, 11, -1, 13, -1, 36, 55, + 31, -1, 55, -1, -1, 36, 44, 53, 53, 31, + -1, 42, 31, 31, 36, 34, 38, 31, 36, -1, + 38, 31, 36, -1, 38, 31, 36, 31, 38, 31, + 36, 31, 36, 31, 36, -1, 36, 31, 36, -1, + 40, -1, 36, -1, -1, -1, 48, 53, -1, 53, + -1, -1, 46, -1, -1, 53, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 91, -1, -1, -1, -1, 11, + -1, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 11, -1, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 96, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 91, -1, -1, -1, -1, -1, - -1}; + -1, -1, -1, -1, 96, -1}; diff --git a/src/declarative/qml/parser/javascriptgrammar_p.h b/src/declarative/qml/parser/javascriptgrammar_p.h index 490acb2..22d3d76 100644 --- a/src/declarative/qml/parser/javascriptgrammar_p.h +++ b/src/declarative/qml/parser/javascriptgrammar_p.h @@ -148,14 +148,14 @@ public: T_XOR_EQ = 77, ACCEPT_STATE = 7, - RULE_COUNT = 296, - STATE_COUNT = 520, + RULE_COUNT = 298, + STATE_COUNT = 525, TERMINAL_COUNT = 88, NON_TERMINAL_COUNT = 98, - GOTO_INDEX_OFFSET = 520, - GOTO_INFO_OFFSET = 1629, - GOTO_CHECK_OFFSET = 1629 + GOTO_INDEX_OFFSET = 525, + GOTO_INFO_OFFSET = 1671, + GOTO_CHECK_OFFSET = 1671 }; static const char *const spell []; diff --git a/src/declarative/qml/parser/javascriptlexer.cpp b/src/declarative/qml/parser/javascriptlexer.cpp index 80a558d..81f0983 100644 --- a/src/declarative/qml/parser/javascriptlexer.cpp +++ b/src/declarative/qml/parser/javascriptlexer.cpp @@ -311,7 +311,7 @@ int JavaScript::Lexer::findReservedWord(const QChar *c, int size) const 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 JavaScriptGrammar::T_RESERVED_WORD; + return JavaScriptGrammar::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')) diff --git a/src/declarative/qml/parser/javascriptparser.cpp b/src/declarative/qml/parser/javascriptparser.cpp index 6221386..81a7e7b 100644 --- a/src/declarative/qml/parser/javascriptparser.cpp +++ b/src/declarative/qml/parser/javascriptparser.cpp @@ -266,6 +266,15 @@ case 22: { } break; case 23: { + AST::UiPublicMember *node = makeAstNode (driver->nodePool(), sym(3).sval, sym(4).sval); + node->isDefaultMember = true; + node->publicToken = loc(1); + node->attributeTypeToken = loc(3); + node->identifierToken = loc(4); + sym(1).Node = node; +} break; + +case 24: { AST::UiPublicMember *node = makeAstNode (driver->nodePool(), sym(2).sval, sym(3).sval, sym(5).Expression); node->publicToken = loc(1); @@ -275,69 +284,80 @@ case 23: { sym(1).Node = node; } break; -case 24: { +case 25: { + AST::UiPublicMember *node = makeAstNode (driver->nodePool(), sym(3).sval, sym(4).sval, + sym(6).Expression); + node->isDefaultMember = true; + node->publicToken = loc(1); + node->attributeTypeToken = loc(3); + node->identifierToken = loc(4); + node->colonToken = loc(5); + sym(1).Node = node; +} break; + +case 26: { sym(1).Node = makeAstNode(driver->nodePool(), sym(1).Node); } break; -case 25: { +case 27: { sym(1).Node = makeAstNode(driver->nodePool(), sym(1).Node); } break; -case 26: { +case 28: { AST::UiQualifiedId *node = makeAstNode (driver->nodePool(), sym(1).sval); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 27: { +case 29: { AST::UiQualifiedId *node = makeAstNode (driver->nodePool(), sym(1).UiQualifiedId, sym(3).sval); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 28: { +case 30: { AST::ThisExpression *node = makeAstNode (driver->nodePool()); node->thisToken = loc(1); sym(1).Node = node; } break; -case 29: { +case 31: { AST::IdentifierExpression *node = makeAstNode (driver->nodePool(), sym(1).sval); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 30: { +case 32: { AST::NullExpression *node = makeAstNode (driver->nodePool()); node->nullToken = loc(1); sym(1).Node = node; } break; -case 31: { +case 33: { AST::TrueLiteral *node = makeAstNode (driver->nodePool()); node->trueToken = loc(1); sym(1).Node = node; } break; -case 32: { +case 34: { AST::FalseLiteral *node = makeAstNode (driver->nodePool()); node->falseToken = loc(1); sym(1).Node = node; } break; -case 33: { +case 35: { AST::NumericLiteral *node = makeAstNode (driver->nodePool(), sym(1).dval); node->literalToken = loc(1); sym(1).Node = node; } break; -case 34: { +case 36: { AST::StringLiteral *node = makeAstNode (driver->nodePool(), sym(1).sval); node->literalToken = loc(1); sym(1).Node = node; } break; -case 35: { +case 37: { bool rx = lexer->scanRegExp(Lexer::NoPrefix); if (!rx) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, lexer->startLineNo(), @@ -349,7 +369,7 @@ case 35: { sym(1).Node = node; } break; -case 36: { +case 38: { bool rx = lexer->scanRegExp(Lexer::EqualPrefix); if (!rx) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, lexer->startLineNo(), @@ -361,21 +381,21 @@ case 36: { sym(1).Node = node; } break; -case 37: { +case 39: { AST::ArrayLiteral *node = makeAstNode (driver->nodePool(), sym(2).Elision); node->lbracketToken = loc(1); node->rbracketToken = loc(3); sym(1).Node = node; } break; -case 38: { +case 40: { AST::ArrayLiteral *node = makeAstNode (driver->nodePool(), sym(2).ElementList->finish ()); node->lbracketToken = loc(1); node->rbracketToken = loc(3); sym(1).Node = node; } break; -case 39: { +case 41: { AST::ArrayLiteral *node = makeAstNode (driver->nodePool(), sym(2).ElementList->finish (), sym(4).Elision); node->lbracketToken = loc(1); node->commaToken = loc(3); @@ -383,7 +403,7 @@ case 39: { sym(1).Node = node; } break; -case 40: { +case 42: { AST::ObjectLiteral *node = 0; if (sym(2).Node) node = makeAstNode (driver->nodePool(), @@ -395,7 +415,7 @@ case 40: { sym(1).Node = node; } break; -case 41: { +case 43: { AST::ObjectLiteral *node = makeAstNode (driver->nodePool(), sym(2).PropertyNameAndValueList->finish ()); node->lbraceToken = loc(1); @@ -403,51 +423,51 @@ case 41: { sym(1).Node = node; } break; -case 42: { +case 44: { AST::NestedExpression *node = makeAstNode(driver->nodePool(), sym(2).Expression); node->lparenToken = loc(1); node->rparenToken = loc(3); sym(1).Node = node; } break; -case 43: { +case 45: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).Elision, sym(2).Expression); } break; -case 44: { +case 46: { AST::ElementList *node = makeAstNode (driver->nodePool(), sym(1).ElementList, sym(3).Elision, sym(4).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 45: { +case 47: { AST::Elision *node = makeAstNode (driver->nodePool()); node->commaToken = loc(1); sym(1).Node = node; } break; -case 46: { +case 48: { AST::Elision *node = makeAstNode (driver->nodePool(), sym(1).Elision); node->commaToken = loc(2); sym(1).Node = node; } break; -case 47: { +case 49: { sym(1).Node = 0; } break; -case 48: { +case 50: { sym(1).Elision = sym(1).Elision->finish (); } break; -case 49: { +case 51: { AST::PropertyNameAndValueList *node = makeAstNode (driver->nodePool(), sym(1).PropertyName, sym(3).Expression); node->colonToken = loc(2); sym(1).Node = node; } break; -case 50: { +case 52: { AST::PropertyNameAndValueList *node = makeAstNode (driver->nodePool(), sym(1).PropertyNameAndValueList, sym(3).PropertyName, sym(5).Expression); node->commaToken = loc(2); @@ -455,34 +475,30 @@ case 50: { sym(1).Node = node; } break; -case 51: { +case 53: { AST::IdentifierPropertyName *node = makeAstNode (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 52: { +case 54: { AST::StringLiteralPropertyName *node = makeAstNode (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 53: { +case 55: { AST::NumericLiteralPropertyName *node = makeAstNode (driver->nodePool(), sym(1).dval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 54: { +case 56: { AST::IdentifierPropertyName *node = makeAstNode (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 55: - -case 56: - case 57: case 58: @@ -540,25 +556,29 @@ case 83: case 84: case 85: + +case 86: + +case 87: { sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount()); } break; -case 90: { +case 92: { AST::ArrayMemberExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->lbracketToken = loc(2); node->rbracketToken = loc(4); sym(1).Node = node; } break; -case 91: { +case 93: { AST::FieldMemberExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).sval); node->dotToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 92: { +case 94: { AST::NewMemberExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression, sym(4).ArgumentList); node->newToken = loc(1); node->lparenToken = loc(3); @@ -566,316 +586,309 @@ case 92: { sym(1).Node = node; } break; -case 94: { +case 96: { AST::NewExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->newToken = loc(1); sym(1).Node = node; } break; -case 95: { +case 97: { AST::CallExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; -case 96: { +case 98: { AST::CallExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; -case 97: { +case 99: { AST::ArrayMemberExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->lbracketToken = loc(2); node->rbracketToken = loc(4); sym(1).Node = node; } break; -case 98: { +case 100: { AST::FieldMemberExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).sval); node->dotToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 99: { +case 101: { sym(1).Node = 0; } break; -case 100: { +case 102: { sym(1).Node = sym(1).ArgumentList->finish(); } break; -case 101: { +case 103: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).Expression); } break; -case 102: { +case 104: { AST::ArgumentList *node = makeAstNode (driver->nodePool(), sym(1).ArgumentList, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 106: { +case 108: { AST::PostIncrementExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression); node->incrementToken = loc(2); sym(1).Node = node; } break; -case 107: { +case 109: { AST::PostDecrementExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression); node->decrementToken = loc(2); sym(1).Node = node; } break; -case 109: { +case 111: { AST::DeleteExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->deleteToken = loc(1); sym(1).Node = node; } break; -case 110: { +case 112: { AST::VoidExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->voidToken = loc(1); sym(1).Node = node; } break; -case 111: { +case 113: { AST::TypeOfExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->typeofToken = loc(1); sym(1).Node = node; } break; -case 112: { +case 114: { AST::PreIncrementExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->incrementToken = loc(1); sym(1).Node = node; } break; -case 113: { +case 115: { AST::PreDecrementExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->decrementToken = loc(1); sym(1).Node = node; } break; -case 114: { +case 116: { AST::UnaryPlusExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->plusToken = loc(1); sym(1).Node = node; } break; -case 115: { +case 117: { AST::UnaryMinusExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->minusToken = loc(1); sym(1).Node = node; } break; -case 116: { +case 118: { AST::TildeExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->tildeToken = loc(1); sym(1).Node = node; } break; -case 117: { +case 119: { AST::NotExpression *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->notToken = loc(1); sym(1).Node = node; } break; -case 119: { +case 121: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Mul, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 120: { +case 122: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Div, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 121: { +case 123: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Mod, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 123: { +case 125: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Add, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 124: { +case 126: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Sub, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 126: { +case 128: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::LShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 127: { +case 129: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::RShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 128: { +case 130: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::URShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 130: { +case 132: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Lt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 131: { +case 133: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Gt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 132: { +case 134: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Le, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 133: { +case 135: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Ge, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 134: { +case 136: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 135: { +case 137: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::In, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 137: { +case 139: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Lt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 138: { +case 140: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Gt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 139: { +case 141: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Le, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 140: { +case 142: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Ge, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 141: { +case 143: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 143: { +case 145: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Equal, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 144: { +case 146: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 145: { +case 147: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 146: { +case 148: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::StrictNotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 148: { +case 150: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::Equal, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 149: { +case 151: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 150: { +case 152: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 151: { - AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, - QSOperator::StrictNotEqual, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; - case 153: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, - QSOperator::BitAnd, sym(3).Expression); + QSOperator::StrictNotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; @@ -889,7 +902,7 @@ case 155: { case 157: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, - QSOperator::BitXor, sym(3).Expression); + QSOperator::BitAnd, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; @@ -903,7 +916,7 @@ case 159: { case 161: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, - QSOperator::BitOr, sym(3).Expression); + QSOperator::BitXor, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; @@ -917,7 +930,7 @@ case 163: { case 165: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, - QSOperator::And, sym(3).Expression); + QSOperator::BitOr, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; @@ -931,7 +944,7 @@ case 167: { case 169: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, - QSOperator::Or, sym(3).Expression); + QSOperator::And, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; @@ -944,6 +957,13 @@ case 171: { } break; case 173: { + AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, + QSOperator::Or, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; +} break; + +case 175: { AST::ConditionalExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression, sym(5).Expression); node->questionToken = loc(2); @@ -951,7 +971,7 @@ case 173: { sym(1).Node = node; } break; -case 175: { +case 177: { AST::ConditionalExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression, sym(5).Expression); node->questionToken = loc(2); @@ -959,112 +979,112 @@ case 175: { sym(1).Node = node; } break; -case 177: { +case 179: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(2).ival, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 179: { +case 181: { AST::BinaryExpression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(2).ival, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 180: { +case 182: { sym(1).ival = QSOperator::Assign; } break; -case 181: { +case 183: { sym(1).ival = QSOperator::InplaceMul; } break; -case 182: { +case 184: { sym(1).ival = QSOperator::InplaceDiv; } break; -case 183: { +case 185: { sym(1).ival = QSOperator::InplaceMod; } break; -case 184: { +case 186: { sym(1).ival = QSOperator::InplaceAdd; } break; -case 185: { +case 187: { sym(1).ival = QSOperator::InplaceSub; } break; -case 186: { +case 188: { sym(1).ival = QSOperator::InplaceLeftShift; } break; -case 187: { +case 189: { sym(1).ival = QSOperator::InplaceRightShift; } break; -case 188: { +case 190: { sym(1).ival = QSOperator::InplaceURightShift; } break; -case 189: { +case 191: { sym(1).ival = QSOperator::InplaceAnd; } break; -case 190: { +case 192: { sym(1).ival = QSOperator::InplaceXor; } break; -case 191: { +case 193: { sym(1).ival = QSOperator::InplaceOr; } break; -case 193: { +case 195: { AST::Expression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 194: { +case 196: { sym(1).Node = 0; } break; -case 197: { +case 199: { AST::Expression *node = makeAstNode (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 198: { +case 200: { sym(1).Node = 0; } break; -case 215: { +case 217: { AST::Block *node = makeAstNode (driver->nodePool(), sym(2).StatementList); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; -case 216: { +case 218: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).Statement); } break; -case 217: { +case 219: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).StatementList, sym(2).Statement); } break; -case 218: { +case 220: { sym(1).Node = 0; } break; -case 219: { +case 221: { sym(1).Node = sym(1).StatementList->finish (); } break; -case 221: { +case 223: { AST::VariableStatement *node = makeAstNode (driver->nodePool(), sym(2).VariableDeclarationList->finish (/*readOnly=*/sym(1).ival == T_CONST)); node->declarationKindToken = loc(1); @@ -1072,76 +1092,76 @@ case 221: { sym(1).Node = node; } break; -case 222: { +case 224: { sym(1).ival = T_CONST; } break; -case 223: { +case 225: { sym(1).ival = T_VAR; } break; -case 224: { +case 226: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).VariableDeclaration); } break; -case 225: { +case 227: { AST::VariableDeclarationList *node = makeAstNode (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration); node->commaToken = loc(2); sym(1).Node = node; } break; -case 226: { +case 228: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).VariableDeclaration); } break; -case 227: { +case 229: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration); } break; -case 228: { +case 230: { AST::VariableDeclaration *node = makeAstNode (driver->nodePool(), sym(1).sval, sym(2).Expression); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 229: { +case 231: { AST::VariableDeclaration *node = makeAstNode (driver->nodePool(), sym(1).sval, sym(2).Expression); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 230: { +case 232: { // ### TODO: AST for initializer sym(1) = sym(2); } break; -case 231: { +case 233: { sym(1).Node = 0; } break; -case 233: { +case 235: { // ### TODO: AST for initializer sym(1) = sym(2); } break; -case 234: { +case 236: { sym(1).Node = 0; } break; -case 236: { +case 238: { AST::EmptyStatement *node = makeAstNode (driver->nodePool()); node->semicolonToken = loc(1); sym(1).Node = node; } break; -case 238: { +case 240: { AST::ExpressionStatement *node = makeAstNode (driver->nodePool(), sym(1).Expression); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 239: { +case 241: { AST::IfStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Statement, sym(7).Statement); node->ifToken = loc(1); node->lparenToken = loc(2); @@ -1150,7 +1170,7 @@ case 239: { sym(1).Node = node; } break; -case 240: { +case 242: { AST::IfStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Statement); node->ifToken = loc(1); node->lparenToken = loc(2); @@ -1158,7 +1178,7 @@ case 240: { sym(1).Node = node; } break; -case 242: { +case 244: { AST::DoWhileStatement *node = makeAstNode (driver->nodePool(), sym(2).Statement, sym(5).Expression); node->doToken = loc(1); node->whileToken = loc(3); @@ -1168,7 +1188,7 @@ case 242: { sym(1).Node = node; } break; -case 243: { +case 245: { AST::WhileStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Statement); node->whileToken = loc(1); node->lparenToken = loc(2); @@ -1176,7 +1196,7 @@ case 243: { sym(1).Node = node; } break; -case 244: { +case 246: { AST::ForStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Expression, sym(7).Expression, sym(9).Statement); node->forToken = loc(1); @@ -1187,7 +1207,7 @@ case 244: { sym(1).Node = node; } break; -case 245: { +case 247: { AST::LocalForStatement *node = makeAstNode (driver->nodePool(), sym(4).VariableDeclarationList->finish (/*readOnly=*/false), sym(6).Expression, sym(8).Expression, sym(10).Statement); @@ -1200,7 +1220,7 @@ case 245: { sym(1).Node = node; } break; -case 246: { +case 248: { AST:: ForEachStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Expression, sym(7).Statement); node->forToken = loc(1); @@ -1210,7 +1230,7 @@ case 246: { sym(1).Node = node; } break; -case 247: { +case 249: { AST::LocalForEachStatement *node = makeAstNode (driver->nodePool(), sym(4).VariableDeclaration, sym(6).Expression, sym(8).Statement); node->forToken = loc(1); @@ -1221,14 +1241,14 @@ case 247: { sym(1).Node = node; } break; -case 249: { +case 251: { AST::ContinueStatement *node = makeAstNode (driver->nodePool()); node->continueToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 251: { +case 253: { AST::ContinueStatement *node = makeAstNode (driver->nodePool(), sym(2).sval); node->continueToken = loc(1); node->identifierToken = loc(2); @@ -1236,14 +1256,14 @@ case 251: { sym(1).Node = node; } break; -case 253: { +case 255: { AST::BreakStatement *node = makeAstNode (driver->nodePool()); node->breakToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 255: { +case 257: { AST::BreakStatement *node = makeAstNode (driver->nodePool(), sym(2).sval); node->breakToken = loc(1); node->identifierToken = loc(2); @@ -1251,14 +1271,14 @@ case 255: { sym(1).Node = node; } break; -case 257: { +case 259: { AST::ReturnStatement *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->returnToken = loc(1); node->semicolonToken = loc(3); sym(1).Node = node; } break; -case 258: { +case 260: { AST::WithStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).Statement); node->withToken = loc(1); node->lparenToken = loc(2); @@ -1266,7 +1286,7 @@ case 258: { sym(1).Node = node; } break; -case 259: { +case 261: { AST::SwitchStatement *node = makeAstNode (driver->nodePool(), sym(3).Expression, sym(5).CaseBlock); node->switchToken = loc(1); node->lparenToken = loc(2); @@ -1274,83 +1294,83 @@ case 259: { sym(1).Node = node; } break; -case 260: { +case 262: { AST::CaseBlock *node = makeAstNode (driver->nodePool(), sym(2).CaseClauses); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; -case 261: { +case 263: { AST::CaseBlock *node = makeAstNode (driver->nodePool(), sym(2).CaseClauses, sym(3).DefaultClause, sym(4).CaseClauses); node->lbraceToken = loc(1); node->rbraceToken = loc(5); sym(1).Node = node; } break; -case 262: { +case 264: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).CaseClause); } break; -case 263: { +case 265: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).CaseClauses, sym(2).CaseClause); } break; -case 264: { +case 266: { sym(1).Node = 0; } break; -case 265: { +case 267: { sym(1).Node = sym(1).CaseClauses->finish (); } break; -case 266: { +case 268: { AST::CaseClause *node = makeAstNode (driver->nodePool(), sym(2).Expression, sym(4).StatementList); node->caseToken = loc(1); node->colonToken = loc(3); sym(1).Node = node; } break; -case 267: { +case 269: { AST::DefaultClause *node = makeAstNode (driver->nodePool(), sym(3).StatementList); node->defaultToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 268: { +case 270: { AST::LabelledStatement *node = makeAstNode (driver->nodePool(), sym(1).sval, sym(3).Statement); node->identifierToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 270: { +case 272: { AST::ThrowStatement *node = makeAstNode (driver->nodePool(), sym(2).Expression); node->throwToken = loc(1); node->semicolonToken = loc(3); sym(1).Node = node; } break; -case 271: { +case 273: { AST::TryStatement *node = makeAstNode (driver->nodePool(), sym(2).Statement, sym(3).Catch); node->tryToken = loc(1); sym(1).Node = node; } break; -case 272: { +case 274: { AST::TryStatement *node = makeAstNode (driver->nodePool(), sym(2).Statement, sym(3).Finally); node->tryToken = loc(1); sym(1).Node = node; } break; -case 273: { +case 275: { AST::TryStatement *node = makeAstNode (driver->nodePool(), sym(2).Statement, sym(3).Catch, sym(4).Finally); node->tryToken = loc(1); sym(1).Node = node; } break; -case 274: { +case 276: { AST::Catch *node = makeAstNode (driver->nodePool(), sym(3).sval, sym(5).Block); node->catchToken = loc(1); node->lparenToken = loc(2); @@ -1359,20 +1379,20 @@ case 274: { sym(1).Node = node; } break; -case 275: { +case 277: { AST::Finally *node = makeAstNode (driver->nodePool(), sym(2).Block); node->finallyToken = loc(1); sym(1).Node = node; } break; -case 277: { +case 279: { AST::DebuggerStatement *node = makeAstNode (driver->nodePool()); node->debuggerToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 278: { +case 280: { AST::FunctionDeclaration *node = makeAstNode (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody); node->functionToken = loc(1); node->identifierToken = loc(2); @@ -1383,7 +1403,7 @@ case 278: { sym(1).Node = node; } break; -case 279: { +case 281: { AST::FunctionExpression *node = makeAstNode (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody); node->functionToken = loc(1); if (sym(2).sval) @@ -1395,56 +1415,56 @@ case 279: { sym(1).Node = node; } break; -case 280: { +case 282: { AST::FormalParameterList *node = makeAstNode (driver->nodePool(), sym(1).sval); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 281: { +case 283: { AST::FormalParameterList *node = makeAstNode (driver->nodePool(), sym(1).FormalParameterList, sym(3).sval); node->commaToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 282: { +case 284: { sym(1).Node = 0; } break; -case 283: { +case 285: { sym(1).Node = sym(1).FormalParameterList->finish (); } break; -case 284: { +case 286: { sym(1).Node = 0; } break; -case 286: { +case 288: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).SourceElements->finish ()); } break; -case 287: { +case 289: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).SourceElement); } break; -case 288: { +case 290: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).SourceElements, sym(2).SourceElement); } break; -case 289: { +case 291: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).Statement); } break; -case 290: { +case 292: { sym(1).Node = makeAstNode (driver->nodePool(), sym(1).FunctionDeclaration); } break; -case 291: { +case 293: { sym(1).sval = 0; } break; -case 293: { +case 295: { sym(1).Node = 0; } break; diff --git a/src/declarative/qml/parser/javascriptparser_p.h b/src/declarative/qml/parser/javascriptparser_p.h index c08a14a..226ad8b 100644 --- a/src/declarative/qml/parser/javascriptparser_p.h +++ b/src/declarative/qml/parser/javascriptparser_p.h @@ -204,9 +204,9 @@ protected: }; -#define J_SCRIPT_REGEXPLITERAL_RULE1 35 +#define J_SCRIPT_REGEXPLITERAL_RULE1 37 -#define J_SCRIPT_REGEXPLITERAL_RULE2 36 +#define J_SCRIPT_REGEXPLITERAL_RULE2 38 QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index fae0f43..4cfe1e8 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -1351,7 +1351,7 @@ bool QmlCompiler::findDynamicProperties(QmlParser::Property *prop, definedProperties << propDef; } - obj->dynamicProperties = definedProperties; + obj->dynamicProperties << definedProperties; return true; } @@ -1407,7 +1407,7 @@ bool QmlCompiler::findDynamicSignals(QmlParser::Property *sigs, definedSignals << sigDef; } - obj->dynamicSignals = definedSignals; + obj->dynamicSignals << definedSignals; return true; } diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp index 317a3bf..adc30dd 100644 --- a/src/declarative/qml/qmlscriptparser.cpp +++ b/src/declarative/qml/qmlscriptparser.cpp @@ -326,6 +326,8 @@ bool ProcessAST::visit(AST::UiImport *node) return false; } +// UiObjectMember: T_PUBLIC T_DEFAULT UiMemberType T_IDENTIFIER T_COLON Expression +// UiObjectMember: T_PUBLIC T_DEFAULT UiMemberType T_IDENTIFIER // UiObjectMember: T_PUBLIC UiMemberType T_IDENTIFIER T_COLON Expression // UiObjectMember: T_PUBLIC UiMemberType T_IDENTIFIER // @@ -335,6 +337,9 @@ bool ProcessAST::visit(AST::UiPublicMember *node) const QString memberType = node->memberType->asString(); const QString name = node->name->asString(); + if (node->isDefaultMember) + qWarning() << "default-ness not implemented"; + if (memberType == QLatin1String("property")) { _stateStack.pushProperty(QLatin1String("properties"), node->publicToken.startLine); -- cgit v0.12 From d85c0c07b72476d801db3f1cb622cb32ab50dcc4 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 30 Apr 2009 13:01:04 +1000 Subject: Prototype custom parsers for non-xml qml language ListModel has been ported (under the name ListModel2) to demonstrate. ListModel2 behaves the same as ListModel, except that list "objects" must be called "ListElement" instead of a freeform name. --- .../mediabrowser/dummydata/PhonesModel.qml | 236 ++++++------- src/declarative/qml/qml.pri | 1 + src/declarative/qml/qmlcompiler.cpp | 128 ++++--- src/declarative/qml/qmlcompiler_p.h | 1 + src/declarative/qml/qmlcustomparser.cpp | 129 ++++++- src/declarative/qml/qmlcustomparser.h | 46 +++ src/declarative/qml/qmlcustomparser_p.h | 79 +++++ src/declarative/qml/qmlinstruction_p.h | 1 + src/declarative/qml/qmlmetatype.cpp | 17 +- src/declarative/qml/qmlmetatype.h | 32 +- src/declarative/qml/qmlvme.cpp | 5 + src/declarative/util/qmllistmodel.cpp | 387 ++++++++++----------- src/declarative/util/qmllistmodel.h | 34 +- 13 files changed, 658 insertions(+), 438 deletions(-) create mode 100644 src/declarative/qml/qmlcustomparser_p.h diff --git a/demos/declarative/mediabrowser/dummydata/PhonesModel.qml b/demos/declarative/mediabrowser/dummydata/PhonesModel.qml index d4f6269..eb68fdb 100644 --- a/demos/declarative/mediabrowser/dummydata/PhonesModel.qml +++ b/demos/declarative/mediabrowser/dummydata/PhonesModel.qml @@ -1,137 +1,99 @@ - - - Nokia N97 - http://www.forum.nokia.com/devices/pics/N97_main.jpg - - The Nokia N97 is a S60 5th Edition mobile computer with a large 3,5?, bright nHD (640 x 360 pixels and 16:9 aspect ratio) TFT color display with resistive touch screen and tactile feedback. The device provides excellent user experience for internet and entertainment by combining qwerty keyboard with touch UI and Home screen functionality. Use the N97 to connect to mobile broadband using WLAN or HSDPA (3.5G). Find directions and locations with the integrated A-GPS and included maps. Additional features include game titles with N-Gage, a 5 mega pixel camera with dual LED flash and automatic geotagging of images and videos. - - - - Resolution 360 x 640 - Color Depth 24 bit - Device Size 117.2 x 55.3 x 15.9 mm - Volume 88 cc - Weight 150 g - - ]]> - - http://www.forum.nokia.com/devices/N97 - 5 - - - Nokia 5800 XpressMusic - http://www.forum.nokia.com/devices/pics/5800_main.jpg - - The Nokia 5800 XpressMusic is a S60 5th Edition device with a resistive touch screen and tactile feedback. The device has a large 3,2?, bright nHD (640 x 360 pixels and 16:9 aspect ratio) color display. The device has variety of input methods: stylus, plectrum and finger touch support for text input and UI control (alphanumeric keypad, full and mini qwerty keyboard, handwriting recognition). Use the Nokia 5800 XpressMusic to connect to mobile broadband using WLAN or HSDPA (3.5G). Find directions and locations with the integrated A-GPS and included maps. Additional features include a 3.2 megapixel camera with dual LED flash, Bluetooth 2.0 +EDR, and USB 2.0 High-Speed. Supported WCDMA frequencies depend on the region where the device is available. - - - - Resolution 360 x 640 - Color Depth 24 bit - Device Size 111 x 51.7 x 15.5 mm - Volume 83 cc - Weight 109 g - - ]]> - - http://www.forum.nokia.com/devices/5800_XpressMusic - 5 - - - E75 - http://www.forum.nokia.com/devices/pics/E75_main.jpg - The Nokia E75 is a GSM/WCDMA dual-mode business smartphone supporting WCDMA/HSDPA, EGSM, and WLAN. The device features a side slider qwerty keyboard for optimal email experience. Enjoy videos, music, and graphics on the 2.4? QVGA display and orientation sensor. Find directions and locations with the integrated A-GPS and included maps. Take photos with a 3.2-megapixel autofocus camera. Additional features include USB charging with simultaneous data transfer, Bluetooth 2.0 +EDR, and USB 2.0 High-Speed. Supported WCDMA frequencies depend on the region where the device is available. - - - Resolution 240 x 320 - Color Depth 24 bit - Device Size 111.8 x 501 x 14.4 mm - Volume 69 cc - Weight 139 g - - ]]> - - http://www.forum.nokia.com/devices/E75 - 5 - - - Nokia N810 - http://www.forum.nokia.com/devices/pics/n810_main.jpg - - The Nokia N810 features include Voice-over-IP (VoIP) Internet and video calling, Instant Messaging, an integrated slide-out QWERTY keyboard and touch screen. The N810 lets you stay connected on the go with WLAN or Bluetooth 2.0 +EDR and a Bluetooth enabled mobile phone. The hi-resolution 4.13", 800 x 480 screen and the integrated web cam add to the internet experience. Use the Nokia N810 to play music and videos with the built-in stereo speakers or use the 3.5mm stereo plug with headphones. The Nokia N810 also has an integrated GPS receiver which allows you to pinpoint your position and find points-of-interests using pre-loaded maps. - - - - Resolution 800 x 480 - Color Depth 16 bit - Device Size 128 x 72 x 14 mm - Weight 225 g - - ]]> - - http://www.forum.nokia.com/devices/N810 - 5 - - - Nokia 6260 slide - http://www.forum.nokia.com/devices/pics/6260slide_main.jpg - - The Nokia 6260 slide is a Series 40 6th Edition phone, supporting quad-band GSM 850/900/1800/1900, triple-band WCDMA 900/1900/2100 and WLAN. Other key features include integrated A-GPS with included maps, a 5.0 megapixel camera with LED flash and Carl Zeiss optics, WebKit Open Source Browser, Flash Lite 3.0, Bluetooth 2.1 + EDR and MIDP Java 2.1 with additional Java APIs. Supported WCDMA frequencies depend on the region where the device is available. - - - - Resolution 320 x 480 - Color Depth 24 bit - Device Size 99.4 x 46.5 x 15.4 mm - Volume 64.5 cc - Weight 114 g - - ]]> - - http://www.forum.nokia.com/devices/6260_slide - 5 - - - Nokia 2330 classic - http://www.forum.nokia.com/devices/pics/2330_main.jpg - - The Nokia 2330 classic is a Dual-band GPRS phone for EGSM 900/1800 or GSM 850/1900 (for some markets) that includes a VGA camera, Stereo FM radio with recording feature, Bluetooth 2.0, Mail on Ovi and MIDP 2.1 APIs for application creation. - - - - Resolution 128 x 160 - Color Depth 16 bit - Device Size 107 x 46 x 13.8 mm - Weight 80 g - - ]]> - - http://www.forum.nokia.com/devices/2330_classic - 5 - - - Nokia 2355 - http://www.forum.nokia.com/devices/pics/2355_main.jpg - - The Nokia 2355 CDMA phone features a 64K color display, FM radio, integrated flashlight, WAP 2.0 browsing, MMS, Java(tm) and Brew. It's stylishly polished fold design will keep you in the spotlight. - - - - Resolution 128 x 128 - Color Depth 16 bit - Device Size 81 x 43 x 22 mm - Weight 78 g - - ]]> - - http://www.forum.nokia.com/devices/2355 - 5 - - +ListModel2 { + id: "PhonesModel" + + ListElement { + title: "Nokia N97" + thumb: "http://www.forum.nokia.com/devices/pics/N97_main.jpg" + description: "The Nokia N97 is a S60 5th Edition mobile computer with a large 3,5?, bright nHD (640 x 360 pixels and 16:9 aspect ratio) TFT color display with resistive touch screen and tactile feedback. The device provides excellent user experience for internet and entertainment by combining qwerty keyboard with touch UI and Home screen functionality. Use the N97 to connect to mobile broadband using WLAN or HSDPA (3.5G). Find directions and locations with the integrated A-GPS and included maps. Additional features include game titles with N-Gage, a 5 mega pixel camera with dual LED flash and automatic geotagging of images and videos." + specifications: "\ +
Resolution 360 x 640 \ +
Color Depth 24 bit \ +
Device Size 117.2 x 55.3 x 15.9 mm \ +
Volume 88 cc \ +
Weight 150 g \ +
" + url: "http://www.forum.nokia.com/devices/N97" + rating: 5 + } + ListElement { + title: "Nokia 5800 XpressMusic" + thumb: "http://www.forum.nokia.com/devices/pics/5800_main.jpg" + description: "The Nokia 5800 XpressMusic is a S60 5th Edition device with a resistive touch screen and tactile feedback. The device has a large 3,2?, bright nHD (640 x 360 pixels and 16:9 aspect ratio) color display. The device has variety of input methods: stylus, plectrum and finger touch support for text input and UI control (alphanumeric keypad, full and mini qwerty keyboard, handwriting recognition). Use the Nokia 5800 XpressMusic to connect to mobile broadband using WLAN or HSDPA (3.5G). Find directions and locations with the integrated A-GPS and included maps. Additional features include a 3.2 megapixel camera with dual LED flash, Bluetooth 2.0 +EDR, and USB 2.0 High-Speed. Supported WCDMA frequencies depend on the region where the device is available." + specifications: " \ +
Resolution 360 x 640 \ +
Color Depth 24 bit \ +
Device Size 111 x 51.7 x 15.5 mm \ +
Volume 83 cc \ +
Weight 109 g \ +
" + url: "http://www.forum.nokia.com/devices/5800_XpressMusic" + rating: 5 + } + ListElement { + title: "E75" + thumb: "http://www.forum.nokia.com/devices/pics/E75_main.jpg" + description: "The Nokia E75 is a GSM/WCDMA dual-mode business smartphone supporting WCDMA/HSDPA, EGSM, and WLAN. The device features a side slider qwerty keyboard for optimal email experience. Enjoy videos, music, and graphics on the 2.4? QVGA display and orientation sensor. Find directions and locations with the integrated A-GPS and included maps. Take photos with a 3.2-megapixel autofocus camera. Additional features include USB charging with simultaneous data transfer, Bluetooth 2.0 +EDR, and USB 2.0 High-Speed. Supported WCDMA frequencies depend on the region where the device is available." + specifications: " \ +
Resolution 240 x 320 \ +
Color Depth 24 bit \ +
Device Size 111.8 x 501 x 14.4 mm \ +
Volume 69 cc \ +
Weight 139 g \ +
" + url: "http://www.forum.nokia.com/devices/E75" + rating: 5 + } + ListElement { + title: "Nokia N810" + thumb: "http://www.forum.nokia.com/devices/pics/n810_main.jpg" + description: "The Nokia N810 features include Voice-over-IP (VoIP) Internet and video calling, Instant Messaging, an integrated slide-out QWERTY keyboard and touch screen. The N810 lets you stay connected on the go with WLAN or Bluetooth 2.0 +EDR and a Bluetooth enabled mobile phone. The hi-resolution 4.13\", 800 x 480 screen and the integrated web cam add to the internet experience. Use the Nokia N810 to play music and videos with the built-in stereo speakers or use the 3.5mm stereo plug with headphones. The Nokia N810 also has an integrated GPS receiver which allows you to pinpoint your position and find points-of-interests using pre-loaded maps." + specifications: " \ +
Resolution 800 x 480 \ +
Color Depth 16 bit \ +
Device Size 128 x 72 x 14 mm \ +
Weight 225 g \ +
" + url: "http://www.forum.nokia.com/devices/N810" + rating: 5 + } + ListElement { + title: "Nokia 6260 slide" + thumb: "http://www.forum.nokia.com/devices/pics/6260slide_main.jpg" + description: "The Nokia 6260 slide is a Series 40 6th Edition phone, supporting quad-band GSM 850/900/1800/1900, triple-band WCDMA 900/1900/2100 and WLAN. Other key features include integrated A-GPS with included maps, a 5.0 megapixel camera with LED flash and Carl Zeiss optics, WebKit Open Source Browser, Flash Lite 3.0, Bluetooth 2.1 + EDR and MIDP Java 2.1 with additional Java APIs. Supported WCDMA frequencies depend on the region where the device is available." + specifications: "\ +
Resolution 320 x 480 \ +
Color Depth 24 bit \ +
Device Size 99.4 x 46.5 x 15.4 mm \ +
Volume 64.5 cc \ +
Weight 114 g \ +
" + url: "http://www.forum.nokia.com/devices/6260_slide" + rating: 5 + } + ListElement { + title: "Nokia 2330 classic" + thumb: "http://www.forum.nokia.com/devices/pics/2330_main.jpg" + description: "The Nokia 2330 classic is a Dual-band GPRS phone for EGSM 900/1800 or GSM 850/1900 (for some markets) that includes a VGA camera, Stereo FM radio with recording feature, Bluetooth 2.0, Mail on Ovi and MIDP 2.1 APIs for application creation." + specifications: "\ +
Resolution 128 x 160 \ +
Color Depth 16 bit \ +
Device Size 107 x 46 x 13.8 mm\ +
Weight 80 g\ +
" + url: "http://www.forum.nokia.com/devices/2330_classic" + rating: 5 + } + ListElement { + title: "Nokia 2355" + thumb: "http://www.forum.nokia.com/devices/pics/2355_main.jpg" + description: "The Nokia 2355 CDMA phone features a 64K color display, FM radio, integrated flashlight, WAP 2.0 browsing, MMS, Java(tm) and Brew. It's stylishly polished fold design will keep you in the spotlight." + specifications: " \ +
Resolution 128 x 128 \ +
Color Depth 16 bit \ +
Device Size 81 x 43 x 22 mm \ +
Weight 78 g \ +
" + url: "http://www.forum.nokia.com/devices/2355" + rating: 5 + } +} diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri index 00e3ccb..40b854f 100644 --- a/src/declarative/qml/qml.pri +++ b/src/declarative/qml/qml.pri @@ -33,6 +33,7 @@ HEADERS += qml/qmlparser_p.h \ qml/qmlcomponent.h \ qml/qmlcomponent_p.h \ qml/qmlcustomparser.h \ + qml/qmlcustomparser_p.h \ qml/qmlpropertyvaluesource.h \ qml/qmlboundsignal_p.h \ qml/qmlxmlparser_p.h \ diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 4cfe1e8..4433286 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -59,6 +59,7 @@ #include #include #include +#include "private/qmlcustomparser_p.h" #include "qmlscriptparser_p.h" @@ -552,6 +553,7 @@ bool QmlCompiler::compileObject(Object *obj, int ctxt) obj->properties.remove(SIGNALS_NAME); } + int createInstrIdx = output->bytecode.count(); if (obj->type != -1 && output->types.at(obj->type).parser) { QByteArray data = obj->custom; int ref = output->indexForByteArray(data); @@ -567,6 +569,7 @@ bool QmlCompiler::compileObject(Object *obj, int ctxt) QmlInstruction create; create.type = QmlInstruction::CreateObject; create.line = obj->line; + create.create.data = -1; create.create.type = obj->type; output->bytecode << create; } @@ -591,19 +594,48 @@ bool QmlCompiler::compileObject(Object *obj, int ctxt) } } + bool isCustomParser = output->types.at(obj->type).type && + output->types.at(obj->type).type->customParser() != 0; + QList customProps; + foreach(Property *prop, obj->properties) { if (!ignoreProperties && prop->name == PROPERTIES_NAME) { } else if (!ignoreSignals && prop->name == SIGNALS_NAME) { } else if (prop->name.length() >= 3 && prop->name.startsWith("on") && ('A' <= prop->name.at(2) && 'Z' >= prop->name.at(2))) { - COMPILE_CHECK(compileSignal(prop, obj)); + if (!isCustomParser) { + COMPILE_CHECK(compileSignal(prop, obj)); + } else { + customProps << QmlCustomParserNodePrivate::fromProperty(prop); + } } else { - COMPILE_CHECK(compileProperty(prop, obj, ctxt)); + if (!isCustomParser || (isCustomParser && testProperty(prop, obj))) { + COMPILE_CHECK(compileProperty(prop, obj, ctxt)); + } else { + customProps << QmlCustomParserNodePrivate::fromProperty(prop); + } } } - if (obj->defaultProperty) - COMPILE_CHECK(compileProperty(obj->defaultProperty, obj, ctxt)); + if (obj->defaultProperty) { + if(!isCustomParser || (isCustomParser && testProperty(obj->defaultProperty, obj))) { + COMPILE_CHECK(compileProperty(obj->defaultProperty, obj, ctxt)); + } else { + customProps << QmlCustomParserNodePrivate::fromProperty(obj->defaultProperty); + } + } + + if (isCustomParser && !customProps.isEmpty()) { + // ### Check for failure + bool ok = false; + QmlCustomParser *cp = output->types.at(obj->type).type->customParser(); + QByteArray customData = cp->compile(customProps, &ok); + if(!ok) + COMPILE_EXCEPTION("Failure compiling custom type"); + if(!customData.isEmpty()) + output->bytecode[createInstrIdx].create.data = + output->indexForByteArray(customData); + } if (obj->type != -1) { if (output->types.at(obj->type).component) { @@ -764,65 +796,61 @@ bool QmlCompiler::compileSignal(Property *prop, Object *obj) return true; } +// Returns true if prop exists on obj, false otherwise +bool QmlCompiler::testProperty(QmlParser::Property *prop, + QmlParser::Object *obj) +{ + if(isAttachedProperty(prop->name) || prop->name == "id") + return true; + + const QMetaObject *mo = obj->metaObject(); + if (mo) { + if (prop->isDefault) { + QMetaProperty p = QmlMetaType::defaultProperty(mo); + return p.name() != 0; + } else { + int idx = mo->indexOfProperty(prop->name.constData()); + return idx != -1; + } + } + + return false; +} + bool QmlCompiler::compileProperty(Property *prop, Object *obj, int ctxt) { if (prop->values.isEmpty() && !prop->value) return true; // First we're going to need a reference to this property - if (obj->type != -1) { + const QMetaObject *mo = obj->metaObject(); + if (mo && !isAttachedProperty(prop->name)) { + if (prop->isDefault) { + QMetaProperty p = QmlMetaType::defaultProperty(mo); + // XXX + // Currently we don't handle enums in the static analysis + // so we let them drop through to generateStoreInstruction() + if (p.name() && !p.isEnumType()) { + prop->index = mo->indexOfProperty(p.name()); + prop->name = p.name(); - const QMetaObject *mo = obj->metaObject(); - if (mo) { - if (prop->isDefault) { - QMetaProperty p = QmlMetaType::defaultProperty(mo); - // XXX - // Currently we don't handle enums in the static analysis - // so we let them drop through to generateStoreInstruction() - if (p.name() && !p.isEnumType()) { - prop->index = mo->indexOfProperty(p.name()); - prop->name = p.name(); - - int t = p.type(); - if (t == QVariant::UserType) - t = p.userType(); - - prop->type = t; - } - } else { - prop->index = mo->indexOfProperty(prop->name.constData()); - QMetaProperty p = mo->property(prop->index); - // XXX - // Currently we don't handle enums in the static analysis - // so we let them drop through to generateStoreInstruction() - if (p.name() && !p.isEnumType()) { - int t = p.type(); - if (t == QVariant::UserType) - t = p.userType(); - - prop->type = t; - } - } - } - } else { - const QMetaObject *mo = obj->metaObject(); - if (mo) { - if (prop->isDefault) { - QMetaProperty p = QmlMetaType::defaultProperty(mo); - if (p.name()) { - prop->index = mo->indexOfProperty(p.name()); - prop->name = p.name(); - } int t = p.type(); if (t == QVariant::UserType) t = p.userType(); + prop->type = t; - } else { - prop->index = mo->indexOfProperty(prop->name.constData()); - QMetaProperty p = mo->property(prop->index); + } + } else { + prop->index = mo->indexOfProperty(prop->name.constData()); + QMetaProperty p = mo->property(prop->index); + // XXX + // Currently we don't handle enums in the static analysis + // so we let them drop through to generateStoreInstruction() + if (p.name() && !p.isEnumType()) { int t = p.type(); if (t == QVariant::UserType) t = p.userType(); + prop->type = t; } } @@ -841,7 +869,7 @@ bool QmlCompiler::compileProperty(Property *prop, Object *obj, int ctxt) COMPILE_CHECK(compileNestedProperty(prop, ctxt)); } else if (QmlMetaType::isQmlList(prop->type) || - QmlMetaType::isList(prop->type)) { + QmlMetaType::isList(prop->type)) { COMPILE_CHECK(compileListProperty(prop, obj, ctxt)); diff --git a/src/declarative/qml/qmlcompiler_p.h b/src/declarative/qml/qmlcompiler_p.h index 2a06f73..9a0ce1c 100644 --- a/src/declarative/qml/qmlcompiler_p.h +++ b/src/declarative/qml/qmlcompiler_p.h @@ -139,6 +139,7 @@ private: bool compileComponentFromRoot(QmlParser::Object *obj, int); bool compileFetchedObject(QmlParser::Object *obj, int); bool compileSignal(QmlParser::Property *prop, QmlParser::Object *obj); + bool testProperty(QmlParser::Property *prop, QmlParser::Object *obj); bool compileProperty(QmlParser::Property *prop, QmlParser::Object *obj, int); bool compileIdProperty(QmlParser::Property *prop, QmlParser::Object *obj); diff --git a/src/declarative/qml/qmlcustomparser.cpp b/src/declarative/qml/qmlcustomparser.cpp index a342ca8..fe0c3a8 100644 --- a/src/declarative/qml/qmlcustomparser.cpp +++ b/src/declarative/qml/qmlcustomparser.cpp @@ -40,10 +40,13 @@ ****************************************************************************/ #include "qmlcustomparser.h" - +#include "qmlcustomparser_p.h" +#include "qmlparser_p.h" QT_BEGIN_NAMESPACE +using namespace QmlParser; + /*! \class QmlCustomParser \brief The QmlCustomParser class allows you to add new arbitrary types to QML. @@ -92,5 +95,129 @@ QT_BEGIN_NAMESPACE the same-named type as this custom parser is defined for). */ +QmlCustomParserNode +QmlCustomParserNodePrivate::fromObject(QmlParser::Object *root) +{ + QmlCustomParserNode rootNode; + rootNode.d->name = root->typeName; + + for(QHash::Iterator iter = root->properties.begin(); + iter != root->properties.end(); + ++iter) { + + Property *p = *iter; + + rootNode.d->properties << fromProperty(p); + } + + return rootNode; +} + +QmlCustomParserProperty +QmlCustomParserNodePrivate::fromProperty(QmlParser::Property *p) +{ + QmlCustomParserProperty prop; + prop.d->name = p->name; + prop.d->isList = (p->values.count() > 1); + + for(int ii = 0; ii < p->values.count(); ++ii) { + Value *v = p->values.at(ii); + + // We skip fetched properties for now + if(v->object && v->object->type == -1) + continue; + + if(v->object) { + QmlCustomParserNode node = fromObject(v->object); + prop.d->values << QVariant::fromValue(node); + } else { + prop.d->values << QVariant::fromValue(v->primitive); + } + + } + + return prop; +} + +QmlCustomParserNode::QmlCustomParserNode() +: d(new QmlCustomParserNodePrivate) +{ +} + +QmlCustomParserNode::QmlCustomParserNode(const QmlCustomParserNode &other) +: d(new QmlCustomParserNodePrivate) +{ + *this = other; +} + +QmlCustomParserNode &QmlCustomParserNode::operator=(const QmlCustomParserNode &other) +{ + d->name = other.d->name; + d->properties = other.d->properties; + return *this; +} + +QmlCustomParserNode::~QmlCustomParserNode() +{ + delete d; d = 0; +} + +QByteArray QmlCustomParserNode::name() const +{ + return d->name; +} + +QList QmlCustomParserNode::properties() const +{ + return d->properties; +} + +QmlCustomParserProperty::QmlCustomParserProperty() +: d(new QmlCustomParserPropertyPrivate) +{ +} + +QmlCustomParserProperty::QmlCustomParserProperty(const QmlCustomParserProperty &other) +: d(new QmlCustomParserPropertyPrivate) +{ + *this = other; +} + +QmlCustomParserProperty &QmlCustomParserProperty::operator=(const QmlCustomParserProperty &other) +{ + d->name = other.d->name; + d->isList = other.d->isList; + d->values = other.d->values; + return *this; +} + +QmlCustomParserProperty::~QmlCustomParserProperty() +{ + delete d; d = 0; +} + +QByteArray QmlCustomParserProperty::name() const +{ + return d->name; +} + +bool QmlCustomParserProperty::isList() const +{ + return d->isList; +} + +QList QmlCustomParserProperty::assignedValues() const +{ + return d->values; +} + +QByteArray QmlCustomParser::compile(const QList &, bool *ok) +{ + return QByteArray(); +} + +void QmlCustomParser::setCustomData(QObject *, const QByteArray &) +{ +} QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlcustomparser.h b/src/declarative/qml/qmlcustomparser.h index 9de1be4..0e6a619 100644 --- a/src/declarative/qml/qmlcustomparser.h +++ b/src/declarative/qml/qmlcustomparser.h @@ -53,13 +53,55 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) +class QmlCustomParserPropertyPrivate; +class Q_DECLARATIVE_EXPORT QmlCustomParserProperty +{ +public: + QmlCustomParserProperty(); + QmlCustomParserProperty(const QmlCustomParserProperty &); + QmlCustomParserProperty &operator=(const QmlCustomParserProperty &); + ~QmlCustomParserProperty(); + + QByteArray name() const; + + bool isList() const; + QList assignedValues() const; + +private: + friend class QmlCustomParserNodePrivate; + friend class QmlCustomParserPropertyPrivate; + QmlCustomParserPropertyPrivate *d; +}; +Q_DECLARE_METATYPE(QmlCustomParserProperty); + +class QmlCustomParserNodePrivate; +class Q_DECLARATIVE_EXPORT QmlCustomParserNode +{ +public: + QmlCustomParserNode(); + QmlCustomParserNode(const QmlCustomParserNode &); + QmlCustomParserNode &operator=(const QmlCustomParserNode &); + ~QmlCustomParserNode(); + + QByteArray name() const; + + QList properties() const; + +private: + friend class QmlCustomParserNodePrivate; + QmlCustomParserNodePrivate *d; +}; +Q_DECLARE_METATYPE(QmlCustomParserNode); + class Q_DECLARATIVE_EXPORT QmlCustomParser { public: virtual ~QmlCustomParser() {} virtual QByteArray compile(QXmlStreamReader&, bool *ok)=0; + virtual QByteArray compile(const QList &, bool *ok); virtual QVariant create(const QByteArray &)=0; + virtual void setCustomData(QObject *, const QByteArray &); struct Register { Register(const char *name, QmlCustomParser *parser) { @@ -76,7 +118,11 @@ public: #define QML_DEFINE_CUSTOM_PARSER_NS(namespacestring, name, parserClass) \ template<> QmlCustomParser::Register QmlCustomParser::Define::instance(namespacestring "/" # name, new parserClass); +#define QML_DEFINE_CUSTOM_TYPE(TYPE, NAME, CUSTOMTYPE) \ + template<> QmlPrivate::InstanceType QmlPrivate::Define::instance(qmlRegisterCustomType(#NAME, #TYPE, new CUSTOMTYPE)); + QT_END_NAMESPACE QT_END_HEADER + #endif diff --git a/src/declarative/qml/qmlcustomparser_p.h b/src/declarative/qml/qmlcustomparser_p.h new file mode 100644 index 0000000..63d148c --- /dev/null +++ b/src/declarative/qml/qmlcustomparser_p.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLCUSTOMPARSER_P_H +#define QMLCUSTOMPARSER_P_H + +#include +#include "qmlcustomparser.h" + +QT_BEGIN_NAMESPACE + +namespace QmlParser +{ + class Object; + class Property; +}; + +class QmlCustomParserNodePrivate +{ +public: + QByteArray name; + QList properties; + + static QmlCustomParserNode fromObject(QmlParser::Object *); + static QmlCustomParserProperty fromProperty(QmlParser::Property *); +}; + +class QmlCustomParserPropertyPrivate +{ +public: + QmlCustomParserPropertyPrivate() + : isList(false) {} + + QByteArray name; + bool isList; + QList values; +}; + +QT_END_NAMESPACE + +#endif // QMLCUSTOMPARSER_P_H diff --git a/src/declarative/qml/qmlinstruction_p.h b/src/declarative/qml/qmlinstruction_p.h index 440b54a..922fc61 100644 --- a/src/declarative/qml/qmlinstruction_p.h +++ b/src/declarative/qml/qmlinstruction_p.h @@ -174,6 +174,7 @@ public: } init; struct { int type; + int data; } create; struct { int data; diff --git a/src/declarative/qml/qmlmetatype.cpp b/src/declarative/qml/qmlmetatype.cpp index 9b99917..fbfeca0 100644 --- a/src/declarative/qml/qmlmetatype.cpp +++ b/src/declarative/qml/qmlmetatype.cpp @@ -118,6 +118,7 @@ public: QmlPrivate::CreateFunc m_extFunc; const QMetaObject *m_extMetaObject; int m_index; + QmlCustomParser *m_customParser; mutable volatile bool m_isSetup:1; mutable QList m_metaObjects; mutable QByteArray m_hash; @@ -126,7 +127,8 @@ public: QmlTypePrivate::QmlTypePrivate() : m_isInterface(false), m_iid(0), m_typeId(0), m_listId(0), m_qmlListId(0), m_opFunc(0), m_baseMetaObject(0), m_attachedPropertiesFunc(0), - m_parserStatusCast(-1), m_extFunc(0), m_extMetaObject(0), m_index(-1), m_isSetup(false) + m_parserStatusCast(-1), m_extFunc(0), m_extMetaObject(0), m_index(-1), + m_customParser(0), m_isSetup(false) { } @@ -150,7 +152,8 @@ QmlType::QmlType(int type, int listType, int qmlListType, const QMetaObject *metaObject, QmlAttachedPropertiesFunc attachedPropertiesFunc, int parserStatusCast, QmlPrivate::CreateFunc extFunc, - const QMetaObject *extMetaObject, int index) + const QMetaObject *extMetaObject, int index, + QmlCustomParser *customParser) : d(new QmlTypePrivate) { d->m_name = qmlName; @@ -163,6 +166,7 @@ QmlType::QmlType(int type, int listType, int qmlListType, d->m_parserStatusCast = parserStatusCast; d->m_extFunc = extFunc; d->m_index = index; + d->m_customParser = customParser; if (extMetaObject) d->m_extMetaObject = extMetaObject; @@ -272,6 +276,11 @@ QObject *QmlType::create() const return rv; } +QmlCustomParser *QmlType::customParser() const +{ + return d->m_customParser; +} + bool QmlType::isInterface() const { return d->m_isInterface; @@ -396,7 +405,7 @@ int QmlMetaType::registerInterface(const QmlPrivate::MetaTypeIds &id, return index; } -int QmlMetaType::registerType(const QmlPrivate::MetaTypeIds &id, QmlPrivate::Func func, const char *cname, const QMetaObject *mo, QmlAttachedPropertiesFunc attach, int pStatus, int object, QmlPrivate::CreateFunc extFunc, const QMetaObject *extmo) +int QmlMetaType::registerType(const QmlPrivate::MetaTypeIds &id, QmlPrivate::Func func, const char *cname, const QMetaObject *mo, QmlAttachedPropertiesFunc attach, int pStatus, int object, QmlPrivate::CreateFunc extFunc, const QMetaObject *extmo, QmlCustomParser *parser) { Q_UNUSED(object); QWriteLocker lock(metaTypeDataLock()); @@ -414,7 +423,7 @@ int QmlMetaType::registerType(const QmlPrivate::MetaTypeIds &id, QmlPrivate::Fun QmlType *type = new QmlType(id.typeId, id.listId, id.qmlListId, func, cname, mo, attach, pStatus, extFunc, - extmo, index); + extmo, index, parser); data->types.append(type); data->idToType.insert(type->typeId(), type); diff --git a/src/declarative/qml/qmlmetatype.h b/src/declarative/qml/qmlmetatype.h index 83fb60b..99f8e93 100644 --- a/src/declarative/qml/qmlmetatype.h +++ b/src/declarative/qml/qmlmetatype.h @@ -59,7 +59,7 @@ class QmlCustomParser; class Q_DECLARATIVE_EXPORT QmlMetaType { public: - static int registerType(const QmlPrivate::MetaTypeIds &, QmlPrivate::Func, const char *, const QMetaObject *, QmlAttachedPropertiesFunc, int pStatus, int object, QmlPrivate::CreateFunc extFunc, const QMetaObject *extmo); + static int registerType(const QmlPrivate::MetaTypeIds &, QmlPrivate::Func, const char *, const QMetaObject *, QmlAttachedPropertiesFunc, int pStatus, int object, QmlPrivate::CreateFunc extFunc, const QMetaObject *extmo, QmlCustomParser *); static int registerInterface(const QmlPrivate::MetaTypeIds &, QmlPrivate::Func, const char *); static void registerCustomParser(const char *, QmlCustomParser *); @@ -121,6 +121,8 @@ public: QObject *create() const; + QmlCustomParser *customParser() const; + bool isInterface() const; int typeId() const; int qListTypeId() const; @@ -145,7 +147,7 @@ private: friend class QmlMetaType; friend class QmlTypePrivate; QmlType(int, int, int, QmlPrivate::Func, const char *, int); - QmlType(int, int, int, QmlPrivate::Func, const char *, const QMetaObject *, QmlAttachedPropertiesFunc, int, QmlPrivate::CreateFunc, const QMetaObject *, int); + QmlType(int, int, int, QmlPrivate::Func, const char *, const QMetaObject *, QmlAttachedPropertiesFunc, int, QmlPrivate::CreateFunc, const QMetaObject *, int, QmlCustomParser *); ~QmlType(); QmlTypePrivate *d; @@ -166,7 +168,7 @@ int qmlRegisterType(const char *typeName) QmlPrivate::attachedPropertiesFunc(), QmlPrivate::StaticCastSelector::cast(), QmlPrivate::StaticCastSelector::cast(), - 0, 0); + 0, 0, 0); } template @@ -184,7 +186,7 @@ int qmlRegisterType(const char *qmlName, const char *typeName) QmlPrivate::attachedPropertiesFunc(), QmlPrivate::StaticCastSelector::cast(), QmlPrivate::StaticCastSelector::cast(), - 0, 0); + 0, 0, 0); } template @@ -206,7 +208,7 @@ int qmlRegisterExtendedType(const char *typeName) &T::staticMetaObject, attached, QmlPrivate::StaticCastSelector::cast(), QmlPrivate::StaticCastSelector::cast(), - &QmlPrivate::CreateParent::create, &E::staticMetaObject); + &QmlPrivate::CreateParent::create, &E::staticMetaObject, 0); } template @@ -231,7 +233,7 @@ int qmlRegisterExtendedType(const char *qmlName, const char *typeName) QmlPrivate::StaticCastSelector::cast(), QmlPrivate::StaticCastSelector::cast(), &QmlPrivate::CreateParent::create, - &E::staticMetaObject); + &E::staticMetaObject, 0); } template @@ -249,6 +251,24 @@ int qmlRegisterInterface(const char *typeName) qobject_interface_iid()); } +template +int qmlRegisterCustomType(const char *qmlName, const char *typeName, QmlCustomParser *parser) +{ + QByteArray name(typeName); + QmlPrivate::MetaTypeIds ids = { + qRegisterMetaType(QByteArray(name + "*").constData()), + qRegisterMetaType(QByteArray("QList<" + name + "*>*").constData()), + qRegisterMetaType(QByteArray("QmlList<" + name + "*>*").constData()) + }; + + return QmlMetaType::registerType(ids, QmlPrivate::list_op, qmlName, + &T::staticMetaObject, + QmlPrivate::attachedPropertiesFunc(), + QmlPrivate::StaticCastSelector::cast(), + QmlPrivate::StaticCastSelector::cast(), + 0, 0, parser); +} + void qmlRegisterCustomParser(const char *qmlName, QmlCustomParser *); QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp index 253e9a7..7b3291e 100644 --- a/src/declarative/qml/qmlvme.cpp +++ b/src/declarative/qml/qmlvme.cpp @@ -257,6 +257,11 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in if (!o) VME_EXCEPTION("Unable to create object of type" << types.at(instr.create.type).className); + if (instr.create.data != -1) { + QmlCustomParser *customParser = + types.at(instr.create.type).type->customParser(); + customParser->setCustomData(o, datas.at(instr.create.data)); + } if (!stack.isEmpty()) { QObject *parent = stack.top(); o->setParent(parent); diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp index 54aea2c..968e17b 100644 --- a/src/declarative/util/qmllistmodel.cpp +++ b/src/declarative/util/qmllistmodel.cpp @@ -53,55 +53,23 @@ QT_BEGIN_NAMESPACE #define DATA_ROLE_ID 1 #define DATA_ROLE_NAME "data" -Q_DECLARE_METATYPE(QListModelInterface *); -class QmlListModelPrivate +struct ListInstruction { -public: - QmlListModelPrivate(QmlListModel *m) - : q(m), - type(QmlListModel::Invalid), - listModelInterface(0), - singleObject(0), - roleCacheValid(false) - { - } - - void clear() - { - type = QmlListModel::Invalid; - model = QVariant(); - if (listModelInterface) - listModelInterface->disconnect(q); - listModelInterface = 0; - singleObject = 0; - roleCacheValid = false; - roleCache.clear(); - } - - void updateRoleCache() - { - if (roleCacheValid) - return; - - roleCacheValid = true; - if (type == QmlListModel::SingleObject) - roleCache = QmlMetaProperty::properties(singleObject); - } - - QmlListModel *q; - - QmlListModel::ModelType type; - - QVariant model; - QListModelInterface *listModelInterface; - QObject *singleObject; + enum { Push, Pop, Value, Set } type; + int dataIdx; +}; - bool roleCacheValid; - QStringList roleCache; +struct ListModelData +{ + int dataOffset; + int instrCount; + ListInstruction *instructions() const { return (ListInstruction *)((char *)this + sizeof(ListModelData)); } }; +Q_DECLARE_METATYPE(QListModelInterface *); + /*! - \qmlclass ListModel QmlListModel + \qmlclass ListModel \brief The ListModel element defines a free-form list data source. The ListModel is a simple XML heirarchy of items containing data roles. @@ -140,157 +108,6 @@ public: \endcode */ -/*! - \internal - \class QmlListModel -*/ -QmlListModel::QmlListModel(QObject *parent) -: QListModelInterface(parent), d(new QmlListModelPrivate(this)) -{ -} - -QmlListModel::~QmlListModel() -{ - delete d; d = 0; -} - -QmlListModel::ModelType QmlListModel::modelType() const -{ - return d->type; -} - -bool QmlListModel::setModel(const QVariant &model) -{ - d->clear(); - - QListModelInterface *iface = qvariant_cast(model); - if (iface) { - QObject::connect(iface, SIGNAL(itemsInserted(int,int)), - this, SIGNAL(itemsInserted(int,int))); - QObject::connect(iface, SIGNAL(itemsRemoved(int,int)), - this, SIGNAL(itemsRemoved(int,int))); - QObject::connect(iface, SIGNAL(itemsMoved(int,int,int)), - this, SIGNAL(itemsMoved(int,int,int))); - QObject::connect(iface, SIGNAL(itemsChanged(int,int,QList)), - this, SIGNAL(itemsChanged(int,int,QList))); - d->listModelInterface = iface; - d->type = ListInterface; - d->model = model; - return true; - } - - QObject *object = qvariant_cast(model); - if (object) { - d->singleObject = object; - d->type = SingleObject; - d->model = model; - return true; - } - - if (QmlMetaType::isList(model)) { - d->type = SimpleList; - d->model = model; - return true; - } - - return false; -} - -QVariant QmlListModel::model() const -{ - return d->model; -} - -QList QmlListModel::roles() const -{ - d->updateRoleCache(); - switch(modelType()) { - case Invalid: - return QList(); - case SimpleList: - return QList() << DATA_ROLE_ID; - case ListInterface: - return d->listModelInterface->roles(); - case SingleObject: - { - QList rv; - for (int ii = 0; ii < d->roleCache.count(); ++ii) - rv << ii; - return rv; - } - break; - }; - return QList(); -} - -QString QmlListModel::toString(int role) const -{ - d->updateRoleCache(); - switch(modelType()) { - case Invalid: - return QString(); - case SimpleList: - if (role == DATA_ROLE_ID) - return QLatin1String(DATA_ROLE_NAME); - else - return QString(); - case ListInterface: - return d->listModelInterface->toString(role); - case SingleObject: - if (role >= d->roleCache.count()) - return QString(); - else - return d->roleCache.at(role); - }; - return QString(); -} - -/*! - \qmlproperty int ListModel::count - This property holds the number of items in the list. -*/ -int QmlListModel::count() const -{ - switch(modelType()) { - case Invalid: - return 0; - case SimpleList: - return QmlMetaType::listCount(model()); - case ListInterface: - return d->listModelInterface->count(); - case SingleObject: - return 1; - } - return 0; -} - -QHash QmlListModel::data(int index, const QList &roles) const -{ - d->updateRoleCache(); - QHash rv; - switch(modelType()) { - case Invalid: - break; - case SimpleList: - if (roles.contains(DATA_ROLE_ID)) - rv.insert(DATA_ROLE_ID, QmlMetaType::listAt(d->model, index)); - break; - case ListInterface: - return d->listModelInterface->data(index, roles); - case SingleObject: - { - for (int ii = 0; ii < roles.count(); ++ii) { - QmlMetaProperty prop(d->singleObject, toString(roles.at(ii))); - rv.insert(roles.at(ii), prop.read()); - } - } - break; - }; - - return rv; -} - - struct ModelNode; class ListModel : public QListModelInterface @@ -484,20 +301,181 @@ int ListModel::count() const return _root->values.count(); } -struct ListInstruction -{ - enum { Push, Pop, Value, Set } type; - int dataIdx; -}; - class ListModelParser : public QmlCustomParser { public: virtual QByteArray compile(QXmlStreamReader& reader, bool *); + QByteArray compile(const QList &, bool *ok); virtual QVariant create(const QByteArray &); + + bool compileProperty(const QmlCustomParserProperty &prop, QList &instr, QByteArray &data); + void setCustomData(QObject *, const QByteArray &); }; QML_DEFINE_CUSTOM_PARSER(ListModel, ListModelParser); +bool ListModelParser::compileProperty(const QmlCustomParserProperty &prop, QList &instr, QByteArray &data) +{ + QList values = prop.assignedValues(); + for(int ii = 0; ii < values.count(); ++ii) { + const QVariant &value = values.at(ii); + + if(value.userType() == qMetaTypeId()) { + QmlCustomParserNode node = + qvariant_cast(value); + + { + ListInstruction li; + li.type = ListInstruction::Push; + li.dataIdx = -1; + instr << li; + } + + QList props = node.properties(); + for(int jj = 0; jj < props.count(); ++jj) { + const QmlCustomParserProperty &nodeProp = props.at(jj); + if(nodeProp.name() == "") + return false; + + ListInstruction li; + int ref = data.count(); + data.append(nodeProp.name()); + data.append('\0'); + li.type = ListInstruction::Set; + li.dataIdx = ref; + instr << li; + + if(!compileProperty(nodeProp, instr, data)) + return false; + + li.type = ListInstruction::Pop; + li.dataIdx = -1; + instr << li; + } + + { + ListInstruction li; + li.type = ListInstruction::Pop; + li.dataIdx = -1; + instr << li; + } + + } else { + + int ref = data.count(); + QByteArray d = value.toString().toLatin1(); + d.append('\0'); + data.append(d); + + ListInstruction li; + li.type = ListInstruction::Value; + li.dataIdx = ref; + instr << li; + + } + } + + return true; +} + +QByteArray ListModelParser::compile(const QList &customProps, bool *ok) +{ + *ok = true; + QList instr; + QByteArray data; + + for(int ii = 0; ii < customProps.count(); ++ii) { + const QmlCustomParserProperty &prop = customProps.at(ii); + if(prop.name() != "") { // isn't default property + *ok = false; + return QByteArray(); + } + + if(!compileProperty(prop, instr, data)) { + *ok = false; + return QByteArray(); + } + } + + int size = sizeof(ListModelData) + + instr.count() * sizeof(ListInstruction) + + data.count(); + + QByteArray rv; + rv.resize(size); + + ListModelData *lmd = (ListModelData *)rv.data(); + lmd->dataOffset = sizeof(ListModelData) + + instr.count() * sizeof(ListInstruction); + lmd->instrCount = instr.count(); + for (int ii = 0; ii < instr.count(); ++ii) + lmd->instructions()[ii] = instr.at(ii); + ::memcpy(rv.data() + lmd->dataOffset, data.constData(), data.count()); + + return rv; +} + +void ListModelParser::setCustomData(QObject *obj, const QByteArray &d) +{ + ListModel *rv = static_cast(obj); + + ModelNode *root = new ModelNode; + rv->_root = root; + QStack nodes; + nodes << root; + + const ListModelData *lmd = (const ListModelData *)d.constData(); + const char *data = ((const char *)lmd) + lmd->dataOffset; + + for (int ii = 0; ii < lmd->instrCount; ++ii) { + const ListInstruction &instr = lmd->instructions()[ii]; + + switch(instr.type) { + case ListInstruction::Push: + { + ModelNode *n = nodes.top(); + ModelNode *n2 = new ModelNode; + n->values << qVariantFromValue(n2); + nodes.push(n2); + } + break; + + case ListInstruction::Pop: + nodes.pop(); + break; + + case ListInstruction::Value: + { + ModelNode *n = nodes.top(); + n->values.append(QByteArray(data + instr.dataIdx)); + } + break; + + case ListInstruction::Set: + { + ModelNode *n = nodes.top(); + ModelNode *n2 = new ModelNode; + n->properties.insert(QLatin1String(data + instr.dataIdx), n2); + nodes.push(n2); + } + break; + } + } +} + +class ListModel2 : public ListModel +{ +Q_OBJECT +}; +QML_DECLARE_TYPE(ListModel2); +QML_DEFINE_CUSTOM_TYPE(ListModel2, ListModel2, ListModelParser); + +class ListElement : public QObject +{ +Q_OBJECT +}; +QML_DECLARE_TYPE(ListElement); +QML_DEFINE_TYPE(ListElement,ListElement); + static void dump(ModelNode *node, int ind) { QByteArray indentBa(ind * 4, ' '); @@ -534,13 +512,6 @@ ModelNode::~ModelNode() if (modelCache) { delete modelCache; modelCache = 0; } } -struct ListModelData -{ - int dataOffset; - int instrCount; - ListInstruction *instructions() const { return (ListInstruction *)((char *)this + sizeof(ListModelData)); } -}; - QByteArray ListModelParser::compile(QXmlStreamReader& reader, bool *ok) { *ok = true; diff --git a/src/declarative/util/qmllistmodel.h b/src/declarative/util/qmllistmodel.h index 3dcac4f..36aa009 100644 --- a/src/declarative/util/qmllistmodel.h +++ b/src/declarative/util/qmllistmodel.h @@ -57,40 +57,10 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QmlListModelPrivate; -class Q_DECLARATIVE_EXPORT QmlListModel : public QListModelInterface -{ -Q_OBJECT -public: - QmlListModel(QObject *parent = 0); - virtual ~QmlListModel(); - - enum ModelType { - Invalid, - SimpleList, - ListInterface, - SingleObject - }; - - ModelType modelType() const; - bool setModel(const QVariant &); - QVariant model() const; - - virtual QList roles() const; - virtual QString toString(int role) const; - - Q_PROPERTY(int count READ count); - virtual int count() const; - virtual QHash - data(int index, const QList &roles = (QList())) const; -private: - QmlListModelPrivate *d; -}; -QML_DECLARE_TYPE(QmlListModel); - -#endif // QMLLISTMODEL_H QT_END_NAMESPACE QT_END_HEADER + +#endif // QMLLISTMODEL_H -- cgit v0.12 From 0a4b78de06b60a5fc0a9182687ded099968c4055 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 30 Apr 2009 13:19:10 +1000 Subject: Documentation for ListView Convert to new format, use \snippet. --- doc/src/declarative/pics/ListViewHorizontal.png | Bin 2519 -> 5802 bytes doc/src/declarative/pics/ListViewSections.png | Bin 0 -> 7596 bytes doc/src/declarative/pics/trivialListView.png | Bin 2387 -> 6160 bytes .../listview/dummydata/ContactModel.qml | 18 +++ .../snippets/declarative/listview/highlight.qml | 59 +++++++++ doc/src/snippets/declarative/listview/listview.qml | 55 ++++++++ .../declarative/listview/dummydata/MyPetsModel.qml | 47 ++++--- examples/declarative/listview/sections.qml | 69 ++++++++++ src/declarative/fx/qfxlistview.cpp | 143 +++++++-------------- src/declarative/util/qmlstateoperations.cpp | 1 + 10 files changed, 275 insertions(+), 117 deletions(-) create mode 100644 doc/src/declarative/pics/ListViewSections.png create mode 100644 doc/src/snippets/declarative/listview/dummydata/ContactModel.qml create mode 100644 doc/src/snippets/declarative/listview/highlight.qml create mode 100644 doc/src/snippets/declarative/listview/listview.qml create mode 100644 examples/declarative/listview/sections.qml diff --git a/doc/src/declarative/pics/ListViewHorizontal.png b/doc/src/declarative/pics/ListViewHorizontal.png index 63c7c86..4633a0e 100644 Binary files a/doc/src/declarative/pics/ListViewHorizontal.png and b/doc/src/declarative/pics/ListViewHorizontal.png differ diff --git a/doc/src/declarative/pics/ListViewSections.png b/doc/src/declarative/pics/ListViewSections.png new file mode 100644 index 0000000..9270126 Binary files /dev/null and b/doc/src/declarative/pics/ListViewSections.png differ diff --git a/doc/src/declarative/pics/trivialListView.png b/doc/src/declarative/pics/trivialListView.png index 175e455..3782570 100644 Binary files a/doc/src/declarative/pics/trivialListView.png and b/doc/src/declarative/pics/trivialListView.png differ diff --git a/doc/src/snippets/declarative/listview/dummydata/ContactModel.qml b/doc/src/snippets/declarative/listview/dummydata/ContactModel.qml new file mode 100644 index 0000000..302dfd2 --- /dev/null +++ b/doc/src/snippets/declarative/listview/dummydata/ContactModel.qml @@ -0,0 +1,18 @@ + + + + Bill Smith + 555 3264 + + + John Brown + 555 8426 + + + Sam Wise + 555 0473 + + diff --git a/doc/src/snippets/declarative/listview/highlight.qml b/doc/src/snippets/declarative/listview/highlight.qml new file mode 100644 index 0000000..d8bbb22 --- /dev/null +++ b/doc/src/snippets/declarative/listview/highlight.qml @@ -0,0 +1,59 @@ +Rect { + width: 180 + height: 200 + color: "white" + // ContactModel model is defined in dummydata/ContactModel.qml + // The viewer automatically loads files in dummydata/* to assist + // development without a real data source. + + // Define a delegate component. A component will be + // instantiated for each visible item in the list. +//! [0] + Component { + id: Delegate + Item { + id: Wrapper + width: 180 + height: 40 + VerticalLayout { + x: 5; y: 5 + Text { + text: 'Name: ' + name + } + Text { + text: 'Number: ' + number + } + } + } + } +//! [0] + // Specify a highlight with custom movement. Note that autoHighlight + // is set to false in the ListView so that we can control how the + // highlight moves to the current item. +//! [1] + Component { + id: Highlight + Rect { + width: 180 + height: 40 + color: "lightsteelblue" + radius: 5 + y: Follow { + source: List.current.y + spring: 3 + damping: 0.1 + } + } + } + ListView { + id: List + width: 180 + height: parent.height + model: ContactModel + delegate: Delegate + highlight: Highlight + autoHighlight: false + focus: true + } +//! [1] +} diff --git a/doc/src/snippets/declarative/listview/listview.qml b/doc/src/snippets/declarative/listview/listview.qml new file mode 100644 index 0000000..5b99bbd --- /dev/null +++ b/doc/src/snippets/declarative/listview/listview.qml @@ -0,0 +1,55 @@ +//! [3] +Rect { + width: 480 + height: 40 + color: "white" + // ContactModel model is defined in dummydata/ContactModel.qml + // The viewer automatically loads files in dummydata/* to assist + // development without a real data source. + + // Define a delegate component. A component will be + // instantiated for each visible item in the list. +//! [0] + Component { + id: Delegate + Item { + id: Wrapper + width: 180 + height: 40 + VerticalLayout { + x: 5; y: 5 + Text { + text: 'Name: ' + name + } + Text { + text: 'Number: ' + number + } + } + } + } +//! [0] + // Define a highlight component. Just one of these will be instantiated + // by each ListView and placed behind the current item. +//! [1] + Component { + id: Highlight + Rect { + color: "lightsteelblue" + radius: 5 + } + } +//! [1] + // The actual list +//! [2] + ListView { + width: 480 + height: parent.height + model: ContactModel + delegate: Delegate + highlight: Highlight + focus: true + orientation: 'Horizontal' + } +//! [2] +} +//! [3] diff --git a/examples/declarative/listview/dummydata/MyPetsModel.qml b/examples/declarative/listview/dummydata/MyPetsModel.qml index 5af7fbf..e1617a3 100644 --- a/examples/declarative/listview/dummydata/MyPetsModel.qml +++ b/examples/declarative/listview/dummydata/MyPetsModel.qml @@ -4,48 +4,57 @@ Be sure to name the file the same as the id. --> - Rover - Dog - 5 + Polly + Parrot + 12 + Small - Whiskers - Cat - 2 + Penny + Turtle + 4 + Small Warren Rabbit 2 - - - Polly - Parrot - 12 + Small Spot Dog 9 + Medium - Tiny - Elephant - 15 - - - Penny - Turtle - 4 + Whiskers + Cat + 2 + Medium Joey Kangaroo 1 + Medium Kimba Bunny 65 + Large + + + Rover + Dog + 5 + Large + + + Tiny + Elephant + 15 + Large diff --git a/examples/declarative/listview/sections.qml b/examples/declarative/listview/sections.qml new file mode 100644 index 0000000..60acd62 --- /dev/null +++ b/examples/declarative/listview/sections.qml @@ -0,0 +1,69 @@ +//! [0] +Rect { + width: 200 + height: 240 + color: "white" + // MyPets model is defined in dummydata/MyPetsModel.qml + // The viewer automatically loads files in dummydata/* to assist + // development without a real data source. + // This one contains my pets. + + // Define a delegate component that includes a separator for sections. + Component { + id: PetDelegate + Item { + id: Wrapper + width: 200 + // My height is the combined height of the description and the section separator + height: Separator.height + Desc.height + Rect { + id: Separator + color: "lightsteelblue" + width: parent.width + // Only show the section separator when we are the beginning of a new section + // Note that for this to work nicely, the list must be ordered by section. + height: Wrapper.ListView.prevSection != Wrapper.ListView.section ? 20 : 0 + opacity: Wrapper.ListView.prevSection != Wrapper.ListView.section ? 1 : 0 + Text { + text: Wrapper.ListView.section; font.bold: true + x: 2; height: parent.height; vAlign: 'AlignVCenter' + } + } + Item { + id: Desc + x: 5 + height: Layout.height + 4 + anchors.top: Separator.bottom + VerticalLayout { + id: Layout + y: 2 + Text { text: 'Name: ' + name } + Text { text: 'Type: ' + type } + Text { text: 'Age: ' + age } + } + } + } + } + // Define a highlight component. Just one of these will be instantiated + // by each ListView and placed behind the current item. + Component { + id: PetHighlight + Rect { + color: "#FFFF88" + } + } + // The list + ListView { + id: List + width: 200 + height: parent.height + model: MyPetsModel + delegate: PetDelegate + highlight: PetHighlight + // The sectionExpression is simply the size of the pet. + // We use this to determine which section we are in above. + sectionExpression: "size" + focus: true + } +} +//! [0] diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index 0724e3a..13e5b21 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -798,37 +798,23 @@ void QFxListViewPrivate::fixupX() \brief The ListView element provides a list view of items provided by a model. The model is typically provided by a QAbstractListModel "C++ model object", but can also be created directly in XML. - The items are laid out vertically or horizontally and may be flicked to scroll. The below example creates a very simple vertical list, using an XML model. \image trivialListView.png - \code - - - - John - Smith - - - Bill - Jones - - - Jane - Doe - - - - - - - - - - - \endcode + + The user interface defines a delegate to display an item, a highlight, + and the ListView which uses the above. + + \snippet doc/src/snippets/declarative/listview/listview.qml 3 + + The model is defined as a ListModel using XML: + \quotefromfile doc/src/snippets/declarative/listview/dummydata/ContactModel.qml + \skipto - - John - Smith - - - Bill - Jones - - - Jane - Doe - - - - - \endcode + Models can also be created directly in XML, using the \l ListModel element. */ QVariant QFxListView::model() const { @@ -922,17 +890,7 @@ void QFxListView::setModel(const QVariant &model) The delegate provides a template describing what each item in the view should look and act like. Here is an example delegate: - \code - - - - - - - ... - - \endcode + \snippet doc/src/snippets/declarative/listview/listview.qml 0 */ QmlComponent *QFxListView::delegate() const { @@ -1012,13 +970,9 @@ int QFxListView::count() const The below example demonstrates how to make a simple highlight for a vertical list. - \code - - - - - \endcode - \image ListViewHighlight.png + + \snippet doc/src/snippets/declarative/listview/listview.qml 1 + \image trivialListView.png \sa autoHighlight */ @@ -1043,17 +997,12 @@ void QFxListView::setHighlight(QmlComponent *highlight) If autoHighlight is true, the highlight will be moved smoothly to follow the current item. If autoHighlight is false, the highlight will not be moved by the view, and must be implemented - by the highlight, for example: - - \code - - - - - - - - \endcode + by the highlight. The following example creates a highlight with + its motion defined by the spring \l {Follow}: + + \snippet doc/src/snippets/declarative/listview/highlight.qml 1 + + \sa highlight */ bool QFxListView::autoHighlight() const { @@ -1079,11 +1028,18 @@ void QFxListView::setAutoHighlight(bool autoHighlight) The modes supported are: \list \i Free - For Mouse, the current item may be positioned anywhere, - whether within the visible area, or outside. during Keyboard interaction, + whether within the visible area, or outside. During Keyboard interaction, the current item can move within the visible area, and the view will scroll to keep the highlight visible. - \i Snap - - \i SnapAuto - + \i Snap - For mouse, the current item may be positioned anywhere, + whether within the visible area, or outside. During keyboard interaction, + the current item will be kept in the visible area and will prefer to be + positioned at the \l snapPosition, however the view will never scroll + beyond the beginning or end of the view. + \i SnapAuto - For both mouse and keyboard, the current item will be + kept at the \l {snapPosition}. Additionally, if the view is dragged or + flicked, the current item will be automatically updated to be the item + currently at the snapPosition. \endlist */ QFxListView::CurrentItemPositioning QFxListView::currentItemPositioning() const @@ -1121,10 +1077,10 @@ void QFxListView::setSnapPosition(int pos) \qmlproperty enumeration ListView::orientation This property holds the orientation of the list. - Possible values are \c Qt::Vertical (default) and \c Qt::Horizontal. + Possible values are \c Vertical (default) and \c Horizontal. Vertical Example: - \image ListViewVertical.png + \image trivialListView.png Horizontal Example: \image ListViewHorizontal.png */ @@ -1205,24 +1161,15 @@ void QFxListView::setCacheBuffer(int b) \qmlproperty string ListView::sectionExpression This property holds the expression to be evaluated for the section attached property. - Each item in the list has attached properties named \c section and - \c prevSection. These may be used to place a section header for - related items. The example below assumes that the model is alphabetically - sorted. The section expression is the first character of the \c description - property. If \c section and \c prevSection differ, the item will - display a section header. - - \code - - - - - - - - - - \endcode + Each item in the list has attached properties named \c ListView.section and + \c ListView.prevSection. These may be used to place a section header for + related items. The example below assumes that the model is sorted by size of + pet. The section expression is the size property. If \c ListView.section and + \c ListView.prevSection differ, the item will display a section header. + + \snippet examples/declarative/listview/sections.qml 0 + + \image ListViewSections.png */ QString QFxListView::sectionExpression() const { diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp index 8a10ca3..755befe 100644 --- a/src/declarative/util/qmlstateoperations.cpp +++ b/src/declarative/util/qmlstateoperations.cpp @@ -59,6 +59,7 @@ public: }; /*! + \preliminary \qmlclass ParentChange \brief The ParentChange element allows you to reparent an object in a state. */ -- cgit v0.12