diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp index 4ad7854d773944074c9c3ceecd89a74d39fc3982..7b9ad5ec41aa1b7389ce3ddf7da6d6509f59c244 100644 --- a/src/libs/cplusplus/pp-engine.cpp +++ b/src/libs/cplusplus/pp-engine.cpp @@ -871,27 +871,33 @@ void Preprocessor::preprocess(const QString &fileName, const QByteArray &source, expandBuiltinMacro(identifierToken, spell); else { - if (Macro *m = env->resolve(spell)) { - if (! m->isFunctionLike()) { - if (0 == (m = processObjectLikeMacro(identifierToken, spell, m))) - continue; +#ifdef ICHECK_BUILD + if(spell != "Q_PROPERTY" && spell != "Q_INVOKABLE" && spell != "Q_ENUMS" + && spell != "Q_FLAGS" && spell != "Q_DECLARE_FLAGS"){ +#endif + if (Macro *m = env->resolve(spell)) { + if (! m->isFunctionLike()) { + if (0 == (m = processObjectLikeMacro(identifierToken, spell, m))) + continue; - // the macro expansion generated something that looks like - // a function-like macro. - } + // the macro expansion generated something that looks like + // a function-like macro. + } - // `m' is function-like macro. - if (_dot->is(T_LPAREN)) { - QVector<MacroArgumentReference> actuals; - collectActualArguments(&actuals); + // `m' is function-like macro. + if (_dot->is(T_LPAREN)) { + QVector<MacroArgumentReference> actuals; + collectActualArguments(&actuals); - if (_dot->is(T_RPAREN)) { - expandFunctionLikeMacro(identifierToken, m, actuals); - continue; + if (_dot->is(T_RPAREN)) { + expandFunctionLikeMacro(identifierToken, m, actuals); + continue; + } } } +#ifdef ICHECK_BUILD } - +#endif // it's not a function or object-like macro. out(spell); } diff --git a/src/shared/qscripthighlighter/README b/src/libs/qmljs/README similarity index 100% rename from src/shared/qscripthighlighter/README rename to src/libs/qmljs/README diff --git a/src/shared/qmljs/parser/parser.pri b/src/libs/qmljs/parser/parser.pri similarity index 100% rename from src/shared/qmljs/parser/parser.pri rename to src/libs/qmljs/parser/parser.pri diff --git a/src/shared/qmljs/parser/qmljs.g b/src/libs/qmljs/parser/qmljs.g similarity index 99% rename from src/shared/qmljs/parser/qmljs.g rename to src/libs/qmljs/parser/qmljs.g index ec9a95611b38b1a9ce027a661f3a75255c62c08f..7fbb3f60c90e8468969f9bac8be120db47de7342 100644 --- a/src/shared/qmljs/parser/qmljs.g +++ b/src/libs/qmljs/parser/qmljs.g @@ -72,6 +72,7 @@ %token T_FEED_JS_STATEMENT %token T_FEED_JS_EXPRESSION %token T_FEED_JS_SOURCE_ELEMENT +%token T_FEED_JS_PROGRAM %nonassoc SHIFT_THERE %nonassoc T_IDENTIFIER T_COLON T_SIGNAL T_PROPERTY T_READONLY @@ -268,6 +269,7 @@ public: bool parseExpression() { return parse(T_FEED_JS_EXPRESSION); } bool parseSourceElement() { return parse(T_FEED_JS_SOURCE_ELEMENT); } bool parseUiObjectMember() { return parse(T_FEED_UI_OBJECT_MEMBER); } + bool parseProgram() { return parse(T_FEED_JS_PROGRAM); } AST::UiProgram *ast() const { return AST::cast<AST::UiProgram *>(program); } @@ -296,6 +298,9 @@ public: return program->uiObjectMemberCast(); } + AST::Node *rootNode() const + { return program; } + QList<DiagnosticMessage> diagnosticMessages() const { return diagnostic_messages; } @@ -557,6 +562,14 @@ case $rule_number: { } break; ./ +TopLevel: T_FEED_JS_PROGRAM Program ; +/. +case $rule_number: { + sym(1).Node = sym(2).Node; + program = sym(1).Node; +} break; +./ + UiProgram: UiImportListOpt UiRootMember ; /. case $rule_number: { @@ -2873,13 +2886,12 @@ case $rule_number: { } break; ./ ---QmlJSProgram: SourceElements ; ---/. ---case $rule_number: { --- sym(1).Node = makeAstNode<AST::Program> (driver->nodePool(), sym(1).SourceElements->finish ()); --- driver->changeAbstractSyntaxTree(sym(1).Node); ---} break; ---./ +Program: SourceElements ; +/. +case $rule_number: { + sym(1).Node = makeAstNode<AST::Program> (driver->nodePool(), sym(1).SourceElements->finish ()); +} break; +./ SourceElements: SourceElement ; /. diff --git a/src/shared/qmljs/parser/qmljsast.cpp b/src/libs/qmljs/parser/qmljsast.cpp similarity index 99% rename from src/shared/qmljs/parser/qmljsast.cpp rename to src/libs/qmljs/parser/qmljsast.cpp index 2a39aae947721aa3b8db91584864aefceb19e18d..e80b05ef3fc5b07eb7eb87ed69ff41610c503165 100644 --- a/src/shared/qmljs/parser/qmljsast.cpp +++ b/src/libs/qmljs/parser/qmljsast.cpp @@ -798,7 +798,6 @@ void DebuggerStatement::accept0(Visitor *visitor) visitor->endVisit(this); } - void UiProgram::accept0(Visitor *visitor) { if (visitor->visit(this)) { diff --git a/src/shared/qmljs/parser/qmljsast_p.h b/src/libs/qmljs/parser/qmljsast_p.h similarity index 100% rename from src/shared/qmljs/parser/qmljsast_p.h rename to src/libs/qmljs/parser/qmljsast_p.h diff --git a/src/shared/qmljs/parser/qmljsastfwd_p.h b/src/libs/qmljs/parser/qmljsastfwd_p.h similarity index 100% rename from src/shared/qmljs/parser/qmljsastfwd_p.h rename to src/libs/qmljs/parser/qmljsastfwd_p.h diff --git a/src/shared/qmljs/parser/qmljsastvisitor.cpp b/src/libs/qmljs/parser/qmljsastvisitor.cpp similarity index 100% rename from src/shared/qmljs/parser/qmljsastvisitor.cpp rename to src/libs/qmljs/parser/qmljsastvisitor.cpp diff --git a/src/shared/qmljs/parser/qmljsastvisitor_p.h b/src/libs/qmljs/parser/qmljsastvisitor_p.h similarity index 100% rename from src/shared/qmljs/parser/qmljsastvisitor_p.h rename to src/libs/qmljs/parser/qmljsastvisitor_p.h diff --git a/src/shared/qmljs/parser/qmljsengine_p.cpp b/src/libs/qmljs/parser/qmljsengine_p.cpp similarity index 100% rename from src/shared/qmljs/parser/qmljsengine_p.cpp rename to src/libs/qmljs/parser/qmljsengine_p.cpp diff --git a/src/shared/qmljs/parser/qmljsengine_p.h b/src/libs/qmljs/parser/qmljsengine_p.h similarity index 100% rename from src/shared/qmljs/parser/qmljsengine_p.h rename to src/libs/qmljs/parser/qmljsengine_p.h diff --git a/src/shared/qmljs/parser/qmljsglobal_p.h b/src/libs/qmljs/parser/qmljsglobal_p.h similarity index 97% rename from src/shared/qmljs/parser/qmljsglobal_p.h rename to src/libs/qmljs/parser/qmljsglobal_p.h index 59762ff965f46debf4ab8a62617de4354576ad7b..49e50cff770fa17dba8ef8a19496f4a6a4e5a411 100644 --- a/src/shared/qmljs/parser/qmljsglobal_p.h +++ b/src/libs/qmljs/parser/qmljsglobal_p.h @@ -47,13 +47,13 @@ # define QT_QML_BEGIN_NAMESPACE # define QT_QML_END_NAMESPACE -# ifdef QML_BUILD_LIB +# ifdef QMLJS_BUILD_DIR # define QML_PARSER_EXPORT Q_DECL_EXPORT # elif QML_BUILD_STATIC_LIB # define QML_PARSER_EXPORT # else # define QML_PARSER_EXPORT Q_DECL_IMPORT -# endif // QML_BUILD_LIB +# endif // QMLJS_BUILD_DIR #else // !QT_CREATOR # define QT_QML_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE diff --git a/src/libs/qmljs/parser/qmljsgrammar.cpp b/src/libs/qmljs/parser/qmljsgrammar.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b416959afffd162bf2e770829ccb3adfd7a7ceb4 --- /dev/null +++ b/src/libs/qmljs/parser/qmljsgrammar.cpp @@ -0,0 +1,939 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 Technology Preview License Agreement accompanying +** this package. +** +** 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.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// This file was generated by qlalr - DO NOT EDIT! +#include "qmljsgrammar_p.h" + +QT_BEGIN_NAMESPACE + +const char *const QmlJSGrammar::spell [] = { + "end of file", "&", "&&", "&=", "break", "case", "catch", ":", ";", "continue", + "default", "delete", "/", "/=", "do", ".", "else", "=", "==", "===", + "finally", "for", "function", ">=", ">", ">>", ">>=", ">>>", ">>>=", "identifier", + "if", "in", "instanceof", "{", "[", "<=", "(", "<", "<<", "<<=", + "-", "-=", "--", "new", "!", "!=", "!==", "numeric literal", "|", "|=", + "||", "+", "+=", "++", "?", "}", "]", "%", "%=", "return", + ")", ";", 0, "*", "*=", "string literal", "property", "signal", "readonly", "switch", + "this", "throw", "~", "try", "typeof", "var", "void", "while", "with", "^", + "^=", "null", "true", "false", "const", "debugger", "reserved word", "multiline string literal", "comment", "public", + "import", "as", 0, 0, 0, 0, 0, 0, 0, 0}; + +const short QmlJSGrammar::lhs [] = { + 100, 100, 100, 100, 100, 100, 101, 107, 107, 110, + 110, 112, 111, 111, 111, 111, 111, 111, 111, 111, + 114, 109, 108, 117, 117, 118, 118, 119, 119, 116, + 105, 105, 105, 105, 105, 105, 105, 125, 125, 125, + 126, 126, 127, 127, 105, 105, 105, 105, 105, 105, + 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, + 105, 105, 115, 115, 115, 115, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 120, 132, 132, 132, 132, 131, + 131, 134, 134, 136, 136, 136, 136, 136, 136, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 138, 138, 113, 113, 113, 113, 113, 141, 141, 142, + 142, 142, 142, 140, 140, 143, 143, 144, 144, 145, + 145, 145, 146, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 147, 147, 147, 147, 148, 148, 148, 149, + 149, 149, 149, 150, 150, 150, 150, 150, 150, 150, + 151, 151, 151, 151, 151, 151, 152, 152, 152, 152, + 152, 153, 153, 153, 153, 153, 154, 154, 155, 155, + 156, 156, 157, 157, 158, 158, 159, 159, 160, 160, + 161, 161, 162, 162, 163, 163, 164, 164, 165, 165, + 135, 135, 166, 166, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 167, 167, 103, 103, 168, 168, + 169, 169, 170, 170, 102, 102, 102, 102, 102, 102, + 102, 102, 102, 102, 102, 102, 102, 102, 102, 121, + 182, 182, 181, 181, 129, 129, 183, 183, 184, 184, + 186, 186, 185, 187, 190, 188, 188, 191, 189, 189, + 122, 123, 123, 124, 124, 171, 171, 171, 171, 171, + 171, 171, 172, 172, 172, 172, 173, 173, 173, 173, + 174, 174, 175, 177, 192, 192, 195, 195, 193, 193, + 196, 194, 176, 176, 176, 178, 178, 179, 179, 179, + 197, 198, 180, 180, 128, 139, 202, 202, 199, 199, + 200, 200, 203, 106, 204, 204, 104, 104, 201, 201, + 133, 133, 205}; + +const short QmlJSGrammar::rhs [] = { + 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, + 2, 1, 2, 2, 3, 3, 5, 5, 4, 4, + 2, 0, 1, 1, 2, 1, 3, 2, 3, 2, + 1, 5, 4, 3, 3, 3, 3, 1, 1, 1, + 0, 1, 2, 4, 6, 6, 3, 3, 7, 7, + 4, 4, 5, 5, 6, 6, 7, 7, 7, 7, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 2, 3, 3, 4, + 5, 3, 4, 3, 1, 1, 2, 3, 4, 1, + 2, 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, + 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, 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, 3, 3, 4, + 5, 2, 2, 2, 8, 8, 1, 3, 0, 1, + 0, 1, 1, 1, 1, 2, 1, 1, 0, 1, + 0, 1, 2}; + +const short QmlJSGrammar::action_default [] = { + 0, 0, 0, 0, 0, 0, 22, 0, 170, 237, + 201, 209, 205, 149, 221, 197, 3, 134, 68, 150, + 213, 217, 138, 167, 148, 153, 133, 187, 174, 0, + 75, 76, 71, 339, 63, 341, 0, 0, 0, 0, + 73, 0, 0, 69, 72, 0, 0, 64, 66, 65, + 74, 67, 0, 70, 0, 0, 163, 0, 0, 150, + 169, 152, 151, 0, 0, 0, 165, 166, 164, 168, + 0, 198, 0, 0, 0, 0, 188, 0, 0, 0, + 0, 0, 0, 178, 0, 0, 0, 172, 173, 171, + 176, 180, 179, 177, 175, 190, 189, 191, 0, 206, + 0, 202, 0, 0, 144, 131, 143, 132, 100, 101, + 102, 127, 103, 128, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 129, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 130, 0, + 0, 142, 238, 145, 0, 146, 0, 147, 141, 0, + 234, 227, 225, 232, 233, 231, 230, 236, 229, 228, + 226, 235, 222, 0, 210, 0, 0, 214, 0, 0, + 218, 0, 0, 144, 136, 0, 135, 0, 140, 154, + 0, 340, 329, 330, 0, 327, 0, 328, 0, 331, + 245, 252, 251, 259, 247, 0, 248, 332, 0, 338, + 249, 250, 255, 253, 335, 333, 337, 256, 0, 267, + 0, 0, 0, 0, 339, 63, 0, 341, 64, 239, + 281, 65, 0, 0, 0, 268, 0, 0, 257, 258, + 0, 246, 254, 282, 283, 326, 336, 0, 297, 298, + 299, 300, 0, 293, 294, 295, 296, 323, 324, 0, + 0, 0, 0, 0, 286, 287, 243, 241, 203, 211, + 207, 223, 199, 244, 0, 150, 215, 219, 192, 181, + 0, 0, 200, 0, 0, 0, 0, 193, 0, 0, + 0, 0, 0, 185, 183, 186, 184, 182, 195, 194, + 196, 0, 208, 0, 204, 0, 242, 150, 0, 224, + 239, 240, 0, 239, 0, 0, 289, 0, 0, 0, + 291, 0, 212, 0, 0, 216, 0, 0, 220, 279, + 0, 271, 280, 274, 0, 278, 0, 239, 272, 0, + 239, 0, 0, 290, 0, 0, 0, 292, 340, 329, + 0, 0, 331, 0, 325, 0, 315, 0, 0, 0, + 285, 0, 284, 0, 342, 0, 99, 261, 264, 0, + 100, 267, 103, 128, 105, 106, 71, 110, 111, 63, + 112, 115, 69, 72, 64, 239, 65, 74, 118, 67, + 120, 70, 122, 123, 268, 125, 126, 130, 0, 92, + 0, 0, 94, 98, 96, 83, 95, 97, 0, 93, + 82, 262, 260, 138, 139, 144, 0, 137, 0, 314, + 0, 301, 302, 0, 313, 0, 0, 0, 304, 309, + 307, 310, 0, 0, 308, 309, 0, 305, 0, 306, + 263, 312, 0, 263, 311, 0, 316, 317, 0, 263, + 318, 319, 0, 0, 320, 0, 0, 0, 321, 322, + 156, 155, 0, 0, 0, 288, 0, 0, 0, 303, + 276, 269, 0, 277, 273, 0, 275, 265, 0, 266, + 270, 86, 0, 0, 90, 77, 0, 79, 88, 0, + 80, 89, 91, 81, 87, 78, 0, 84, 160, 158, + 162, 159, 157, 161, 6, 334, 4, 2, 61, 85, + 0, 0, 64, 66, 65, 31, 5, 0, 62, 0, + 40, 39, 38, 0, 0, 53, 0, 54, 0, 59, + 60, 0, 40, 0, 0, 0, 0, 0, 49, 50, + 0, 51, 0, 52, 0, 55, 56, 0, 0, 0, + 0, 0, 57, 58, 0, 47, 41, 48, 42, 0, + 0, 0, 0, 44, 0, 45, 46, 43, 0, 0, + 30, 34, 35, 36, 37, 138, 263, 0, 0, 100, + 267, 103, 128, 105, 106, 71, 110, 111, 63, 112, + 115, 69, 72, 64, 239, 65, 74, 118, 67, 120, + 70, 122, 123, 268, 125, 126, 130, 138, 0, 26, + 0, 0, 32, 27, 33, 28, 24, 0, 29, 25, + 8, 0, 10, 0, 9, 0, 1, 21, 12, 0, + 13, 0, 14, 0, 19, 20, 0, 15, 16, 0, + 17, 18, 11, 23, 7, 343}; + +const short QmlJSGrammar::goto_default [] = { + 7, 616, 206, 195, 204, 506, 494, 615, 634, 610, + 614, 612, 617, 22, 613, 18, 505, 607, 598, 560, + 507, 190, 194, 196, 200, 523, 549, 548, 199, 231, + 26, 473, 472, 355, 354, 9, 353, 356, 106, 17, + 144, 24, 13, 143, 19, 25, 56, 23, 8, 28, + 27, 268, 15, 262, 10, 258, 12, 260, 11, 259, + 20, 266, 21, 267, 14, 261, 257, 298, 410, 263, + 264, 201, 192, 191, 203, 232, 202, 207, 228, 229, + 193, 359, 358, 230, 462, 461, 320, 321, 464, 323, + 463, 322, 418, 422, 425, 421, 420, 440, 441, 184, + 198, 180, 183, 197, 205, 0}; + +const short QmlJSGrammar::action_index [] = { + 439, 1109, 2228, 2228, 2132, 814, -74, 18, 147, -100, + 31, -17, -49, 232, -100, 318, 85, -100, -100, 554, + 33, 94, 331, 215, -100, -100, -100, 448, 231, 1109, + -100, -100, -100, 320, -100, 1940, 1472, 1109, 1109, 1109, + -100, 724, 1109, -100, -100, 1109, 1109, -100, -100, -100, + -100, -100, 1109, -100, 1109, 1109, -100, 1109, 1109, 129, + 157, -100, -100, 1109, 1109, 1109, -100, -100, -100, 200, + 1109, 293, 1109, 1109, 1109, 1109, 466, 1109, 1109, 1109, + 1109, 1109, 1109, 179, 1109, 1109, 1109, 119, 125, 95, + 188, 198, 184, 203, 178, 567, 567, 484, 1109, -5, + 1109, 67, 1844, 1109, 1109, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, 110, + 1109, -100, -100, 70, 61, -100, 1109, -100, -100, 1109, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, 1109, 55, 1109, 1109, 73, 63, 1109, + -100, 1844, 1109, 1109, -100, 141, -100, 41, -100, -100, + 87, -100, 255, 80, 78, -100, 287, -100, 83, 2228, + -100, -100, -100, -100, -100, 225, -100, -100, 52, -100, + -100, -100, -100, -100, -100, 2228, -100, -100, 420, -100, + 408, 113, 2132, 50, 330, 65, 46, 2420, 72, 1109, + -100, 74, 75, 1109, 77, -100, 53, 56, -100, -100, + 323, -100, -100, -100, -100, -100, -100, 96, -100, -100, + -100, -100, 99, -100, -100, -100, -100, -100, -100, 60, + 47, 1109, 118, 93, -100, -100, 1291, -100, 79, 66, + 64, -100, 413, 76, 51, 664, 89, 97, 393, 183, + 337, 1109, 413, 1109, 1109, 1109, 1109, 411, 1109, 1109, + 1109, 1109, 1109, 252, 272, 212, 217, 221, 490, 490, + 383, 1109, 64, 1109, 84, 1109, -100, 536, 1109, -100, + 1109, 69, 68, 1109, 44, 2132, -100, 1109, 124, 2132, + -100, 1109, 54, 1109, 1109, 71, 88, 1109, -100, 82, + 122, 154, -100, -100, 1109, -100, 343, 1109, -100, 81, + 1109, 90, 2132, -100, 1109, 112, 2132, -100, 86, 333, + -39, -10, 2228, -33, -100, 2132, -100, 1109, 246, 2132, + 4, 2132, -100, 10, 16, -21, -100, -100, 2132, -26, + 480, 19, 462, 128, 1109, 2132, 6, -9, 400, 8, + -22, 840, -3, -6, -100, 1202, -100, -7, -28, 5, + 1109, 2, -23, 1109, 0, 1109, -34, -30, 1109, -100, + 2036, 21, -100, -100, -100, -100, -100, -100, 1109, -100, + -100, -100, -100, 209, -100, 1109, 40, -100, 2132, -100, + 101, -100, -100, 2132, -100, 1109, 120, 43, -100, 62, + -100, 59, 109, 1109, -100, 57, 58, -100, 39, -100, + 2132, -100, 117, 2132, -100, 199, -100, -100, 107, 2132, + 34, -100, 24, 11, -100, 346, -19, 14, -100, -100, + -100, -100, 1109, 133, 2132, -100, 1109, 126, 2132, -100, + 20, -100, 173, -100, -100, 1109, -100, -100, 303, -100, + -100, -100, 100, 1656, -100, -100, 1564, -100, -100, 1748, + -100, -100, -100, -100, -100, -100, 131, -100, -100, -100, + -100, -100, -100, -100, -100, 2228, -100, -100, -100, 158, + -20, 752, 165, -16, 22, -100, -100, 98, -100, 189, + -100, -100, -100, 28, 170, -100, 1109, -100, 230, -100, + -100, 247, 1, 13, 238, 37, -24, 106, -100, -100, + 273, -100, 1109, -100, 265, -100, -100, 242, -4, 12, + 1109, 241, -100, -100, 234, -100, 245, -100, 3, 9, + 311, 190, 316, -100, 134, -100, -100, -100, 1380, 1020, + -100, -100, -100, -100, -100, 359, 2324, 1472, 15, 444, + 38, 394, 138, 1109, 2132, 36, 17, 397, 42, 23, + 840, 32, 29, -100, 1202, -100, 26, 35, 48, 1109, + 45, 25, 1109, 49, 1109, 27, 30, 314, 132, -100, + 7, 752, -100, -100, -100, -100, -100, 930, -100, -100, + -100, 752, -100, 253, -87, 617, -100, -100, 102, 290, + -100, 191, -100, 140, -100, -100, 275, -100, -100, 91, + -100, -100, -100, -100, -100, -100, + + -106, 12, -87, 18, 17, 212, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -53, + -106, -106, -106, -106, -106, -106, -106, -106, -106, 162, + -106, -106, -106, -4, -106, -106, -11, 24, 75, 76, + -106, 83, 55, -106, -106, 157, 158, -106, -106, -106, + -106, -106, 150, -106, 172, 176, -106, 168, 167, -106, + -106, -106, -106, 173, 154, 115, -106, -106, -106, -106, + 147, -106, 121, 113, 112, 125, -106, 128, 143, 146, + 140, 139, 136, -106, 122, 138, 130, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, 149, -106, + 153, -106, 110, 82, 46, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + 35, -106, -106, -106, -106, -106, 37, -106, -106, 45, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, 92, -106, 88, 58, -106, -106, 51, + -106, 209, 72, 78, -106, -106, -106, -106, -106, -106, + -106, -106, 27, -106, -106, -106, 63, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, 50, -106, -106, 28, -106, + 29, -106, 47, -106, 33, -106, -106, 66, -106, 73, + -106, -106, -106, 81, 53, -106, -106, -106, -106, -106, + -13, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, 9, -106, -106, -106, -106, 111, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + 3, 186, -106, 220, 228, 234, 204, -106, 90, 91, + 94, 97, 93, -106, -106, -106, -106, -106, -106, -106, + -106, 210, -106, 187, -106, 214, -106, -106, 208, -106, + 207, -106, -106, 155, -106, 8, -106, 4, -106, -1, + -106, 217, -106, 177, 185, -106, -106, 184, -106, -106, + -106, -106, -106, -106, 183, -106, 194, 105, -106, -106, + 99, -106, 71, -106, 74, -106, 65, -106, -106, 114, + -106, -106, -55, -106, -106, 64, -106, 44, -106, 30, + -106, 31, -106, -106, -106, -106, -106, -106, 57, -106, + 36, -106, 40, -106, 70, 59, -106, -106, 42, -106, + -106, 104, -106, -106, -106, 38, -106, -106, -106, -106, + 79, -106, 69, 108, -106, 84, -106, -106, 56, -106, + 68, -106, -106, -106, -106, -106, -106, -106, 52, -106, + -106, -106, -106, -106, -106, 109, -106, -106, 77, -106, + -106, -106, -106, 86, -106, 80, -106, -106, -106, -106, + -106, -59, -106, 43, -106, -63, -106, -106, -106, -106, + 98, -106, -106, 95, -106, -106, -106, -106, -106, 60, + -34, -106, -106, 32, -106, 41, -106, 39, -106, -106, + -106, -106, 49, -106, 61, -106, 62, -106, 48, -106, + -106, -106, -106, -106, -106, 23, -106, -106, 96, -106, + -106, -106, -106, 34, -106, -106, 133, -106, -106, 54, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, 67, -106, -106, -106, -106, + -106, 22, -106, -106, -106, -106, -106, -106, -106, -22, + -106, -106, -106, -106, -106, -106, 2, -106, -106, -106, + -106, -106, -106, -106, -19, -106, -106, -106, -106, -106, + -106, -106, 100, -106, -106, -106, -106, -21, -106, -106, + -3, -106, -106, -106, -106, -106, 13, -106, -106, -106, + 11, 14, 10, -106, -106, -106, -106, -106, 279, 283, + -106, -106, -106, -106, -106, -106, 19, 273, 15, 16, + -106, 21, -106, 224, 6, -106, -106, 25, -106, -106, + 85, -106, -106, -106, 26, -106, -106, -106, -106, 20, + -106, 7, 87, -106, 107, -106, -106, -106, -106, -106, + -106, 317, -106, -106, -106, -106, -106, 277, -106, -106, + -106, 0, -106, -106, -2, 271, -106, -106, -106, 1, + -106, -106, -106, -106, -106, -106, 5, -106, -106, -106, + -106, -106, -106, -106, -106, -106}; + +const short QmlJSGrammar::action_info [] = { + -97, -98, 452, 611, -116, 527, 456, -124, 415, -121, + 439, 551, -119, -108, 347, -94, 611, 388, 635, 540, + 351, 341, 344, 342, 390, 539, -127, 256, 398, 402, + 100, 98, 70, -97, 400, 163, -98, 465, 524, -116, + 559, 447, 530, -108, 439, -127, 509, 439, 559, -94, + 537, 544, -121, 256, 443, -119, -124, 514, 439, 347, + 445, 526, 423, 452, 423, 430, 456, 423, 70, 554, + 169, 415, 345, 311, 100, 163, 419, 140, 146, 408, + 271, 413, 347, 251, 295, 271, 256, 0, 186, 452, + 0, 311, 456, 140, 429, 317, 0, 0, 0, 324, + 407, 178, 291, 98, 305, 558, 0, 235, 476, 0, + 439, 415, 300, 442, 291, 0, 189, 171, 140, 426, + 140, 148, 339, 182, 433, 140, 140, 443, 140, 303, + 326, 559, 140, 0, 140, 57, 172, 250, 188, 140, + 601, 140, 330, 293, 165, 0, 58, 313, 166, 140, + 332, 314, 631, 630, 255, 254, 477, 241, 240, 57, + 246, 245, 412, 411, 427, 57, 141, 529, 528, 63, + 58, 61, 336, 171, 248, 247, 58, 516, 253, 0, + 417, 468, 62, 327, 309, 334, 458, 57, 602, 248, + 247, 487, 172, 454, 522, 556, 555, 176, 58, 248, + 247, 625, 624, 84, 84, 85, 85, 140, 84, 84, + 85, 85, 63, 84, 64, 85, 86, 86, 510, 510, + 65, 86, 86, 84, 171, 85, 86, 63, 84, 0, + 85, 517, 515, 140, 469, 467, 86, 84, 140, 85, + 512, 86, 84, 172, 85, 405, 84, 102, 85, 140, + 86, 511, 628, 627, 140, 86, 84, 64, 85, 86, + 437, 436, 171, 65, 512, 512, 103, 510, 104, 86, + 546, 510, 64, 140, 510, 511, 511, 84, 65, 85, + 532, 172, 626, 405, 34, 0, 234, 233, 0, 0, + 86, 520, 519, 0, 0, 547, 545, 84, 0, 85, + 621, 0, 543, 542, 34, 0, 349, 0, 0, 0, + 86, 72, 73, 512, 622, 620, 34, 512, 0, 34, + 512, 47, 49, 48, 511, 0, 536, 535, 511, 171, + 0, 511, 34, 0, 533, 531, 72, 73, 74, 75, + 34, 47, 49, 48, 619, 34, 171, -85, 172, 34, + 173, 0, 34, 47, 49, 48, 47, 49, 48, 34, + 0, 0, 34, 74, 75, 172, 34, 173, 0, 47, + 49, 48, 34, 0, 171, 34, 0, 47, 49, 48, + 0, 0, 47, 49, 48, 0, 47, 49, 48, 47, + 49, 48, -85, 172, 0, 173, 47, 49, 48, 47, + 49, 48, 0, 47, 49, 48, 278, 279, 0, 47, + 49, 48, 47, 49, 48, 280, 278, 279, 281, 0, + 282, 0, 0, 34, 0, 280, 34, 0, 281, 34, + 282, 273, 274, -339, 278, 279, -339, 34, 0, 0, + 0, 0, 0, 280, 0, 0, 281, 0, 282, 34, + 0, 0, 0, 0, 0, 244, 243, 0, 275, 276, + 47, 49, 48, 47, 49, 48, 47, 49, 48, 244, + 243, 77, 78, 34, 47, 49, 48, 0, 0, 79, + 80, 239, 238, 81, 0, 82, 47, 49, 48, 77, + 78, 34, 0, 0, 0, 0, 0, 79, 80, 0, + 0, 81, 0, 82, 0, 239, 238, 77, 78, 34, + 47, 49, 48, 278, 279, 79, 80, 0, 0, 81, + 0, 82, 280, 244, 243, 281, 0, 282, 47, 49, + 48, 6, 5, 4, 1, 3, 2, 0, 0, 150, + 0, 239, 238, 0, 0, 0, 47, 49, 48, 151, + 0, 0, 0, 152, 0, 0, 0, 150, 0, 0, + 0, 0, 153, 0, 154, 0, 0, 151, 0, 0, + 0, 152, 0, 0, 0, 155, 0, 156, 61, 0, + 153, 0, 154, 0, 0, 157, 0, 0, 158, 62, + 77, 78, 0, 155, 159, 156, 61, 0, 79, 80, + 160, 0, 81, 157, 82, 0, 158, 62, 0, 0, + 0, 0, 159, 0, 0, 0, 161, 0, 160, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, + 31, 0, 0, 0, 161, 0, 0, 0, 0, 33, + 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, + 35, 36, 0, 37, 0, 0, 0, 0, 0, 0, + 501, 0, 0, 0, 44, 0, 0, 150, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 151, 0, 0, + 0, 152, 50, 47, 49, 48, 0, 51, 0, 0, + 153, 0, 154, 0, 0, 307, 0, 0, 43, 53, + 32, 0, 0, 155, 40, 156, 61, 0, 0, 0, + 0, 0, 0, 157, 0, 0, 158, 62, 0, 0, + 0, 0, 159, 0, 0, 0, 0, 0, 160, 0, + 0, 0, 0, 0, 0, 0, 30, 31, 0, 0, + 0, 0, 0, 0, 161, 0, 33, 0, 0, 0, + 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, + 37, 0, 0, 0, 30, 31, 0, 41, 0, 0, + 0, 44, 0, 0, 33, 0, 0, 0, 0, 0, + 0, 34, 0, 0, 0, 35, 36, 0, 37, 50, + 47, 49, 48, 0, 51, 501, 0, 0, 0, 44, + 0, 0, 0, 0, 0, 43, 53, 32, 0, 0, + 0, 40, 0, 0, 0, 0, 0, 50, 47, 49, + 48, 0, 51, 0, 500, 0, 30, 31, 0, 0, + 0, 0, 0, 43, 53, 32, 214, 0, 0, 40, + 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, + 37, 0, 30, 31, 0, 0, 0, 501, 0, 0, + 0, 44, 33, 0, 0, 0, 0, 0, 0, 34, + 0, 0, 0, 35, 36, 0, 37, 0, 0, 50, + 502, 504, 503, 41, 51, 0, 0, 44, 0, 225, + 0, 0, 0, 0, 0, 43, 53, 32, 209, 0, + 0, 40, 0, 0, 0, 50, 47, 49, 48, 0, + 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 43, 53, 32, 0, 0, 0, 40, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 500, 0, 30, 31, 0, 0, 0, 0, 0, 0, + 0, 0, 214, 0, 0, 0, 0, 0, 0, 34, + 0, 0, 0, 35, 36, 0, 37, 0, 0, 0, + 0, 0, 0, 501, 0, 0, 0, 44, 0, 0, + 0, 0, 0, 0, 0, 608, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 50, 502, 504, 503, 0, + 51, 0, 0, 0, 0, 225, 0, 0, 0, 0, + 0, 43, 53, 32, 209, 0, 0, 40, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 500, 0, 30, 31, 0, 0, 0, 0, 0, 0, + 0, 0, 214, 0, 0, 0, 0, 0, 0, 34, + 0, 0, 0, 35, 36, 0, 37, 0, 0, 0, + 0, 0, 0, 501, 0, 0, 0, 44, 0, 0, + 0, 0, 0, 0, 0, 605, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 50, 502, 504, 503, 0, + 51, 0, 0, 0, 0, 225, 0, 0, 0, 0, + 0, 43, 53, 32, 209, 0, 0, 40, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 29, 30, 31, 0, 0, 0, 0, 0, 0, 0, + 0, 33, 0, 0, 0, 0, 0, 0, 34, 0, + 0, 0, 35, 36, 0, 37, 0, 0, 0, 38, + 0, 39, 41, 42, 0, 0, 44, 0, 0, 0, + 45, 0, 46, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 50, 47, 49, 48, 0, 51, + 0, 52, 0, 54, 0, 55, 0, 0, 0, 0, + 43, 53, 32, 0, 0, 0, 40, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, -117, + 0, 0, 0, 29, 30, 31, 0, 0, 0, 0, + 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, + 0, 34, 0, 0, 0, 35, 36, 0, 37, 0, + 0, 0, 38, 0, 39, 41, 42, 0, 0, 44, + 0, 0, 0, 45, 0, 46, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 50, 47, 49, + 48, 0, 51, 0, 52, 0, 54, 0, 55, 0, + 0, 0, 0, 43, 53, 32, 0, 0, 0, 40, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 29, 30, 31, 0, 0, 0, 0, 0, + 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, + 34, 0, 0, 0, 35, 36, 0, 37, 0, 0, + 0, 38, 0, 39, 41, 42, 0, 0, 44, 0, + 0, 0, 45, 0, 46, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 50, 47, 49, 48, + 0, 51, 0, 52, 0, 54, 270, 55, 0, 0, + 0, 0, 43, 53, 32, 0, 0, 0, 40, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 29, 30, 31, 0, 0, 0, 0, 0, 0, + 0, 0, 33, 0, 0, 0, 0, 0, 0, 34, + 216, 0, 0, 566, 567, 0, 37, 0, 0, 0, + 38, 0, 39, 41, 42, 0, 0, 44, 0, 0, + 0, 45, 0, 46, 0, 0, 0, 0, 0, 0, + 0, 220, 0, 0, 0, 50, 47, 49, 48, 0, + 51, 0, 52, 0, 54, 0, 55, 0, 0, 0, + 0, 43, 53, 32, 0, 0, 0, 40, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 474, 0, 0, 29, 30, 31, 0, 0, 0, 0, + 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, + 0, 34, 0, 0, 0, 35, 36, 0, 37, 0, + 0, 0, 38, 0, 39, 41, 42, 0, 0, 44, + 0, 0, 0, 45, 0, 46, 0, 0, 475, 0, + 0, 0, 0, 0, 0, 0, 0, 50, 47, 49, + 48, 0, 51, 0, 52, 0, 54, 0, 55, 0, + 0, 0, 0, 43, 53, 32, 0, 0, 0, 40, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 474, 0, 0, 29, 30, 31, 0, 0, + 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, + 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, + 37, 0, 0, 0, 38, 0, 39, 41, 42, 0, + 0, 44, 0, 0, 0, 45, 0, 46, 0, 0, + 480, 0, 0, 0, 0, 0, 0, 0, 0, 50, + 47, 49, 48, 0, 51, 0, 52, 0, 54, 0, + 55, 0, 0, 0, 0, 43, 53, 32, 0, 0, + 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 482, 0, 0, 29, 30, 31, + 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, + 0, 0, 0, 0, 0, 34, 0, 0, 0, 35, + 36, 0, 37, 0, 0, 0, 38, 0, 39, 41, + 42, 0, 0, 44, 0, 0, 0, 45, 0, 46, + 0, 0, 485, 0, 0, 0, 0, 0, 0, 0, + 0, 50, 47, 49, 48, 0, 51, 0, 52, 0, + 54, 0, 55, 0, 0, 0, 0, 43, 53, 32, + 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 482, 0, 0, 29, + 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, + 33, 0, 0, 0, 0, 0, 0, 34, 0, 0, + 0, 35, 36, 0, 37, 0, 0, 0, 38, 0, + 39, 41, 42, 0, 0, 44, 0, 0, 0, 45, + 0, 46, 0, 0, 483, 0, 0, 0, 0, 0, + 0, 0, 0, 50, 47, 49, 48, 0, 51, 0, + 52, 0, 54, 0, 55, 0, 0, 0, 0, 43, + 53, 32, 0, 0, 0, 40, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 108, 109, + 110, 0, 0, 112, 114, 115, 0, 0, 116, 0, + 117, 0, 0, 0, 119, 120, 121, 0, 0, 0, + 0, 0, 0, 34, 122, 123, 124, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 125, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, + 47, 49, 48, 129, 130, 131, 0, 133, 134, 135, + 136, 137, 138, 0, 0, 126, 132, 118, 111, 113, + 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 108, 109, 110, 0, 0, 112, + 114, 115, 0, 0, 116, 0, 117, 0, 0, 0, + 119, 120, 121, 0, 0, 0, 0, 0, 0, 392, + 122, 123, 124, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 125, 0, 0, 0, 393, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 397, 394, 396, 0, 129, + 130, 131, 0, 133, 134, 135, 136, 137, 138, 0, + 0, 126, 132, 118, 111, 113, 127, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 108, 109, 110, 0, 0, 112, 114, 115, 0, 0, + 116, 0, 117, 0, 0, 0, 119, 120, 121, 0, + 0, 0, 0, 0, 0, 392, 122, 123, 124, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 125, + 0, 0, 0, 393, 0, 0, 0, 0, 0, 0, + 0, 395, 0, 0, 0, 128, 0, 0, 0, 0, + 0, 397, 394, 396, 0, 129, 130, 131, 0, 133, + 134, 135, 136, 137, 138, 0, 0, 126, 132, 118, + 111, 113, 127, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 208, 0, 0, 0, + 0, 210, 0, 29, 30, 31, 212, 0, 0, 0, + 0, 0, 0, 213, 33, 0, 0, 0, 0, 0, + 0, 215, 216, 0, 0, 217, 36, 0, 37, 0, + 0, 0, 38, 0, 39, 41, 42, 0, 0, 44, + 0, 0, 0, 45, 0, 46, 0, 0, 0, 0, + 0, 219, 0, 220, 0, 0, 0, 50, 218, 221, + 48, 222, 51, 223, 52, 224, 54, 225, 55, 226, + 227, 0, 0, 43, 53, 32, 209, 211, 0, 40, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 208, 0, 0, 0, 0, 210, 0, 29, + 30, 31, 212, 0, 0, 0, 0, 0, 0, 213, + 214, 0, 0, 0, 0, 0, 0, 215, 216, 0, + 0, 217, 36, 0, 37, 0, 0, 0, 38, 0, + 39, 41, 42, 0, 0, 44, 0, 0, 0, 45, + 0, 46, 0, 0, 0, 0, 0, 219, 0, 220, + 0, 0, 0, 50, 218, 221, 48, 222, 51, 223, + 52, 224, 54, 225, 55, 226, 227, 0, 0, 43, + 53, 32, 209, 211, 0, 40, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 569, 109, + 110, 0, 0, 571, 114, 573, 30, 31, 574, 0, + 117, 0, 0, 0, 119, 576, 577, 0, 0, 0, + 0, 0, 0, 578, 579, 123, 124, 217, 36, 0, + 37, 0, 0, 0, 38, 0, 39, 580, 42, 0, + 0, 582, 0, 0, 0, 45, 0, 46, 0, 0, + 0, 0, 0, 584, 0, 220, 0, 0, 0, 586, + 583, 585, 48, 587, 588, 589, 52, 591, 592, 593, + 594, 595, 596, 0, 0, 581, 590, 575, 570, 572, + 127, 40, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 360, 109, 110, 0, 0, 362, + 114, 364, 30, 31, 365, 0, 117, 0, 0, 0, + 119, 367, 368, 0, 0, 0, 0, 0, 0, 369, + 370, 123, 124, 217, 36, 0, 37, 0, 0, 0, + 38, 0, 39, 371, 42, 0, 0, 373, 0, 0, + 0, 45, 0, 46, 0, -263, 0, 0, 0, 375, + 0, 220, 0, 0, 0, 377, 374, 376, 48, 378, + 379, 380, 52, 382, 383, 384, 385, 386, 387, 0, + 0, 372, 381, 366, 361, 363, 127, 40, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 541, 310, 460, 513, 538, 518, 525, 308, 249, 632, + 306, 181, 252, 618, 149, 16, 623, 495, 319, 497, + 629, 357, 496, 435, 471, 553, 557, 486, 438, 301, + 428, 237, 350, 352, 604, 521, 242, 424, 550, 552, + 181, 301, 185, 237, 242, 343, 432, 348, 338, 249, + 459, 237, 453, 449, 236, 242, 446, 181, 466, 401, + 448, 249, 357, 455, 444, 457, 346, 337, 357, 484, + 142, 236, 147, 333, 438, 175, 301, 335, 187, 409, + 162, 145, 435, 416, 435, 139, 170, 399, 414, 481, + 438, 389, 0, 168, 0, 0, 403, 357, 403, 59, + 357, 490, 301, 534, 391, 0, 0, 0, 301, 0, + 0, 460, 0, 145, 59, 0, 179, 403, 177, 59, + 59, 488, 489, 0, 404, 105, 404, 0, 59, 185, + 451, 59, 59, 450, 59, 59, 59, 59, 59, 283, + 284, 59, 287, 285, 145, 404, 286, 107, 167, 406, + 164, 59, 59, 451, 450, 265, 59, 59, 301, 59, + 269, 68, 96, 95, 479, 59, 59, 331, 478, 59, + 87, 76, 59, 329, 59, 97, 434, 83, 89, 431, + 59, 470, 59, 59, 59, 94, 88, 59, 93, 92, + 59, 59, 90, 59, 59, 91, 493, 59, 59, 71, + 67, 59, 59, 491, 492, 99, 59, 101, 179, 319, + 301, 59, 59, 340, 69, 60, 59, 59, 450, 66, + 59, 59, 451, 304, 105, 499, 269, 297, 297, 297, + 59, 59, 269, 269, 269, 269, 269, 0, 315, 272, + 498, 508, 294, 0, 0, 0, 107, 174, 59, 325, + 318, 316, 297, 269, 59, 290, 0, 269, 297, 269, + 0, 59, 0, 269, 59, 0, 269, 292, 59, 269, + 179, 277, 59, 0, 299, 302, 312, 269, 59, 288, + 296, 328, 609, 269, 499, 289, 597, 633, 606, 599, + 499, 600, 565, 600, 0, 0, 499, 0, 0, 568, + 561, 562, 563, 564, 0, 498, 508, 0, 471, 0, + 0, 498, 508, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 499, 0, 0, 603, 0, 0, 0, 600, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0}; + +const short QmlJSGrammar::action_check [] = { + 7, 7, 36, 90, 7, 29, 36, 7, 36, 7, + 33, 8, 7, 7, 36, 7, 90, 7, 0, 7, + 16, 60, 55, 33, 8, 29, 7, 36, 7, 55, + 79, 48, 1, 7, 55, 2, 7, 17, 37, 7, + 33, 60, 29, 7, 33, 7, 66, 33, 33, 7, + 66, 29, 7, 36, 20, 7, 7, 29, 33, 36, + 36, 24, 5, 36, 5, 7, 36, 5, 1, 60, + 7, 36, 7, 2, 79, 2, 33, 8, 8, 7, + 1, 7, 36, 36, 8, 1, 36, -1, 8, 36, + -1, 2, 36, 8, 55, 7, -1, -1, -1, 17, + 60, 60, 48, 48, 60, 7, -1, 55, 8, -1, + 33, 36, 61, 6, 48, -1, 33, 15, 8, 10, + 8, 60, 36, 36, 7, 8, 8, 20, 8, 61, + 8, 33, 8, -1, 8, 40, 34, 77, 60, 8, + 8, 8, 61, 79, 50, -1, 51, 50, 54, 8, + 60, 54, 61, 62, 61, 62, 56, 61, 62, 40, + 61, 62, 61, 62, 55, 40, 56, 61, 62, 12, + 51, 42, 60, 15, 61, 62, 51, 7, 60, -1, + 60, 8, 53, 61, 60, 31, 60, 40, 56, 61, + 62, 60, 34, 60, 29, 61, 62, 56, 51, 61, + 62, 61, 62, 25, 25, 27, 27, 8, 25, 25, + 27, 27, 12, 25, 57, 27, 38, 38, 29, 29, + 63, 38, 38, 25, 15, 27, 38, 12, 25, -1, + 27, 61, 62, 8, 61, 62, 38, 25, 8, 27, + 75, 38, 25, 34, 27, 36, 25, 15, 27, 8, + 38, 86, 61, 62, 8, 38, 25, 57, 27, 38, + 61, 62, 15, 63, 75, 75, 34, 29, 36, 38, + 36, 29, 57, 8, 29, 86, 86, 25, 63, 27, + 7, 34, 91, 36, 29, -1, 61, 62, -1, -1, + 38, 61, 62, -1, -1, 61, 62, 25, -1, 27, + 47, -1, 61, 62, 29, -1, 60, -1, -1, -1, + 38, 18, 19, 75, 61, 62, 29, 75, -1, 29, + 75, 66, 67, 68, 86, -1, 61, 62, 86, 15, + -1, 86, 29, -1, 61, 62, 18, 19, 45, 46, + 29, 66, 67, 68, 91, 29, 15, 33, 34, 29, + 36, -1, 29, 66, 67, 68, 66, 67, 68, 29, + -1, -1, 29, 45, 46, 34, 29, 36, -1, 66, + 67, 68, 29, -1, 15, 29, -1, 66, 67, 68, + -1, -1, 66, 67, 68, -1, 66, 67, 68, 66, + 67, 68, 33, 34, -1, 36, 66, 67, 68, 66, + 67, 68, -1, 66, 67, 68, 23, 24, -1, 66, + 67, 68, 66, 67, 68, 32, 23, 24, 35, -1, + 37, -1, -1, 29, -1, 32, 29, -1, 35, 29, + 37, 18, 19, 36, 23, 24, 36, 29, -1, -1, + -1, -1, -1, 32, -1, -1, 35, -1, 37, 29, + -1, -1, -1, -1, -1, 61, 62, -1, 45, 46, + 66, 67, 68, 66, 67, 68, 66, 67, 68, 61, + 62, 23, 24, 29, 66, 67, 68, -1, -1, 31, + 32, 61, 62, 35, -1, 37, 66, 67, 68, 23, + 24, 29, -1, -1, -1, -1, -1, 31, 32, -1, + -1, 35, -1, 37, -1, 61, 62, 23, 24, 29, + 66, 67, 68, 23, 24, 31, 32, -1, -1, 35, + -1, 37, 32, 61, 62, 35, -1, 37, 66, 67, + 68, 92, 93, 94, 95, 96, 97, -1, -1, 3, + -1, 61, 62, -1, -1, -1, 66, 67, 68, 13, + -1, -1, -1, 17, -1, -1, -1, 3, -1, -1, + -1, -1, 26, -1, 28, -1, -1, 13, -1, -1, + -1, 17, -1, -1, -1, 39, -1, 41, 42, -1, + 26, -1, 28, -1, -1, 49, -1, -1, 52, 53, + 23, 24, -1, 39, 58, 41, 42, -1, 31, 32, + 64, -1, 35, 49, 37, -1, 52, 53, -1, -1, + -1, -1, 58, -1, -1, -1, 80, -1, 64, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, + 13, -1, -1, -1, 80, -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, 3, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 13, -1, -1, + -1, 17, 65, 66, 67, 68, -1, 70, -1, -1, + 26, -1, 28, -1, -1, 31, -1, -1, 81, 82, + 83, -1, -1, 39, 87, 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, 12, 13, -1, -1, + -1, -1, -1, -1, 80, -1, 22, -1, -1, -1, + -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, + 36, -1, -1, -1, 12, 13, -1, 43, -1, -1, + -1, 47, -1, -1, 22, -1, -1, -1, -1, -1, + -1, 29, -1, -1, -1, 33, 34, -1, 36, 65, + 66, 67, 68, -1, 70, 43, -1, -1, -1, 47, + -1, -1, -1, -1, -1, 81, 82, 83, -1, -1, + -1, 87, -1, -1, -1, -1, -1, 65, 66, 67, + 68, -1, 70, -1, 10, -1, 12, 13, -1, -1, + -1, -1, -1, 81, 82, 83, 22, -1, -1, 87, + -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, + 36, -1, 12, 13, -1, -1, -1, 43, -1, -1, + -1, 47, 22, -1, -1, -1, -1, -1, -1, 29, + -1, -1, -1, 33, 34, -1, 36, -1, -1, 65, + 66, 67, 68, 43, 70, -1, -1, 47, -1, 75, + -1, -1, -1, -1, -1, 81, 82, 83, 84, -1, + -1, 87, -1, -1, -1, 65, 66, 67, 68, -1, + 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 10, -1, 12, 13, -1, -1, -1, -1, -1, -1, + -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, + -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, + -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, + -1, -1, -1, -1, -1, 55, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, + 70, -1, -1, -1, -1, 75, -1, -1, -1, -1, + -1, 81, 82, 83, 84, -1, -1, 87, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 10, -1, 12, 13, -1, -1, -1, -1, -1, -1, + -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, + -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, + -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, + -1, -1, -1, -1, -1, 55, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, + 70, -1, -1, -1, -1, 75, -1, -1, -1, -1, + -1, 81, 82, 83, 84, -1, -1, 87, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, + -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, + -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, + -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, + 51, -1, 53, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, + -1, 72, -1, 74, -1, 76, -1, -1, -1, -1, + 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, + -1, -1, -1, 11, 12, 13, -1, -1, -1, -1, + -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, + -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, + -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, + -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, + 68, -1, 70, -1, 72, -1, 74, -1, 76, -1, + -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, + -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, + 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, + -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, + -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 65, 66, 67, 68, + -1, 70, -1, 72, -1, 74, 75, 76, -1, -1, + -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, + -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, + 30, -1, -1, 33, 34, -1, 36, -1, -1, -1, + 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, + -1, 51, -1, 53, -1, -1, -1, -1, -1, -1, + -1, 61, -1, -1, -1, 65, 66, 67, 68, -1, + 70, -1, 72, -1, 74, -1, 76, -1, -1, -1, + -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 8, -1, -1, 11, 12, 13, -1, -1, -1, -1, + -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, + -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, + -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, + -1, -1, -1, 51, -1, 53, -1, -1, 56, -1, + -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, + 68, -1, 70, -1, 72, -1, 74, -1, 76, -1, + -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 8, -1, -1, 11, 12, 13, -1, -1, + -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, + -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, + 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, + -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, + 56, -1, -1, -1, -1, -1, -1, -1, -1, 65, + 66, 67, 68, -1, 70, -1, 72, -1, 74, -1, + 76, -1, -1, -1, -1, 81, 82, 83, -1, -1, + -1, 87, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 8, -1, -1, 11, 12, 13, + -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, + -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, + 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, + 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, + -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, + -1, 65, 66, 67, 68, -1, 70, -1, 72, -1, + 74, -1, 76, -1, -1, -1, -1, 81, 82, 83, + -1, -1, -1, 87, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 8, -1, -1, 11, + 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, + 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, + -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, + 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, + -1, 53, -1, -1, 56, -1, -1, -1, -1, -1, + -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, + 72, -1, 74, -1, 76, -1, -1, -1, -1, 81, + 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, + 6, -1, -1, 9, 10, 11, -1, -1, 14, -1, + 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, + -1, -1, -1, 29, 30, 31, 32, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 43, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 59, -1, -1, -1, -1, -1, -1, + 66, 67, 68, 69, 70, 71, -1, 73, 74, 75, + 76, 77, 78, -1, -1, 81, 82, 83, 84, 85, + 86, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 4, 5, 6, -1, -1, 9, + 10, 11, -1, -1, 14, -1, 16, -1, -1, -1, + 20, 21, 22, -1, -1, -1, -1, -1, -1, 29, + 30, 31, 32, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, + -1, -1, -1, -1, -1, 65, 66, 67, -1, 69, + 70, 71, -1, 73, 74, 75, 76, 77, 78, -1, + -1, 81, 82, 83, 84, 85, 86, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 4, 5, 6, -1, -1, 9, 10, 11, -1, -1, + 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, + -1, -1, -1, -1, -1, 29, 30, 31, 32, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, + -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, + -1, 55, -1, -1, -1, 59, -1, -1, -1, -1, + -1, 65, 66, 67, -1, 69, 70, 71, -1, 73, + 74, 75, 76, 77, 78, -1, -1, 81, 82, 83, + 84, 85, 86, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, + -1, 9, -1, 11, 12, 13, 14, -1, -1, -1, + -1, -1, -1, 21, 22, -1, -1, -1, -1, -1, + -1, 29, 30, -1, -1, 33, 34, -1, 36, -1, + -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, + -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, + -1, 59, -1, 61, -1, -1, -1, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, -1, -1, 81, 82, 83, 84, 85, -1, 87, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 4, -1, -1, -1, -1, 9, -1, 11, + 12, 13, 14, -1, -1, -1, -1, -1, -1, 21, + 22, -1, -1, -1, -1, -1, -1, 29, 30, -1, + -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, + 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, + -1, 53, -1, -1, -1, -1, -1, 59, -1, 61, + -1, -1, -1, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, -1, -1, 81, + 82, 83, 84, 85, -1, 87, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, + 6, -1, -1, 9, 10, 11, 12, 13, 14, -1, + 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, + -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, + 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, + -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, + -1, -1, -1, 59, -1, 61, -1, -1, -1, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, -1, -1, 81, 82, 83, 84, 85, + 86, 87, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 4, 5, 6, -1, -1, 9, + 10, 11, 12, 13, 14, -1, 16, -1, -1, -1, + 20, 21, 22, -1, -1, -1, -1, -1, -1, 29, + 30, 31, 32, 33, 34, -1, 36, -1, -1, -1, + 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, + -1, 51, -1, 53, -1, 55, -1, -1, -1, 59, + -1, 61, -1, -1, -1, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, -1, + -1, 81, 82, 83, 84, 85, 86, 87, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + + 3, 2, 15, 25, 25, 3, 25, 3, 2, 11, + 2, 15, 3, 13, 67, 3, 15, 104, 15, 2, + 15, 2, 4, 3, 35, 15, 15, 3, 21, 3, + 93, 15, 2, 2, 19, 13, 15, 96, 25, 25, + 15, 3, 15, 15, 15, 100, 3, 3, 15, 2, + 2, 15, 3, 21, 4, 15, 15, 15, 35, 2, + 21, 2, 2, 2, 98, 3, 2, 2, 2, 35, + 35, 4, 35, 2, 21, 3, 3, 3, 15, 2, + 35, 35, 3, 3, 3, 3, 35, 35, 2, 35, + 21, 35, -1, 35, -1, -1, 13, 2, 13, 44, + 2, 46, 3, 3, 36, -1, -1, -1, 3, -1, + -1, 15, -1, 35, 44, -1, 46, 13, 40, 44, + 44, 46, 46, -1, 41, 15, 41, -1, 44, 15, + 46, 44, 44, 46, 44, 44, 44, 44, 44, 49, + 49, 44, 49, 49, 35, 41, 49, 37, 60, 40, + 58, 44, 44, 46, 46, 44, 44, 44, 3, 44, + 49, 46, 50, 50, 31, 44, 44, 68, 35, 44, + 48, 50, 44, 68, 44, 50, 81, 49, 48, 81, + 44, 85, 44, 44, 44, 49, 48, 44, 49, 49, + 44, 44, 49, 44, 44, 49, 46, 44, 44, 52, + 46, 44, 44, 46, 46, 56, 44, 54, 46, 15, + 3, 44, 44, 99, 47, 47, 44, 44, 46, 46, + 44, 44, 46, 68, 15, 13, 49, 44, 44, 44, + 44, 44, 49, 49, 49, 49, 49, -1, 61, 53, + 28, 29, 55, -1, -1, -1, 37, 38, 44, 66, + 66, 66, 44, 49, 44, 51, -1, 49, 44, 49, + -1, 44, -1, 49, 44, -1, 49, 57, 44, 49, + 46, 51, 44, -1, 66, 68, 59, 49, 44, 51, + 66, 87, 5, 49, 13, 51, 13, 16, 5, 16, + 13, 20, 13, 20, -1, -1, 13, -1, -1, 20, + 21, 22, 23, 24, -1, 28, 29, -1, 35, -1, + -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 13, -1, -1, 16, -1, -1, -1, 20, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1}; + +QT_END_NAMESPACE diff --git a/src/shared/qmljs/parser/qmljsgrammar_p.h b/src/libs/qmljs/parser/qmljsgrammar_p.h similarity index 94% rename from src/shared/qmljs/parser/qmljsgrammar_p.h rename to src/libs/qmljs/parser/qmljsgrammar_p.h index 74fc7aad9652445191cc491c983d2339265ab8ef..903e2c4dab63e78f04b7149dba4ff716490f89cb 100644 --- a/src/shared/qmljs/parser/qmljsgrammar_p.h +++ b/src/libs/qmljs/parser/qmljsgrammar_p.h @@ -63,8 +63,8 @@ class QmlJSGrammar public: enum { EOF_SYMBOL = 0, - REDUCE_HERE = 98, - SHIFT_THERE = 97, + REDUCE_HERE = 99, + SHIFT_THERE = 98, T_AND = 1, T_AND_AND = 2, T_AND_EQ = 3, @@ -91,6 +91,7 @@ public: T_EQ_EQ_EQ = 19, T_FALSE = 83, T_FEED_JS_EXPRESSION = 95, + T_FEED_JS_PROGRAM = 97, T_FEED_JS_SOURCE_ELEMENT = 96, T_FEED_JS_STATEMENT = 94, T_FEED_UI_OBJECT_MEMBER = 93, @@ -162,15 +163,15 @@ public: T_XOR = 79, T_XOR_EQ = 80, - ACCEPT_STATE = 632, - RULE_COUNT = 341, - STATE_COUNT = 633, - TERMINAL_COUNT = 99, - NON_TERMINAL_COUNT = 105, + ACCEPT_STATE = 635, + RULE_COUNT = 343, + STATE_COUNT = 636, + TERMINAL_COUNT = 100, + NON_TERMINAL_COUNT = 106, - GOTO_INDEX_OFFSET = 633, - GOTO_INFO_OFFSET = 2691, - GOTO_CHECK_OFFSET = 2691 + GOTO_INDEX_OFFSET = 636, + GOTO_INFO_OFFSET = 2520, + GOTO_CHECK_OFFSET = 2520 }; static const char *const spell []; diff --git a/src/shared/qmljs/parser/qmljslexer.cpp b/src/libs/qmljs/parser/qmljslexer.cpp similarity index 100% rename from src/shared/qmljs/parser/qmljslexer.cpp rename to src/libs/qmljs/parser/qmljslexer.cpp diff --git a/src/shared/qmljs/parser/qmljslexer_p.h b/src/libs/qmljs/parser/qmljslexer_p.h similarity index 100% rename from src/shared/qmljs/parser/qmljslexer_p.h rename to src/libs/qmljs/parser/qmljslexer_p.h diff --git a/src/shared/qmljs/parser/qmljsmemorypool_p.h b/src/libs/qmljs/parser/qmljsmemorypool_p.h similarity index 100% rename from src/shared/qmljs/parser/qmljsmemorypool_p.h rename to src/libs/qmljs/parser/qmljsmemorypool_p.h diff --git a/src/shared/qmljs/parser/qmljsnodepool_p.h b/src/libs/qmljs/parser/qmljsnodepool_p.h similarity index 100% rename from src/shared/qmljs/parser/qmljsnodepool_p.h rename to src/libs/qmljs/parser/qmljsnodepool_p.h diff --git a/src/shared/qmljs/parser/qmljsparser.cpp b/src/libs/qmljs/parser/qmljsparser.cpp similarity index 98% rename from src/shared/qmljs/parser/qmljsparser.cpp rename to src/libs/qmljs/parser/qmljsparser.cpp index e38f3177591c454f9ae7c6653492c2adc7dc6eec..c2788f466a83b274e2732ef353aab5aed82e6b1c 100644 --- a/src/shared/qmljs/parser/qmljsparser.cpp +++ b/src/libs/qmljs/parser/qmljsparser.cpp @@ -220,33 +220,38 @@ case 4: { } break; case 5: { + sym(1).Node = sym(2).Node; + program = sym(1).Node; +} break; + +case 6: { sym(1).UiProgram = makeAstNode<AST::UiProgram> (driver->nodePool(), sym(1).UiImportList, sym(2).UiObjectMemberList->finish()); } break; -case 7: { +case 8: { sym(1).Node = sym(1).UiImportList->finish(); } break; -case 8: { +case 9: { sym(1).Node = makeAstNode<AST::UiImportList> (driver->nodePool(), sym(1).UiImport); } break; -case 9: { +case 10: { sym(1).Node = makeAstNode<AST::UiImportList> (driver->nodePool(), sym(1).UiImportList, sym(2).UiImport); } break; -case 12: { +case 13: { sym(1).UiImport->semicolonToken = loc(2); } break; -case 14: { +case 15: { sym(1).UiImport->versionToken = loc(2); sym(1).UiImport->semicolonToken = loc(3); } break; -case 16: { +case 17: { sym(1).UiImport->versionToken = loc(2); sym(1).UiImport->asToken = loc(3); sym(1).UiImport->importIdToken = loc(4); @@ -254,14 +259,14 @@ case 16: { sym(1).UiImport->semicolonToken = loc(5); } break; -case 18: { +case 19: { sym(1).UiImport->asToken = loc(2); sym(1).UiImport->importIdToken = loc(3); sym(1).UiImport->importId = sym(3).sval; sym(1).UiImport->semicolonToken = loc(4); } break; -case 19: { +case 20: { AST::UiImport *node = 0; if (AST::StringLiteral *importIdLiteral = AST::cast<AST::StringLiteral *>(sym(2).Expression)) { @@ -287,56 +292,56 @@ case 19: { } } break; -case 20: { +case 21: { sym(1).Node = 0; } break; -case 21: { +case 22: { sym(1).Node = makeAstNode<AST::UiObjectMemberList> (driver->nodePool(), sym(1).UiObjectMember); } break; -case 22: { +case 23: { sym(1).Node = makeAstNode<AST::UiObjectMemberList> (driver->nodePool(), sym(1).UiObjectMember); } break; -case 23: { +case 24: { AST::UiObjectMemberList *node = makeAstNode<AST:: UiObjectMemberList> (driver->nodePool(), sym(1).UiObjectMemberList, sym(2).UiObjectMember); sym(1).Node = node; } break; -case 24: { +case 25: { sym(1).Node = makeAstNode<AST::UiArrayMemberList> (driver->nodePool(), sym(1).UiObjectMember); } break; -case 25: { +case 26: { AST::UiArrayMemberList *node = makeAstNode<AST::UiArrayMemberList> (driver->nodePool(), sym(1).UiArrayMemberList, sym(3).UiObjectMember); node->commaToken = loc(2); sym(1).Node = node; } break; -case 26: { +case 27: { AST::UiObjectInitializer *node = makeAstNode<AST::UiObjectInitializer> (driver->nodePool(), (AST::UiObjectMemberList*)0); node->lbraceToken = loc(1); node->rbraceToken = loc(2); sym(1).Node = node; } break; -case 27: { +case 28: { AST::UiObjectInitializer *node = makeAstNode<AST::UiObjectInitializer> (driver->nodePool(), sym(2).UiObjectMemberList->finish()); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; -case 28: { +case 29: { AST::UiObjectDefinition *node = makeAstNode<AST::UiObjectDefinition> (driver->nodePool(), sym(1).UiQualifiedId, sym(2).UiObjectInitializer); sym(1).Node = node; } break; -case 30: { +case 31: { AST::UiArrayBinding *node = makeAstNode<AST::UiArrayBinding> (driver->nodePool(), sym(1).UiQualifiedId, sym(4).UiArrayMemberList->finish()); node->colonToken = loc(2); @@ -345,13 +350,13 @@ case 30: { sym(1).Node = node; } break; -case 31: { +case 32: { AST::UiObjectBinding *node = makeAstNode<AST::UiObjectBinding> (driver->nodePool(), sym(1).UiQualifiedId, sym(3).UiQualifiedId, sym(4).UiObjectInitializer); node->colonToken = loc(2); sym(1).Node = node; } break; -case 32:case 33:case 34:case 35: +case 33:case 34:case 35:case 36: { AST::UiScriptBinding *node = makeAstNode<AST::UiScriptBinding> (driver->nodePool(), sym(1).UiQualifiedId, sym(3).Statement); @@ -359,35 +364,35 @@ case 32:case 33:case 34:case 35: sym(1).Node = node; } break; -case 36: +case 37: -case 37: { +case 38: { sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount()); break; } -case 39: { +case 40: { sym(1).Node = 0; } break; -case 40: { +case 41: { sym(1).Node = sym(1).UiParameterList->finish (); } break; -case 41: { +case 42: { AST::UiParameterList *node = makeAstNode<AST::UiParameterList> (driver->nodePool(), sym(1).sval, sym(2).sval); node->identifierToken = loc(2); sym(1).Node = node; } break; -case 42: { +case 43: { AST::UiParameterList *node = makeAstNode<AST::UiParameterList> (driver->nodePool(), sym(1).UiParameterList, sym(3).sval, sym(4).sval); node->commaToken = loc(2); node->identifierToken = loc(4); sym(1).Node = node; } break; -case 44: { +case 45: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), (NameId *)0, sym(2).sval); node->type = AST::UiPublicMember::Signal; node->propertyToken = loc(1); @@ -398,7 +403,7 @@ case 44: { sym(1).Node = node; } break; -case 46: { +case 47: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), (NameId *)0, sym(2).sval); node->type = AST::UiPublicMember::Signal; node->propertyToken = loc(1); @@ -408,7 +413,7 @@ case 46: { sym(1).Node = node; } break; -case 48: { +case 49: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(4).sval, sym(6).sval); node->typeModifier = sym(2).sval; node->propertyToken = loc(1); @@ -419,7 +424,7 @@ case 48: { sym(1).Node = node; } break; -case 50: { +case 51: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval); node->propertyToken = loc(1); node->typeToken = loc(2); @@ -428,7 +433,7 @@ case 50: { sym(1).Node = node; } break; -case 52: { +case 53: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval); node->isDefaultMember = true; node->defaultToken = loc(1); @@ -439,7 +444,7 @@ case 52: { sym(1).Node = node; } break; -case 54: { +case 55: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval, sym(5).Expression); node->propertyToken = loc(1); @@ -450,7 +455,7 @@ case 54: { sym(1).Node = node; } break; -case 56: { +case 57: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval, sym(6).Expression); node->isReadonlyMember = true; @@ -463,7 +468,7 @@ case 56: { sym(1).Node = node; } break; -case 58: { +case 59: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval, sym(6).Expression); node->isDefaultMember = true; @@ -476,75 +481,75 @@ case 58: { sym(1).Node = node; } break; -case 59: { +case 60: { sym(1).Node = makeAstNode<AST::UiSourceElement>(driver->nodePool(), sym(1).Node); } break; -case 60: { +case 61: { sym(1).Node = makeAstNode<AST::UiSourceElement>(driver->nodePool(), sym(1).Node); } break; -case 62: { +case 63: { QString s = QLatin1String(QmlJSGrammar::spell[T_PROPERTY]); sym(1).sval = driver->intern(s.constData(), s.length()); break; } -case 63: { +case 64: { QString s = QLatin1String(QmlJSGrammar::spell[T_SIGNAL]); sym(1).sval = driver->intern(s.constData(), s.length()); break; } -case 64: { +case 65: { QString s = QLatin1String(QmlJSGrammar::spell[T_READONLY]); sym(1).sval = driver->intern(s.constData(), s.length()); break; } -case 65: { +case 66: { AST::ThisExpression *node = makeAstNode<AST::ThisExpression> (driver->nodePool()); node->thisToken = loc(1); sym(1).Node = node; } break; -case 66: { +case 67: { AST::IdentifierExpression *node = makeAstNode<AST::IdentifierExpression> (driver->nodePool(), sym(1).sval); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 67: { +case 68: { AST::NullExpression *node = makeAstNode<AST::NullExpression> (driver->nodePool()); node->nullToken = loc(1); sym(1).Node = node; } break; -case 68: { +case 69: { AST::TrueLiteral *node = makeAstNode<AST::TrueLiteral> (driver->nodePool()); node->trueToken = loc(1); sym(1).Node = node; } break; -case 69: { +case 70: { AST::FalseLiteral *node = makeAstNode<AST::FalseLiteral> (driver->nodePool()); node->falseToken = loc(1); sym(1).Node = node; } break; -case 70: { +case 71: { AST::NumericLiteral *node = makeAstNode<AST::NumericLiteral> (driver->nodePool(), sym(1).dval); node->literalToken = loc(1); sym(1).Node = node; } break; -case 71: -case 72: { +case 72: +case 73: { AST::StringLiteral *node = makeAstNode<AST::StringLiteral> (driver->nodePool(), sym(1).sval); node->literalToken = loc(1); sym(1).Node = node; } break; -case 73: { +case 74: { bool rx = lexer->scanRegExp(Lexer::NoPrefix); if (!rx) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); @@ -555,7 +560,7 @@ case 73: { sym(1).Node = node; } break; -case 74: { +case 75: { bool rx = lexer->scanRegExp(Lexer::EqualPrefix); if (!rx) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); @@ -566,28 +571,28 @@ case 74: { sym(1).Node = node; } break; -case 75: { +case 76: { AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), (AST::Elision *) 0); node->lbracketToken = loc(1); node->rbracketToken = loc(2); sym(1).Node = node; } break; -case 76: { +case 77: { AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).Elision->finish()); node->lbracketToken = loc(1); node->rbracketToken = loc(3); sym(1).Node = node; } break; -case 77: { +case 78: { AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish ()); node->lbracketToken = loc(1); node->rbracketToken = loc(3); sym(1).Node = node; } break; -case 78: { +case 79: { AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish (), (AST::Elision *) 0); node->lbracketToken = loc(1); @@ -596,7 +601,7 @@ case 78: { sym(1).Node = node; } break; -case 79: { +case 80: { AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish (), sym(4).Elision->finish()); node->lbracketToken = loc(1); @@ -605,7 +610,7 @@ case 79: { sym(1).Node = node; } break; -case 80: { +case 81: { AST::ObjectLiteral *node = 0; if (sym(2).Node) node = makeAstNode<AST::ObjectLiteral> (driver->nodePool(), @@ -617,7 +622,7 @@ case 80: { sym(1).Node = node; } break; -case 81: { +case 82: { AST::ObjectLiteral *node = makeAstNode<AST::ObjectLiteral> (driver->nodePool(), sym(2).PropertyNameAndValueList->finish ()); node->lbraceToken = loc(1); @@ -625,14 +630,14 @@ case 81: { sym(1).Node = node; } break; -case 82: { +case 83: { AST::NestedExpression *node = makeAstNode<AST::NestedExpression>(driver->nodePool(), sym(2).Expression); node->lparenToken = loc(1); node->rparenToken = loc(3); sym(1).Node = node; } break; -case 83: { +case 84: { if (AST::ArrayMemberExpression *mem = AST::cast<AST::ArrayMemberExpression *>(sym(1).Expression)) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, mem->lbracketToken, QLatin1String("Ignored annotation"))); @@ -652,48 +657,48 @@ case 83: { } } break; -case 84: { +case 85: { sym(1).Node = makeAstNode<AST::ElementList> (driver->nodePool(), (AST::Elision *) 0, sym(1).Expression); } break; -case 85: { +case 86: { sym(1).Node = makeAstNode<AST::ElementList> (driver->nodePool(), sym(1).Elision->finish(), sym(2).Expression); } break; -case 86: { +case 87: { AST::ElementList *node = makeAstNode<AST::ElementList> (driver->nodePool(), sym(1).ElementList, (AST::Elision *) 0, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 87: { +case 88: { AST::ElementList *node = makeAstNode<AST::ElementList> (driver->nodePool(), sym(1).ElementList, sym(3).Elision->finish(), sym(4).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 88: { +case 89: { AST::Elision *node = makeAstNode<AST::Elision> (driver->nodePool()); node->commaToken = loc(1); sym(1).Node = node; } break; -case 89: { +case 90: { AST::Elision *node = makeAstNode<AST::Elision> (driver->nodePool(), sym(1).Elision); node->commaToken = loc(2); sym(1).Node = node; } break; -case 90: { +case 91: { AST::PropertyNameAndValueList *node = makeAstNode<AST::PropertyNameAndValueList> (driver->nodePool(), sym(1).PropertyName, sym(3).Expression); node->colonToken = loc(2); sym(1).Node = node; } break; -case 91: { +case 92: { AST::PropertyNameAndValueList *node = makeAstNode<AST::PropertyNameAndValueList> (driver->nodePool(), sym(1).PropertyNameAndValueList, sym(3).PropertyName, sym(5).Expression); node->commaToken = loc(2); @@ -701,38 +706,36 @@ case 91: { sym(1).Node = node; } break; -case 92: { +case 93: { AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 93: -case 94: { +case 94: +case 95: { AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount())); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 95: { +case 96: { AST::StringLiteralPropertyName *node = makeAstNode<AST::StringLiteralPropertyName> (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 96: { +case 97: { AST::NumericLiteralPropertyName *node = makeAstNode<AST::NumericLiteralPropertyName> (driver->nodePool(), sym(1).dval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 97: { +case 98: { AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 98: - case 99: case 100: @@ -792,25 +795,27 @@ case 126: case 127: case 128: + +case 129: { sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount()); } break; -case 133: { +case 134: { AST::ArrayMemberExpression *node = makeAstNode<AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->lbracketToken = loc(2); node->rbracketToken = loc(4); sym(1).Node = node; } break; -case 134: { +case 135: { AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval); node->dotToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 135: { +case 136: { AST::NewMemberExpression *node = makeAstNode<AST::NewMemberExpression> (driver->nodePool(), sym(2).Expression, sym(4).ArgumentList); node->newToken = loc(1); node->lparenToken = loc(3); @@ -818,384 +823,384 @@ case 135: { sym(1).Node = node; } break; -case 137: { +case 138: { AST::NewExpression *node = makeAstNode<AST::NewExpression> (driver->nodePool(), sym(2).Expression); node->newToken = loc(1); sym(1).Node = node; } break; -case 138: { +case 139: { AST::CallExpression *node = makeAstNode<AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; -case 139: { +case 140: { AST::CallExpression *node = makeAstNode<AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; -case 140: { +case 141: { AST::ArrayMemberExpression *node = makeAstNode<AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->lbracketToken = loc(2); node->rbracketToken = loc(4); sym(1).Node = node; } break; -case 141: { +case 142: { AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval); node->dotToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 142: { +case 143: { sym(1).Node = 0; } break; -case 143: { +case 144: { sym(1).Node = sym(1).ArgumentList->finish(); } break; -case 144: { +case 145: { sym(1).Node = makeAstNode<AST::ArgumentList> (driver->nodePool(), sym(1).Expression); } break; -case 145: { +case 146: { AST::ArgumentList *node = makeAstNode<AST::ArgumentList> (driver->nodePool(), sym(1).ArgumentList, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 149: { +case 150: { AST::PostIncrementExpression *node = makeAstNode<AST::PostIncrementExpression> (driver->nodePool(), sym(1).Expression); node->incrementToken = loc(2); sym(1).Node = node; } break; -case 150: { +case 151: { AST::PostDecrementExpression *node = makeAstNode<AST::PostDecrementExpression> (driver->nodePool(), sym(1).Expression); node->decrementToken = loc(2); sym(1).Node = node; } break; -case 152: { +case 153: { AST::DeleteExpression *node = makeAstNode<AST::DeleteExpression> (driver->nodePool(), sym(2).Expression); node->deleteToken = loc(1); sym(1).Node = node; } break; -case 153: { +case 154: { AST::VoidExpression *node = makeAstNode<AST::VoidExpression> (driver->nodePool(), sym(2).Expression); node->voidToken = loc(1); sym(1).Node = node; } break; -case 154: { +case 155: { AST::TypeOfExpression *node = makeAstNode<AST::TypeOfExpression> (driver->nodePool(), sym(2).Expression); node->typeofToken = loc(1); sym(1).Node = node; } break; -case 155: { +case 156: { AST::PreIncrementExpression *node = makeAstNode<AST::PreIncrementExpression> (driver->nodePool(), sym(2).Expression); node->incrementToken = loc(1); sym(1).Node = node; } break; -case 156: { +case 157: { AST::PreDecrementExpression *node = makeAstNode<AST::PreDecrementExpression> (driver->nodePool(), sym(2).Expression); node->decrementToken = loc(1); sym(1).Node = node; } break; -case 157: { +case 158: { AST::UnaryPlusExpression *node = makeAstNode<AST::UnaryPlusExpression> (driver->nodePool(), sym(2).Expression); node->plusToken = loc(1); sym(1).Node = node; } break; -case 158: { +case 159: { AST::UnaryMinusExpression *node = makeAstNode<AST::UnaryMinusExpression> (driver->nodePool(), sym(2).Expression); node->minusToken = loc(1); sym(1).Node = node; } break; -case 159: { +case 160: { AST::TildeExpression *node = makeAstNode<AST::TildeExpression> (driver->nodePool(), sym(2).Expression); node->tildeToken = loc(1); sym(1).Node = node; } break; -case 160: { +case 161: { AST::NotExpression *node = makeAstNode<AST::NotExpression> (driver->nodePool(), sym(2).Expression); node->notToken = loc(1); sym(1).Node = node; } break; -case 162: { +case 163: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Mul, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 163: { +case 164: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Div, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 164: { +case 165: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Mod, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 166: { +case 167: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Add, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 167: { +case 168: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Sub, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 169: { +case 170: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::LShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 170: { +case 171: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::RShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 171: { +case 172: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::URShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 173: { +case 174: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Lt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 174: { +case 175: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Gt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 175: { +case 176: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Le, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 176: { +case 177: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Ge, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 177: { +case 178: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 178: { +case 179: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::In, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 180: { +case 181: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Lt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 181: { +case 182: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Gt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 182: { +case 183: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Le, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 183: { +case 184: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Ge, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 184: { +case 185: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 186: { +case 187: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Equal, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 187: { +case 188: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 188: { +case 189: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 189: { +case 190: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::StrictNotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 191: { +case 192: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Equal, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 192: { +case 193: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 193: { +case 194: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 194: { +case 195: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::StrictNotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 196: { +case 197: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitAnd, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 198: { +case 199: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitAnd, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 200: { +case 201: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitXor, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 202: { +case 203: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitXor, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 204: { +case 205: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitOr, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 206: { +case 207: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitOr, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 208: { +case 209: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::And, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 210: { +case 211: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::And, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 212: { +case 213: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Or, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 214: { +case 215: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Or, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 216: { +case 217: { AST::ConditionalExpression *node = makeAstNode<AST::ConditionalExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression, sym(5).Expression); node->questionToken = loc(2); @@ -1203,7 +1208,7 @@ case 216: { sym(1).Node = node; } break; -case 218: { +case 219: { AST::ConditionalExpression *node = makeAstNode<AST::ConditionalExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression, sym(5).Expression); node->questionToken = loc(2); @@ -1211,112 +1216,112 @@ case 218: { sym(1).Node = node; } break; -case 220: { +case 221: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, sym(2).ival, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 222: { +case 223: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, sym(2).ival, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 223: { +case 224: { sym(1).ival = QSOperator::Assign; } break; -case 224: { +case 225: { sym(1).ival = QSOperator::InplaceMul; } break; -case 225: { +case 226: { sym(1).ival = QSOperator::InplaceDiv; } break; -case 226: { +case 227: { sym(1).ival = QSOperator::InplaceMod; } break; -case 227: { +case 228: { sym(1).ival = QSOperator::InplaceAdd; } break; -case 228: { +case 229: { sym(1).ival = QSOperator::InplaceSub; } break; -case 229: { +case 230: { sym(1).ival = QSOperator::InplaceLeftShift; } break; -case 230: { +case 231: { sym(1).ival = QSOperator::InplaceRightShift; } break; -case 231: { +case 232: { sym(1).ival = QSOperator::InplaceURightShift; } break; -case 232: { +case 233: { sym(1).ival = QSOperator::InplaceAnd; } break; -case 233: { +case 234: { sym(1).ival = QSOperator::InplaceXor; } break; -case 234: { +case 235: { sym(1).ival = QSOperator::InplaceOr; } break; -case 236: { +case 237: { AST::Expression *node = makeAstNode<AST::Expression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 237: { +case 238: { sym(1).Node = 0; } break; -case 240: { +case 241: { AST::Expression *node = makeAstNode<AST::Expression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 241: { +case 242: { sym(1).Node = 0; } break; -case 258: { +case 259: { AST::Block *node = makeAstNode<AST::Block> (driver->nodePool(), sym(2).StatementList); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; -case 259: { +case 260: { sym(1).Node = makeAstNode<AST::StatementList> (driver->nodePool(), sym(1).Statement); } break; -case 260: { +case 261: { sym(1).Node = makeAstNode<AST::StatementList> (driver->nodePool(), sym(1).StatementList, sym(2).Statement); } break; -case 261: { +case 262: { sym(1).Node = 0; } break; -case 262: { +case 263: { sym(1).Node = sym(1).StatementList->finish (); } break; -case 264: { +case 265: { AST::VariableStatement *node = makeAstNode<AST::VariableStatement> (driver->nodePool(), sym(2).VariableDeclarationList->finish (/*readOnly=*/sym(1).ival == T_CONST)); node->declarationKindToken = loc(1); @@ -1324,76 +1329,76 @@ case 264: { sym(1).Node = node; } break; -case 265: { +case 266: { sym(1).ival = T_CONST; } break; -case 266: { +case 267: { sym(1).ival = T_VAR; } break; -case 267: { +case 268: { sym(1).Node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclaration); } break; -case 268: { +case 269: { AST::VariableDeclarationList *node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration); node->commaToken = loc(2); sym(1).Node = node; } break; -case 269: { +case 270: { sym(1).Node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclaration); } break; -case 270: { +case 271: { sym(1).Node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration); } break; -case 271: { +case 272: { AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 272: { +case 273: { AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 273: { +case 274: { // ### TODO: AST for initializer sym(1) = sym(2); } break; -case 274: { +case 275: { sym(1).Node = 0; } break; -case 276: { +case 277: { // ### TODO: AST for initializer sym(1) = sym(2); } break; -case 277: { +case 278: { sym(1).Node = 0; } break; -case 279: { +case 280: { AST::EmptyStatement *node = makeAstNode<AST::EmptyStatement> (driver->nodePool()); node->semicolonToken = loc(1); sym(1).Node = node; } break; -case 281: { +case 282: { AST::ExpressionStatement *node = makeAstNode<AST::ExpressionStatement> (driver->nodePool(), sym(1).Expression); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 282: { +case 283: { AST::IfStatement *node = makeAstNode<AST::IfStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement, sym(7).Statement); node->ifToken = loc(1); node->lparenToken = loc(2); @@ -1402,7 +1407,7 @@ case 282: { sym(1).Node = node; } break; -case 283: { +case 284: { AST::IfStatement *node = makeAstNode<AST::IfStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement); node->ifToken = loc(1); node->lparenToken = loc(2); @@ -1410,7 +1415,7 @@ case 283: { sym(1).Node = node; } break; -case 285: { +case 286: { AST::DoWhileStatement *node = makeAstNode<AST::DoWhileStatement> (driver->nodePool(), sym(2).Statement, sym(5).Expression); node->doToken = loc(1); node->whileToken = loc(3); @@ -1420,7 +1425,7 @@ case 285: { sym(1).Node = node; } break; -case 286: { +case 287: { AST::WhileStatement *node = makeAstNode<AST::WhileStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement); node->whileToken = loc(1); node->lparenToken = loc(2); @@ -1428,7 +1433,7 @@ case 286: { sym(1).Node = node; } break; -case 287: { +case 288: { AST::ForStatement *node = makeAstNode<AST::ForStatement> (driver->nodePool(), sym(3).Expression, sym(5).Expression, sym(7).Expression, sym(9).Statement); node->forToken = loc(1); @@ -1439,7 +1444,7 @@ case 287: { sym(1).Node = node; } break; -case 288: { +case 289: { AST::LocalForStatement *node = makeAstNode<AST::LocalForStatement> (driver->nodePool(), sym(4).VariableDeclarationList->finish (/*readOnly=*/false), sym(6).Expression, sym(8).Expression, sym(10).Statement); @@ -1452,7 +1457,7 @@ case 288: { sym(1).Node = node; } break; -case 289: { +case 290: { AST:: ForEachStatement *node = makeAstNode<AST::ForEachStatement> (driver->nodePool(), sym(3).Expression, sym(5).Expression, sym(7).Statement); node->forToken = loc(1); @@ -1462,7 +1467,7 @@ case 289: { sym(1).Node = node; } break; -case 290: { +case 291: { AST::LocalForEachStatement *node = makeAstNode<AST::LocalForEachStatement> (driver->nodePool(), sym(4).VariableDeclaration, sym(6).Expression, sym(8).Statement); node->forToken = loc(1); @@ -1473,14 +1478,14 @@ case 290: { sym(1).Node = node; } break; -case 292: { +case 293: { AST::ContinueStatement *node = makeAstNode<AST::ContinueStatement> (driver->nodePool()); node->continueToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 294: { +case 295: { AST::ContinueStatement *node = makeAstNode<AST::ContinueStatement> (driver->nodePool(), sym(2).sval); node->continueToken = loc(1); node->identifierToken = loc(2); @@ -1488,14 +1493,14 @@ case 294: { sym(1).Node = node; } break; -case 296: { +case 297: { AST::BreakStatement *node = makeAstNode<AST::BreakStatement> (driver->nodePool()); node->breakToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 298: { +case 299: { AST::BreakStatement *node = makeAstNode<AST::BreakStatement> (driver->nodePool(), sym(2).sval); node->breakToken = loc(1); node->identifierToken = loc(2); @@ -1503,14 +1508,14 @@ case 298: { sym(1).Node = node; } break; -case 300: { +case 301: { AST::ReturnStatement *node = makeAstNode<AST::ReturnStatement> (driver->nodePool(), sym(2).Expression); node->returnToken = loc(1); node->semicolonToken = loc(3); sym(1).Node = node; } break; -case 301: { +case 302: { AST::WithStatement *node = makeAstNode<AST::WithStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement); node->withToken = loc(1); node->lparenToken = loc(2); @@ -1518,7 +1523,7 @@ case 301: { sym(1).Node = node; } break; -case 302: { +case 303: { AST::SwitchStatement *node = makeAstNode<AST::SwitchStatement> (driver->nodePool(), sym(3).Expression, sym(5).CaseBlock); node->switchToken = loc(1); node->lparenToken = loc(2); @@ -1526,90 +1531,90 @@ case 302: { sym(1).Node = node; } break; -case 303: { +case 304: { AST::CaseBlock *node = makeAstNode<AST::CaseBlock> (driver->nodePool(), sym(2).CaseClauses); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; -case 304: { +case 305: { AST::CaseBlock *node = makeAstNode<AST::CaseBlock> (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 305: { +case 306: { sym(1).Node = makeAstNode<AST::CaseClauses> (driver->nodePool(), sym(1).CaseClause); } break; -case 306: { +case 307: { sym(1).Node = makeAstNode<AST::CaseClauses> (driver->nodePool(), sym(1).CaseClauses, sym(2).CaseClause); } break; -case 307: { +case 308: { sym(1).Node = 0; } break; -case 308: { +case 309: { sym(1).Node = sym(1).CaseClauses->finish (); } break; -case 309: { +case 310: { AST::CaseClause *node = makeAstNode<AST::CaseClause> (driver->nodePool(), sym(2).Expression, sym(4).StatementList); node->caseToken = loc(1); node->colonToken = loc(3); sym(1).Node = node; } break; -case 310: { +case 311: { AST::DefaultClause *node = makeAstNode<AST::DefaultClause> (driver->nodePool(), sym(3).StatementList); node->defaultToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 311: -case 312: { +case 312: +case 313: { AST::LabelledStatement *node = makeAstNode<AST::LabelledStatement> (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount()), sym(3).Statement); node->identifierToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 313: { +case 314: { AST::LabelledStatement *node = makeAstNode<AST::LabelledStatement> (driver->nodePool(), sym(1).sval, sym(3).Statement); node->identifierToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 315: { +case 316: { AST::ThrowStatement *node = makeAstNode<AST::ThrowStatement> (driver->nodePool(), sym(2).Expression); node->throwToken = loc(1); node->semicolonToken = loc(3); sym(1).Node = node; } break; -case 316: { +case 317: { AST::TryStatement *node = makeAstNode<AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Catch); node->tryToken = loc(1); sym(1).Node = node; } break; -case 317: { +case 318: { AST::TryStatement *node = makeAstNode<AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Finally); node->tryToken = loc(1); sym(1).Node = node; } break; -case 318: { +case 319: { AST::TryStatement *node = makeAstNode<AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Catch, sym(4).Finally); node->tryToken = loc(1); sym(1).Node = node; } break; -case 319: { +case 320: { AST::Catch *node = makeAstNode<AST::Catch> (driver->nodePool(), sym(3).sval, sym(5).Block); node->catchToken = loc(1); node->lparenToken = loc(2); @@ -1618,20 +1623,20 @@ case 319: { sym(1).Node = node; } break; -case 320: { +case 321: { AST::Finally *node = makeAstNode<AST::Finally> (driver->nodePool(), sym(2).Block); node->finallyToken = loc(1); sym(1).Node = node; } break; -case 322: { +case 323: { AST::DebuggerStatement *node = makeAstNode<AST::DebuggerStatement> (driver->nodePool()); node->debuggerToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 323: { +case 324: { AST::FunctionDeclaration *node = makeAstNode<AST::FunctionDeclaration> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody); node->functionToken = loc(1); node->identifierToken = loc(2); @@ -1642,7 +1647,7 @@ case 323: { sym(1).Node = node; } break; -case 324: { +case 325: { AST::FunctionExpression *node = makeAstNode<AST::FunctionExpression> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody); node->functionToken = loc(1); if (sym(2).sval) @@ -1654,56 +1659,60 @@ case 324: { sym(1).Node = node; } break; -case 325: { +case 326: { AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), sym(1).sval); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 326: { +case 327: { AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), sym(1).FormalParameterList, sym(3).sval); node->commaToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 327: { +case 328: { sym(1).Node = 0; } break; -case 328: { +case 329: { sym(1).Node = sym(1).FormalParameterList->finish (); } break; -case 329: { +case 330: { sym(1).Node = 0; } break; -case 331: { +case 332: { sym(1).Node = makeAstNode<AST::FunctionBody> (driver->nodePool(), sym(1).SourceElements->finish ()); } break; -case 332: { +case 333: { + sym(1).Node = makeAstNode<AST::Program> (driver->nodePool(), sym(1).SourceElements->finish ()); +} break; + +case 334: { sym(1).Node = makeAstNode<AST::SourceElements> (driver->nodePool(), sym(1).SourceElement); } break; -case 333: { +case 335: { sym(1).Node = makeAstNode<AST::SourceElements> (driver->nodePool(), sym(1).SourceElements, sym(2).SourceElement); } break; -case 334: { +case 336: { sym(1).Node = makeAstNode<AST::StatementSourceElement> (driver->nodePool(), sym(1).Statement); } break; -case 335: { +case 337: { sym(1).Node = makeAstNode<AST::FunctionSourceElement> (driver->nodePool(), sym(1).FunctionDeclaration); } break; -case 336: { +case 338: { sym(1).sval = 0; } break; -case 338: { +case 340: { sym(1).Node = 0; } break; diff --git a/src/shared/qmljs/parser/qmljsparser_p.h b/src/libs/qmljs/parser/qmljsparser_p.h similarity index 97% rename from src/shared/qmljs/parser/qmljsparser_p.h rename to src/libs/qmljs/parser/qmljsparser_p.h index 2a09a633cc7b8e8ebc95da6964e61070e962bfcf..42fb422bba9c3838f63185ee72a735066f155db2 100644 --- a/src/shared/qmljs/parser/qmljsparser_p.h +++ b/src/libs/qmljs/parser/qmljsparser_p.h @@ -134,6 +134,7 @@ public: bool parseExpression() { return parse(T_FEED_JS_EXPRESSION); } bool parseSourceElement() { return parse(T_FEED_JS_SOURCE_ELEMENT); } bool parseUiObjectMember() { return parse(T_FEED_UI_OBJECT_MEMBER); } + bool parseProgram() { return parse(T_FEED_JS_PROGRAM); } AST::UiProgram *ast() const { return AST::cast<AST::UiProgram *>(program); } @@ -162,6 +163,9 @@ public: return program->uiObjectMemberCast(); } + AST::Node *rootNode() const + { return program; } + QList<DiagnosticMessage> diagnosticMessages() const { return diagnostic_messages; } @@ -231,9 +235,9 @@ protected: -#define J_SCRIPT_REGEXPLITERAL_RULE1 73 +#define J_SCRIPT_REGEXPLITERAL_RULE1 74 -#define J_SCRIPT_REGEXPLITERAL_RULE2 74 +#define J_SCRIPT_REGEXPLITERAL_RULE2 75 QT_QML_END_NAMESPACE diff --git a/src/libs/qmljs/qmljs-lib.pri b/src/libs/qmljs/qmljs-lib.pri index 65b7ddeef5cc4e616a298b08a4256a6245580eda..3e89cabfe42ffe70f412e220722dc0db48f33021 100644 --- a/src/libs/qmljs/qmljs-lib.pri +++ b/src/libs/qmljs/qmljs-lib.pri @@ -1,24 +1,52 @@ contains(CONFIG, dll) { - DEFINES += QML_BUILD_LIB + DEFINES += QMLJS_BUILD_DIR } else { DEFINES += QML_BUILD_STATIC_LIB } -INCLUDEPATH += $$PWD +include(parser/parser.pri) -include($$PWD/../../shared/qmljs/qmljs.pri) +DEFINES += QSCRIPTHIGHLIGHTER_BUILD_LIB -##contains(QT, gui) { -##HEADERS += \ -## $$PWD/Nothing.h -## -##SOURCES += \ -## $$PWD/Nothing.cpp -##} +DEPENDPATH += $$PWD +INCLUDEPATH += $$PWD/.. -#HEADERS += \ -# $$PWD/qmlsymbol.h +HEADERS += \ + $$PWD/qmljs_global.h \ + $$PWD/qmljsbind.h \ + $$PWD/qmljscheck.h \ + $$PWD/qmljsdocument.h \ + $$PWD/qmljsidcollector.h \ + $$PWD/qmljsmetatypebackend.h \ + $$PWD/qmljspackageinfo.h \ + $$PWD/qmljsscanner.h \ + $$PWD/qmljssymbol.h \ + $$PWD/qmljstypesystem.h -#SOURCES += \ -# $$PWD/qmlsymbol.cpp +SOURCES += \ + $$PWD/qmljsbind.cpp \ + $$PWD/qmljscheck.cpp \ + $$PWD/qmljsdocument.cpp \ + $$PWD/qmljsidcollector.cpp \ + $$PWD/qmljsmetatypebackend.cpp \ + $$PWD/qmljspackageinfo.cpp \ + $$PWD/qmljsscanner.cpp \ + $$PWD/qmljssymbol.cpp \ + $$PWD/qmljstypesystem.cpp +contains(QT_CONFIG, declarative) { + QT += declarative + + DEFINES += BUILD_DECLARATIVE_BACKEND + + HEADERS += \ + $$PWD/qtdeclarativemetatypebackend.h + + SOURCES += \ + $$PWD/qtdeclarativemetatypebackend.cpp +} + +contains(QT, gui) { + SOURCES += $$PWD/qmljshighlighter.cpp $$PWD/qmljsindenter.cpp + HEADERS += $$PWD/qmljshighlighter.h $$PWD/qmljsindenter.h +} diff --git a/src/libs/qmljs/qmljs.pri b/src/libs/qmljs/qmljs.pri index 4d2285d2d0ac71687acfcd7b9aa57dc9134910f9..5756428677b974b9ceadaea5e46e29e8342b7b6a 100644 --- a/src/libs/qmljs/qmljs.pri +++ b/src/libs/qmljs/qmljs.pri @@ -1,5 +1,5 @@ INCLUDEPATH += $$PWD/../../shared INCLUDEPATH += $$PWD/../../shared/qmljs $$PWD/../../shared/qmljs/parser -DEPENDPATH += $$PWD/../../shared/qmljs +DEPENDPATH += $$PWD/../../shared/qmljs $$PWD/../../shared/qmljs/parser LIBS *= -l$$qtLibraryTarget(QmlJS) diff --git a/src/libs/qmljs/qmljs.pro b/src/libs/qmljs/qmljs.pro index 31a8c7fb8476ceec7807837ce13c14350c6f2745..468de26f64c6468b288efba8d408a419bfc302ec 100644 --- a/src/libs/qmljs/qmljs.pro +++ b/src/libs/qmljs/qmljs.pro @@ -1,7 +1,7 @@ TEMPLATE = lib CONFIG += dll TARGET = QmlJS -DEFINES += QML_BUILD_LIB QT_CREATOR +DEFINES += QMLJS_BUILD_DIR QT_CREATOR unix:QMAKE_CXXFLAGS_DEBUG += -O3 diff --git a/src/shared/qmljs/qml_global.h b/src/libs/qmljs/qmljs_global.h similarity index 86% rename from src/shared/qmljs/qml_global.h rename to src/libs/qmljs/qmljs_global.h index 0ec24a40134c7a2c664d0ab08934a525b5fdee13..c46265f3ab198ef09303fff10c1156c00a866c7b 100644 --- a/src/shared/qmljs/qml_global.h +++ b/src/libs/qmljs/qmljs_global.h @@ -27,17 +27,17 @@ ** **************************************************************************/ -#ifndef QML_GLOBAL_H -#define QML_GLOBAL_H +#ifndef QMLJS_GLOBAL_H +#define QMLJS_GLOBAL_H #include <QtCore/qglobal.h> -#if defined(QML_BUILD_LIB) -# define QML_EXPORT Q_DECL_EXPORT +#if defined(QMLJS_BUILD_DIR) +# define QMLJS_EXPORT Q_DECL_EXPORT #elif defined(QML_BUILD_STATIC_LIB) -# define QML_EXPORT +# define QMLJS_EXPORT #else -# define QML_EXPORT Q_DECL_IMPORT +# define QMLJS_EXPORT Q_DECL_IMPORT #endif -#endif // QML_GLOBAL_H +#endif // QMLJS_GLOBAL_H diff --git a/src/libs/qmljs/qmljsbind.cpp b/src/libs/qmljs/qmljsbind.cpp new file mode 100644 index 0000000000000000000000000000000000000000..299b13179e14d717cf8e8699dfcc0ace3f3d8225 --- /dev/null +++ b/src/libs/qmljs/qmljsbind.cpp @@ -0,0 +1,501 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** +**************************************************************************/ + +#include "qmljsbind.h" +#include "parser/qmljsast_p.h" + +using namespace QmlJS; + +Bind::Bind() +{ +} + +Bind::~Bind() +{ +} + +void Bind::operator()(Document::Ptr doc) +{ + _doc = doc; +} + +void Bind::accept(AST::Node *node) +{ + AST::Node::accept(node, this); +} + +bool Bind::visit(AST::UiProgram *) +{ + return true; +} + +bool Bind::visit(AST::UiImportList *) +{ + return true; +} + +bool Bind::visit(AST::UiImport *) +{ + return true; +} + +bool Bind::visit(AST::UiPublicMember *) +{ + return true; +} + +bool Bind::visit(AST::UiSourceElement *) +{ + return true; +} + +bool Bind::visit(AST::UiObjectDefinition *) +{ + return true; +} + +bool Bind::visit(AST::UiObjectInitializer *) +{ + return true; +} + +bool Bind::visit(AST::UiObjectBinding *) +{ + return true; +} + +bool Bind::visit(AST::UiScriptBinding *) +{ + return true; +} + +bool Bind::visit(AST::UiArrayBinding *) +{ + return true; +} + +bool Bind::visit(AST::UiObjectMemberList *) +{ + return true; +} + +bool Bind::visit(AST::UiArrayMemberList *) +{ + return true; +} + +bool Bind::visit(AST::UiQualifiedId *) +{ + return true; +} + +bool Bind::visit(AST::UiSignature *) +{ + return true; +} + +bool Bind::visit(AST::UiFormalList *) +{ + return true; +} + +bool Bind::visit(AST::UiFormal *) +{ + return true; +} + +bool Bind::visit(AST::ThisExpression *) +{ + return true; +} + +bool Bind::visit(AST::IdentifierExpression *) +{ + return true; +} + +bool Bind::visit(AST::NullExpression *) +{ + return true; +} + +bool Bind::visit(AST::TrueLiteral *) +{ + return true; +} + +bool Bind::visit(AST::FalseLiteral *) +{ + return true; +} + +bool Bind::visit(AST::StringLiteral *) +{ + return true; +} + +bool Bind::visit(AST::NumericLiteral *) +{ + return true; +} + +bool Bind::visit(AST::RegExpLiteral *) +{ + return true; +} + +bool Bind::visit(AST::ArrayLiteral *) +{ + return true; +} + +bool Bind::visit(AST::ObjectLiteral *) +{ + return true; +} + +bool Bind::visit(AST::ElementList *) +{ + return true; +} + +bool Bind::visit(AST::Elision *) +{ + return true; +} + +bool Bind::visit(AST::PropertyNameAndValueList *) +{ + return true; +} + +bool Bind::visit(AST::NestedExpression *) +{ + return true; +} + +bool Bind::visit(AST::IdentifierPropertyName *) +{ + return true; +} + +bool Bind::visit(AST::StringLiteralPropertyName *) +{ + return true; +} + +bool Bind::visit(AST::NumericLiteralPropertyName *) +{ + return true; +} + +bool Bind::visit(AST::ArrayMemberExpression *) +{ + return true; +} + +bool Bind::visit(AST::FieldMemberExpression *) +{ + return true; +} + +bool Bind::visit(AST::NewMemberExpression *) +{ + return true; +} + +bool Bind::visit(AST::NewExpression *) +{ + return true; +} + +bool Bind::visit(AST::CallExpression *) +{ + return true; +} + +bool Bind::visit(AST::ArgumentList *) +{ + return true; +} + +bool Bind::visit(AST::PostIncrementExpression *) +{ + return true; +} + +bool Bind::visit(AST::PostDecrementExpression *) +{ + return true; +} + +bool Bind::visit(AST::DeleteExpression *) +{ + return true; +} + +bool Bind::visit(AST::VoidExpression *) +{ + return true; +} + +bool Bind::visit(AST::TypeOfExpression *) +{ + return true; +} + +bool Bind::visit(AST::PreIncrementExpression *) +{ + return true; +} + +bool Bind::visit(AST::PreDecrementExpression *) +{ + return true; +} + +bool Bind::visit(AST::UnaryPlusExpression *) +{ + return true; +} + +bool Bind::visit(AST::UnaryMinusExpression *) +{ + return true; +} + +bool Bind::visit(AST::TildeExpression *) +{ + return true; +} + +bool Bind::visit(AST::NotExpression *) +{ + return true; +} + +bool Bind::visit(AST::BinaryExpression *) +{ + return true; +} + +bool Bind::visit(AST::ConditionalExpression *) +{ + return true; +} + +bool Bind::visit(AST::Expression *) +{ + return true; +} + +bool Bind::visit(AST::Block *) +{ + return true; +} + +bool Bind::visit(AST::StatementList *) +{ + return true; +} + +bool Bind::visit(AST::VariableStatement *) +{ + return true; +} + +bool Bind::visit(AST::VariableDeclarationList *) +{ + return true; +} + +bool Bind::visit(AST::VariableDeclaration *) +{ + return true; +} + +bool Bind::visit(AST::EmptyStatement *) +{ + return true; +} + +bool Bind::visit(AST::ExpressionStatement *) +{ + return true; +} + +bool Bind::visit(AST::IfStatement *) +{ + return true; +} + +bool Bind::visit(AST::DoWhileStatement *) +{ + return true; +} + +bool Bind::visit(AST::WhileStatement *) +{ + return true; +} + +bool Bind::visit(AST::ForStatement *) +{ + return true; +} + +bool Bind::visit(AST::LocalForStatement *) +{ + return true; +} + +bool Bind::visit(AST::ForEachStatement *) +{ + return true; +} + +bool Bind::visit(AST::LocalForEachStatement *) +{ + return true; +} + +bool Bind::visit(AST::ContinueStatement *) +{ + return true; +} + +bool Bind::visit(AST::BreakStatement *) +{ + return true; +} + +bool Bind::visit(AST::ReturnStatement *) +{ + return true; +} + +bool Bind::visit(AST::WithStatement *) +{ + return true; +} + +bool Bind::visit(AST::SwitchStatement *) +{ + return true; +} + +bool Bind::visit(AST::CaseBlock *) +{ + return true; +} + +bool Bind::visit(AST::CaseClauses *) +{ + return true; +} + +bool Bind::visit(AST::CaseClause *) +{ + return true; +} + +bool Bind::visit(AST::DefaultClause *) +{ + return true; +} + +bool Bind::visit(AST::LabelledStatement *) +{ + return true; +} + +bool Bind::visit(AST::ThrowStatement *) +{ + return true; +} + +bool Bind::visit(AST::TryStatement *) +{ + return true; +} + +bool Bind::visit(AST::Catch *) +{ + return true; +} + +bool Bind::visit(AST::Finally *) +{ + return true; +} + +bool Bind::visit(AST::FunctionDeclaration *) +{ + return true; +} + +bool Bind::visit(AST::FunctionExpression *) +{ + return true; +} + +bool Bind::visit(AST::FormalParameterList *) +{ + return true; +} + +bool Bind::visit(AST::FunctionBody *) +{ + return true; +} + +bool Bind::visit(AST::Program *) +{ + return true; +} + +bool Bind::visit(AST::SourceElements *) +{ + return true; +} + +bool Bind::visit(AST::FunctionSourceElement *) +{ + return true; +} + +bool Bind::visit(AST::StatementSourceElement *) +{ + return true; +} + +bool Bind::visit(AST::DebuggerStatement *) +{ + return true; +} diff --git a/src/libs/qmljs/qmljsbind.h b/src/libs/qmljs/qmljsbind.h new file mode 100644 index 0000000000000000000000000000000000000000..869c61ef780b66dd342ea4e0fd00b27fa836c365 --- /dev/null +++ b/src/libs/qmljs/qmljsbind.h @@ -0,0 +1,149 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** +**************************************************************************/ + +#ifndef QMLBIND_H +#define QMLBIND_H + +#include "parser/qmljsastvisitor_p.h" +#include "qmljsdocument.h" + +namespace QmlJS { + +class QMLJS_EXPORT Bind: protected AST::Visitor +{ +public: + Bind(); + virtual ~Bind(); + + void operator()(QmlJS::Document::Ptr doc); + +protected: + void accept(AST::Node *node); + + // Ui + virtual bool visit(AST::UiProgram *ast); + virtual bool visit(AST::UiImportList *ast); + virtual bool visit(AST::UiImport *ast); + virtual bool visit(AST::UiPublicMember *ast); + virtual bool visit(AST::UiSourceElement *ast); + virtual bool visit(AST::UiObjectDefinition *ast); + virtual bool visit(AST::UiObjectInitializer *ast); + virtual bool visit(AST::UiObjectBinding *ast); + virtual bool visit(AST::UiScriptBinding *ast); + virtual bool visit(AST::UiArrayBinding *ast); + virtual bool visit(AST::UiObjectMemberList *ast); + virtual bool visit(AST::UiArrayMemberList *ast); + virtual bool visit(AST::UiQualifiedId *ast); + virtual bool visit(AST::UiSignature *ast); + virtual bool visit(AST::UiFormalList *ast); + virtual bool visit(AST::UiFormal *ast); + + // QmlJS + virtual bool visit(AST::ThisExpression *ast); + virtual bool visit(AST::IdentifierExpression *ast); + virtual bool visit(AST::NullExpression *ast); + virtual bool visit(AST::TrueLiteral *ast); + virtual bool visit(AST::FalseLiteral *ast); + virtual bool visit(AST::StringLiteral *ast); + virtual bool visit(AST::NumericLiteral *ast); + virtual bool visit(AST::RegExpLiteral *ast); + virtual bool visit(AST::ArrayLiteral *ast); + virtual bool visit(AST::ObjectLiteral *ast); + virtual bool visit(AST::ElementList *ast); + virtual bool visit(AST::Elision *ast); + virtual bool visit(AST::PropertyNameAndValueList *ast); + virtual bool visit(AST::NestedExpression *ast); + virtual bool visit(AST::IdentifierPropertyName *ast); + virtual bool visit(AST::StringLiteralPropertyName *ast); + virtual bool visit(AST::NumericLiteralPropertyName *ast); + virtual bool visit(AST::ArrayMemberExpression *ast); + virtual bool visit(AST::FieldMemberExpression *ast); + virtual bool visit(AST::NewMemberExpression *ast); + virtual bool visit(AST::NewExpression *ast); + virtual bool visit(AST::CallExpression *ast); + virtual bool visit(AST::ArgumentList *ast); + virtual bool visit(AST::PostIncrementExpression *ast); + virtual bool visit(AST::PostDecrementExpression *ast); + virtual bool visit(AST::DeleteExpression *ast); + virtual bool visit(AST::VoidExpression *ast); + virtual bool visit(AST::TypeOfExpression *ast); + virtual bool visit(AST::PreIncrementExpression *ast); + virtual bool visit(AST::PreDecrementExpression *ast); + virtual bool visit(AST::UnaryPlusExpression *ast); + virtual bool visit(AST::UnaryMinusExpression *ast); + virtual bool visit(AST::TildeExpression *ast); + virtual bool visit(AST::NotExpression *ast); + virtual bool visit(AST::BinaryExpression *ast); + virtual bool visit(AST::ConditionalExpression *ast); + virtual bool visit(AST::Expression *ast); + virtual bool visit(AST::Block *ast); + virtual bool visit(AST::StatementList *ast); + virtual bool visit(AST::VariableStatement *ast); + virtual bool visit(AST::VariableDeclarationList *ast); + virtual bool visit(AST::VariableDeclaration *ast); + virtual bool visit(AST::EmptyStatement *ast); + virtual bool visit(AST::ExpressionStatement *ast); + virtual bool visit(AST::IfStatement *ast); + virtual bool visit(AST::DoWhileStatement *ast); + virtual bool visit(AST::WhileStatement *ast); + virtual bool visit(AST::ForStatement *ast); + virtual bool visit(AST::LocalForStatement *ast); + virtual bool visit(AST::ForEachStatement *ast); + virtual bool visit(AST::LocalForEachStatement *ast); + virtual bool visit(AST::ContinueStatement *ast); + virtual bool visit(AST::BreakStatement *ast); + virtual bool visit(AST::ReturnStatement *ast); + virtual bool visit(AST::WithStatement *ast); + virtual bool visit(AST::SwitchStatement *ast); + virtual bool visit(AST::CaseBlock *ast); + virtual bool visit(AST::CaseClauses *ast); + virtual bool visit(AST::CaseClause *ast); + virtual bool visit(AST::DefaultClause *ast); + virtual bool visit(AST::LabelledStatement *ast); + virtual bool visit(AST::ThrowStatement *ast); + virtual bool visit(AST::TryStatement *ast); + virtual bool visit(AST::Catch *ast); + virtual bool visit(AST::Finally *ast); + virtual bool visit(AST::FunctionDeclaration *ast); + virtual bool visit(AST::FunctionExpression *ast); + virtual bool visit(AST::FormalParameterList *ast); + virtual bool visit(AST::FunctionBody *ast); + virtual bool visit(AST::Program *ast); + virtual bool visit(AST::SourceElements *ast); + virtual bool visit(AST::FunctionSourceElement *ast); + virtual bool visit(AST::StatementSourceElement *ast); + virtual bool visit(AST::DebuggerStatement *ast); + +private: + QmlJS::Document::Ptr _doc; +}; + +} // end of namespace Qml + +#endif // QMLBIND_H diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp new file mode 100644 index 0000000000000000000000000000000000000000..888e81896a8a42db9c27631d05a48acf61e3bf07 --- /dev/null +++ b/src/libs/qmljs/qmljscheck.cpp @@ -0,0 +1,501 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** +**************************************************************************/ + +#include "qmljscheck.h" +#include "parser/qmljsast_p.h" + +using namespace QmlJS; + +Check::Check() +{ +} + +Check::~Check() +{ +} + +void Check::operator()(Document::Ptr doc) +{ + _doc = doc; +} + +void Check::accept(AST::Node *node) +{ + AST::Node::accept(node, this); +} + +bool Check::visit(AST::UiProgram *) +{ + return true; +} + +bool Check::visit(AST::UiImportList *) +{ + return true; +} + +bool Check::visit(AST::UiImport *) +{ + return true; +} + +bool Check::visit(AST::UiPublicMember *) +{ + return true; +} + +bool Check::visit(AST::UiSourceElement *) +{ + return true; +} + +bool Check::visit(AST::UiObjectDefinition *) +{ + return true; +} + +bool Check::visit(AST::UiObjectInitializer *) +{ + return true; +} + +bool Check::visit(AST::UiObjectBinding *) +{ + return true; +} + +bool Check::visit(AST::UiScriptBinding *) +{ + return true; +} + +bool Check::visit(AST::UiArrayBinding *) +{ + return true; +} + +bool Check::visit(AST::UiObjectMemberList *) +{ + return true; +} + +bool Check::visit(AST::UiArrayMemberList *) +{ + return true; +} + +bool Check::visit(AST::UiQualifiedId *) +{ + return true; +} + +bool Check::visit(AST::UiSignature *) +{ + return true; +} + +bool Check::visit(AST::UiFormalList *) +{ + return true; +} + +bool Check::visit(AST::UiFormal *) +{ + return true; +} + +bool Check::visit(AST::ThisExpression *) +{ + return true; +} + +bool Check::visit(AST::IdentifierExpression *) +{ + return true; +} + +bool Check::visit(AST::NullExpression *) +{ + return true; +} + +bool Check::visit(AST::TrueLiteral *) +{ + return true; +} + +bool Check::visit(AST::FalseLiteral *) +{ + return true; +} + +bool Check::visit(AST::StringLiteral *) +{ + return true; +} + +bool Check::visit(AST::NumericLiteral *) +{ + return true; +} + +bool Check::visit(AST::RegExpLiteral *) +{ + return true; +} + +bool Check::visit(AST::ArrayLiteral *) +{ + return true; +} + +bool Check::visit(AST::ObjectLiteral *) +{ + return true; +} + +bool Check::visit(AST::ElementList *) +{ + return true; +} + +bool Check::visit(AST::Elision *) +{ + return true; +} + +bool Check::visit(AST::PropertyNameAndValueList *) +{ + return true; +} + +bool Check::visit(AST::NestedExpression *) +{ + return true; +} + +bool Check::visit(AST::IdentifierPropertyName *) +{ + return true; +} + +bool Check::visit(AST::StringLiteralPropertyName *) +{ + return true; +} + +bool Check::visit(AST::NumericLiteralPropertyName *) +{ + return true; +} + +bool Check::visit(AST::ArrayMemberExpression *) +{ + return true; +} + +bool Check::visit(AST::FieldMemberExpression *) +{ + return true; +} + +bool Check::visit(AST::NewMemberExpression *) +{ + return true; +} + +bool Check::visit(AST::NewExpression *) +{ + return true; +} + +bool Check::visit(AST::CallExpression *) +{ + return true; +} + +bool Check::visit(AST::ArgumentList *) +{ + return true; +} + +bool Check::visit(AST::PostIncrementExpression *) +{ + return true; +} + +bool Check::visit(AST::PostDecrementExpression *) +{ + return true; +} + +bool Check::visit(AST::DeleteExpression *) +{ + return true; +} + +bool Check::visit(AST::VoidExpression *) +{ + return true; +} + +bool Check::visit(AST::TypeOfExpression *) +{ + return true; +} + +bool Check::visit(AST::PreIncrementExpression *) +{ + return true; +} + +bool Check::visit(AST::PreDecrementExpression *) +{ + return true; +} + +bool Check::visit(AST::UnaryPlusExpression *) +{ + return true; +} + +bool Check::visit(AST::UnaryMinusExpression *) +{ + return true; +} + +bool Check::visit(AST::TildeExpression *) +{ + return true; +} + +bool Check::visit(AST::NotExpression *) +{ + return true; +} + +bool Check::visit(AST::BinaryExpression *) +{ + return true; +} + +bool Check::visit(AST::ConditionalExpression *) +{ + return true; +} + +bool Check::visit(AST::Expression *) +{ + return true; +} + +bool Check::visit(AST::Block *) +{ + return true; +} + +bool Check::visit(AST::StatementList *) +{ + return true; +} + +bool Check::visit(AST::VariableStatement *) +{ + return true; +} + +bool Check::visit(AST::VariableDeclarationList *) +{ + return true; +} + +bool Check::visit(AST::VariableDeclaration *) +{ + return true; +} + +bool Check::visit(AST::EmptyStatement *) +{ + return true; +} + +bool Check::visit(AST::ExpressionStatement *) +{ + return true; +} + +bool Check::visit(AST::IfStatement *) +{ + return true; +} + +bool Check::visit(AST::DoWhileStatement *) +{ + return true; +} + +bool Check::visit(AST::WhileStatement *) +{ + return true; +} + +bool Check::visit(AST::ForStatement *) +{ + return true; +} + +bool Check::visit(AST::LocalForStatement *) +{ + return true; +} + +bool Check::visit(AST::ForEachStatement *) +{ + return true; +} + +bool Check::visit(AST::LocalForEachStatement *) +{ + return true; +} + +bool Check::visit(AST::ContinueStatement *) +{ + return true; +} + +bool Check::visit(AST::BreakStatement *) +{ + return true; +} + +bool Check::visit(AST::ReturnStatement *) +{ + return true; +} + +bool Check::visit(AST::WithStatement *) +{ + return true; +} + +bool Check::visit(AST::SwitchStatement *) +{ + return true; +} + +bool Check::visit(AST::CaseBlock *) +{ + return true; +} + +bool Check::visit(AST::CaseClauses *) +{ + return true; +} + +bool Check::visit(AST::CaseClause *) +{ + return true; +} + +bool Check::visit(AST::DefaultClause *) +{ + return true; +} + +bool Check::visit(AST::LabelledStatement *) +{ + return true; +} + +bool Check::visit(AST::ThrowStatement *) +{ + return true; +} + +bool Check::visit(AST::TryStatement *) +{ + return true; +} + +bool Check::visit(AST::Catch *) +{ + return true; +} + +bool Check::visit(AST::Finally *) +{ + return true; +} + +bool Check::visit(AST::FunctionDeclaration *) +{ + return true; +} + +bool Check::visit(AST::FunctionExpression *) +{ + return true; +} + +bool Check::visit(AST::FormalParameterList *) +{ + return true; +} + +bool Check::visit(AST::FunctionBody *) +{ + return true; +} + +bool Check::visit(AST::Program *) +{ + return true; +} + +bool Check::visit(AST::SourceElements *) +{ + return true; +} + +bool Check::visit(AST::FunctionSourceElement *) +{ + return true; +} + +bool Check::visit(AST::StatementSourceElement *) +{ + return true; +} + +bool Check::visit(AST::DebuggerStatement *) +{ + return true; +} diff --git a/src/libs/qmljs/qmljscheck.h b/src/libs/qmljs/qmljscheck.h new file mode 100644 index 0000000000000000000000000000000000000000..2d7352f151592325c381a0cb6437c50c361d323b --- /dev/null +++ b/src/libs/qmljs/qmljscheck.h @@ -0,0 +1,149 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** +**************************************************************************/ + +#ifndef QMLCHECK_H +#define QMLCHECK_H + +#include "parser/qmljsastvisitor_p.h" +#include "qmljsdocument.h" + +namespace QmlJS { + +class QMLJS_EXPORT Check: protected AST::Visitor +{ +public: + Check(); + virtual ~Check(); + + void operator()(QmlJS::Document::Ptr doc); + +protected: + void accept(AST::Node *node); + + // Ui + virtual bool visit(AST::UiProgram *ast); + virtual bool visit(AST::UiImportList *ast); + virtual bool visit(AST::UiImport *ast); + virtual bool visit(AST::UiPublicMember *ast); + virtual bool visit(AST::UiSourceElement *ast); + virtual bool visit(AST::UiObjectDefinition *ast); + virtual bool visit(AST::UiObjectInitializer *ast); + virtual bool visit(AST::UiObjectBinding *ast); + virtual bool visit(AST::UiScriptBinding *ast); + virtual bool visit(AST::UiArrayBinding *ast); + virtual bool visit(AST::UiObjectMemberList *ast); + virtual bool visit(AST::UiArrayMemberList *ast); + virtual bool visit(AST::UiQualifiedId *ast); + virtual bool visit(AST::UiSignature *ast); + virtual bool visit(AST::UiFormalList *ast); + virtual bool visit(AST::UiFormal *ast); + + // QmlJS + virtual bool visit(AST::ThisExpression *ast); + virtual bool visit(AST::IdentifierExpression *ast); + virtual bool visit(AST::NullExpression *ast); + virtual bool visit(AST::TrueLiteral *ast); + virtual bool visit(AST::FalseLiteral *ast); + virtual bool visit(AST::StringLiteral *ast); + virtual bool visit(AST::NumericLiteral *ast); + virtual bool visit(AST::RegExpLiteral *ast); + virtual bool visit(AST::ArrayLiteral *ast); + virtual bool visit(AST::ObjectLiteral *ast); + virtual bool visit(AST::ElementList *ast); + virtual bool visit(AST::Elision *ast); + virtual bool visit(AST::PropertyNameAndValueList *ast); + virtual bool visit(AST::NestedExpression *ast); + virtual bool visit(AST::IdentifierPropertyName *ast); + virtual bool visit(AST::StringLiteralPropertyName *ast); + virtual bool visit(AST::NumericLiteralPropertyName *ast); + virtual bool visit(AST::ArrayMemberExpression *ast); + virtual bool visit(AST::FieldMemberExpression *ast); + virtual bool visit(AST::NewMemberExpression *ast); + virtual bool visit(AST::NewExpression *ast); + virtual bool visit(AST::CallExpression *ast); + virtual bool visit(AST::ArgumentList *ast); + virtual bool visit(AST::PostIncrementExpression *ast); + virtual bool visit(AST::PostDecrementExpression *ast); + virtual bool visit(AST::DeleteExpression *ast); + virtual bool visit(AST::VoidExpression *ast); + virtual bool visit(AST::TypeOfExpression *ast); + virtual bool visit(AST::PreIncrementExpression *ast); + virtual bool visit(AST::PreDecrementExpression *ast); + virtual bool visit(AST::UnaryPlusExpression *ast); + virtual bool visit(AST::UnaryMinusExpression *ast); + virtual bool visit(AST::TildeExpression *ast); + virtual bool visit(AST::NotExpression *ast); + virtual bool visit(AST::BinaryExpression *ast); + virtual bool visit(AST::ConditionalExpression *ast); + virtual bool visit(AST::Expression *ast); + virtual bool visit(AST::Block *ast); + virtual bool visit(AST::StatementList *ast); + virtual bool visit(AST::VariableStatement *ast); + virtual bool visit(AST::VariableDeclarationList *ast); + virtual bool visit(AST::VariableDeclaration *ast); + virtual bool visit(AST::EmptyStatement *ast); + virtual bool visit(AST::ExpressionStatement *ast); + virtual bool visit(AST::IfStatement *ast); + virtual bool visit(AST::DoWhileStatement *ast); + virtual bool visit(AST::WhileStatement *ast); + virtual bool visit(AST::ForStatement *ast); + virtual bool visit(AST::LocalForStatement *ast); + virtual bool visit(AST::ForEachStatement *ast); + virtual bool visit(AST::LocalForEachStatement *ast); + virtual bool visit(AST::ContinueStatement *ast); + virtual bool visit(AST::BreakStatement *ast); + virtual bool visit(AST::ReturnStatement *ast); + virtual bool visit(AST::WithStatement *ast); + virtual bool visit(AST::SwitchStatement *ast); + virtual bool visit(AST::CaseBlock *ast); + virtual bool visit(AST::CaseClauses *ast); + virtual bool visit(AST::CaseClause *ast); + virtual bool visit(AST::DefaultClause *ast); + virtual bool visit(AST::LabelledStatement *ast); + virtual bool visit(AST::ThrowStatement *ast); + virtual bool visit(AST::TryStatement *ast); + virtual bool visit(AST::Catch *ast); + virtual bool visit(AST::Finally *ast); + virtual bool visit(AST::FunctionDeclaration *ast); + virtual bool visit(AST::FunctionExpression *ast); + virtual bool visit(AST::FormalParameterList *ast); + virtual bool visit(AST::FunctionBody *ast); + virtual bool visit(AST::Program *ast); + virtual bool visit(AST::SourceElements *ast); + virtual bool visit(AST::FunctionSourceElement *ast); + virtual bool visit(AST::StatementSourceElement *ast); + virtual bool visit(AST::DebuggerStatement *ast); + +private: + QmlJS::Document::Ptr _doc; +}; + +} // end of namespace Qml + +#endif // QMLCheck_H diff --git a/src/shared/qmljs/qmldocument.cpp b/src/libs/qmljs/qmljsdocument.cpp similarity index 60% rename from src/shared/qmljs/qmldocument.cpp rename to src/libs/qmljs/qmljsdocument.cpp index 2cd13a58d5ae1686162ae796b4e9be6ca4abb0dd..6768d0b23ef9aa816628dbeb3414bb0cde011671 100644 --- a/src/shared/qmljs/qmldocument.cpp +++ b/src/libs/qmljs/qmljsdocument.cpp @@ -27,21 +27,23 @@ ** **************************************************************************/ -#include "qmlidcollector.h" -#include "qmldocument.h" +#include "qmljsidcollector.h" +#include "qmljsdocument.h" #include <qmljs/parser/qmljsast_p.h> #include <qmljs/parser/qmljslexer_p.h> #include <qmljs/parser/qmljsparser_p.h> #include <qmljs/parser/qmljsnodepool_p.h> #include <qmljs/parser/qmljsastfwd_p.h> -using namespace Qml; using namespace QmlJS; +using namespace QmlJS; +using namespace QmlJS::AST; -QmlDocument::QmlDocument(const QString &fileName) +Document::Document(const QString &fileName) : _engine(0) , _pool(0) - , _program(0) + , _uiProgram(0) + , _jsProgram(0) , _fileName(fileName) , _parsedCorrectly(false) { @@ -53,7 +55,7 @@ QmlDocument::QmlDocument(const QString &fileName) _componentName = fileName.mid(slashIdx + 1, fileName.size() - (slashIdx + 1) - 4); } -QmlDocument::~QmlDocument() +Document::~Document() { if (_engine) delete _engine; @@ -64,37 +66,43 @@ QmlDocument::~QmlDocument() qDeleteAll(_symbols); } -QmlDocument::Ptr QmlDocument::create(const QString &fileName) +Document::Ptr Document::create(const QString &fileName) { - QmlDocument::Ptr doc(new QmlDocument(fileName)); + Document::Ptr doc(new Document(fileName)); return doc; } -AST::UiProgram *QmlDocument::program() const +AST::UiProgram *Document::qmlProgram() const +{ + return _uiProgram; +} + +AST::Program *Document::jsProgram() const { - return _program; + return _jsProgram; } -QList<DiagnosticMessage> QmlDocument::diagnosticMessages() const +QList<DiagnosticMessage> Document::diagnosticMessages() const { return _diagnosticMessages; } -QString QmlDocument::source() const +QString Document::source() const { return _source; } -void QmlDocument::setSource(const QString &source) +void Document::setSource(const QString &source) { _source = source; } -bool QmlDocument::parse() +bool Document::parseQml() { Q_ASSERT(! _engine); Q_ASSERT(! _pool); - Q_ASSERT(! _program); + Q_ASSERT(! _uiProgram); + Q_ASSERT(! _jsProgram); _engine = new Engine(); _pool = new NodePool(_fileName, _engine); @@ -106,15 +114,15 @@ bool QmlDocument::parse() lexer.setCode(_source, /*line = */ 1); _parsedCorrectly = parser.parse(); - _program = parser.ast(); + _uiProgram = parser.ast(); _diagnosticMessages = parser.diagnosticMessages(); - if (_program) { - for (QmlJS::AST::UiObjectMemberList *iter = _program->members; iter; iter = iter->next) + if (_uiProgram) { + for (QmlJS::AST::UiObjectMemberList *iter = _uiProgram->members; iter; iter = iter->next) if (iter->member) - _symbols.append(new QmlSymbolFromFile(_fileName, iter->member)); + _symbols.append(new SymbolFromFile(_fileName, iter->member)); - Internal::QmlIdCollector collect; + Internal::IdCollector collect; _ids = collect(*this); if (_diagnosticMessages.isEmpty()) _diagnosticMessages = collect.diagnosticMessages(); @@ -123,9 +131,32 @@ bool QmlDocument::parse() return _parsedCorrectly; } -QmlSymbolFromFile *QmlDocument::findSymbol(QmlJS::AST::Node *node) const +bool Document::parseJavaScript() { - foreach (QmlSymbol *symbol, _symbols) + Q_ASSERT(! _engine); + Q_ASSERT(! _pool); + Q_ASSERT(! _uiProgram); + Q_ASSERT(! _jsProgram); + + _engine = new Engine(); + _pool = new NodePool(_fileName, _engine); + _ids.clear(); + + Lexer lexer(_engine); + Parser parser(_engine); + + lexer.setCode(_source, /*line = */ 1); + + _parsedCorrectly = parser.parseProgram(); + _jsProgram = cast<Program*>(parser.rootNode()); + _diagnosticMessages = parser.diagnosticMessages(); + + return _parsedCorrectly; +} + +SymbolFromFile *Document::findSymbol(QmlJS::AST::Node *node) const +{ + foreach (Symbol *symbol, _symbols) if (symbol->isSymbolFromFile()) if (symbol->asSymbolFromFile()->node() == node) return symbol->asSymbolFromFile(); @@ -141,21 +172,19 @@ Snapshot::~Snapshot() { } -void Snapshot::insert(const QmlDocument::Ptr &document) +void Snapshot::insert(const Document::Ptr &document) { - if (!document || !document->program()) - return; - - QMap<QString, QmlDocument::Ptr>::insert(document->fileName(), document); + if (document && (document->qmlProgram() || document->jsProgram())) + QMap<QString, Document::Ptr>::insert(document->fileName(), document); } -QmlDocument::PtrList Snapshot::importedDocuments(const QmlDocument::Ptr &doc, const QString &importPath) const +Document::PtrList Snapshot::importedDocuments(const Document::Ptr &doc, const QString &importPath) const { - QmlDocument::PtrList result; + Document::PtrList result; const QString docPath = doc->path() + '/' + importPath; - foreach (QmlDocument::Ptr candidate, *this) { + foreach (Document::Ptr candidate, *this) { if (candidate == doc) continue; @@ -166,13 +195,13 @@ QmlDocument::PtrList Snapshot::importedDocuments(const QmlDocument::Ptr &doc, co return result; } -QMap<QString, QmlDocument::Ptr> Snapshot::componentsDefinedByImportedDocuments(const QmlDocument::Ptr &doc, const QString &importPath) const +QMap<QString, Document::Ptr> Snapshot::componentsDefinedByImportedDocuments(const Document::Ptr &doc, const QString &importPath) const { - QMap<QString, QmlDocument::Ptr> result; + QMap<QString, Document::Ptr> result; const QString docPath = doc->path() + '/' + importPath; - foreach (QmlDocument::Ptr candidate, *this) { + foreach (Document::Ptr candidate, *this) { if (candidate == doc) continue; diff --git a/src/shared/qmljs/qmldocument.h b/src/libs/qmljs/qmljsdocument.h similarity index 67% rename from src/shared/qmljs/qmldocument.h rename to src/libs/qmljs/qmljsdocument.h index 15edb168e7e3f96dfec51195907b23c7f9b42964..536558373213169d416c7d55f36e308b30cae55c 100644 --- a/src/shared/qmljs/qmldocument.h +++ b/src/libs/qmljs/qmljsdocument.h @@ -36,33 +36,35 @@ #include <QtCore/QString> #include "parser/qmljsengine_p.h" -#include "qml_global.h" -#include "qmlsymbol.h" +#include "qmljs_global.h" +#include "qmljssymbol.h" -namespace Qml { +namespace QmlJS { -class QML_EXPORT QmlDocument +class QMLJS_EXPORT Document { public: - typedef QSharedPointer<QmlDocument> Ptr; - typedef QList<QmlDocument::Ptr> PtrList; - typedef QMap<QString, Qml::QmlIdSymbol*> IdTable; + typedef QSharedPointer<Document> Ptr; + typedef QList<Document::Ptr> PtrList; + typedef QMap<QString, IdSymbol*> IdTable; protected: - QmlDocument(const QString &fileName); + Document(const QString &fileName); public: - ~QmlDocument(); + ~Document(); - static QmlDocument::Ptr create(const QString &fileName); + static Document::Ptr create(const QString &fileName); - QmlJS::AST::UiProgram *program() const; + QmlJS::AST::UiProgram *qmlProgram() const; + QmlJS::AST::Program *jsProgram() const; QList<QmlJS::DiagnosticMessage> diagnosticMessages() const; QString source() const; void setSource(const QString &source); - bool parse(); + bool parseQml(); + bool parseJavaScript(); bool isParsedCorrectly() const { return _parsedCorrectly; } @@ -73,14 +75,15 @@ public: QString path() const { return _path; } QString componentName() const { return _componentName; } - Qml::QmlSymbolFromFile *findSymbol(QmlJS::AST::Node *node) const; - Qml::QmlSymbol::List symbols() const + QmlJS::SymbolFromFile *findSymbol(QmlJS::AST::Node *node) const; + QmlJS::Symbol::List symbols() const { return _symbols; } private: QmlJS::Engine *_engine; QmlJS::NodePool *_pool; - QmlJS::AST::UiProgram *_program; + QmlJS::AST::UiProgram *_uiProgram; + QmlJS::AST::Program *_jsProgram; QList<QmlJS::DiagnosticMessage> _diagnosticMessages; QString _fileName; QString _path; @@ -88,22 +91,22 @@ private: QString _source; bool _parsedCorrectly; IdTable _ids; - Qml::QmlSymbol::List _symbols; + QmlJS::Symbol::List _symbols; }; -class QML_EXPORT Snapshot: public QMap<QString, QmlDocument::Ptr> +class QMLJS_EXPORT Snapshot: public QMap<QString, Document::Ptr> { public: Snapshot(); ~Snapshot(); - void insert(const QmlDocument::Ptr &document); + void insert(const Document::Ptr &document); - QmlDocument::Ptr document(const QString &fileName) const + Document::Ptr document(const QString &fileName) const { return value(fileName); } - QmlDocument::PtrList importedDocuments(const QmlDocument::Ptr &doc, const QString &importPath) const; - QMap<QString, QmlDocument::Ptr> componentsDefinedByImportedDocuments(const QmlDocument::Ptr &doc, const QString &importPath) const; + Document::PtrList importedDocuments(const Document::Ptr &doc, const QString &importPath) const; + QMap<QString, Document::Ptr> componentsDefinedByImportedDocuments(const Document::Ptr &doc, const QString &importPath) const; }; } // end of namespace Qml diff --git a/src/shared/qscripthighlighter/qscripthighlighter.cpp b/src/libs/qmljs/qmljshighlighter.cpp similarity index 84% rename from src/shared/qscripthighlighter/qscripthighlighter.cpp rename to src/libs/qmljs/qmljshighlighter.cpp index 61a9aa8ef41337a64ec98db454fa8629062545f2..ec94307f6c38e44e46ef3e97618e5b2a297891e9 100644 --- a/src/shared/qscripthighlighter/qscripthighlighter.cpp +++ b/src/libs/qmljs/qmljshighlighter.cpp @@ -27,12 +27,12 @@ ** **************************************************************************/ -#include "qscripthighlighter.h" +#include <qmljs/qmljshighlighter.h> #include <QtCore/QSet> #include <QtCore/QtAlgorithms> -using namespace SharedTools; +using namespace QmlJS; QScriptHighlighter::QScriptHighlighter(bool duiEnabled, QTextDocument *parent): QSyntaxHighlighter(parent), @@ -62,60 +62,60 @@ void QScriptHighlighter::highlightBlock(const QString &text) QTextCharFormat emptyFormat; int lastEnd = 0; - const QList<QScriptIncrementalScanner::Token> tokens = m_scanner.tokens(); + const QList<QmlJSScanner::Token> tokens = m_scanner.tokens(); for (int i = 0; i < tokens.size(); ++i) { - const QScriptIncrementalScanner::Token token = tokens.at(i); + const QmlJSScanner::Token token = tokens.at(i); if (token.offset != lastEnd) setFormat(lastEnd, token.offset - lastEnd, m_formats[VisualWhitespace]); switch (token.kind) { - case QScriptIncrementalScanner::Token::Keyword: + case QmlJSScanner::Token::Keyword: setFormat(token.offset, token.length, m_formats[KeywordFormat]); break; - case QScriptIncrementalScanner::Token::String: + case QmlJSScanner::Token::String: highlightWhitespace(token, text, StringFormat); break; - case QScriptIncrementalScanner::Token::Comment: + case QmlJSScanner::Token::Comment: highlightWhitespace(token, text, CommentFormat); break; - case QScriptIncrementalScanner::Token::Number: + case QmlJSScanner::Token::Number: highlightWhitespace(token, text, NumberFormat); break; - case QScriptIncrementalScanner::Token::LeftParenthesis: + case QmlJSScanner::Token::LeftParenthesis: onOpeningParenthesis('(', token.offset); break; - case QScriptIncrementalScanner::Token::RightParenthesis: + case QmlJSScanner::Token::RightParenthesis: onClosingParenthesis(')', token.offset); break; - case QScriptIncrementalScanner::Token::LeftBrace: + case QmlJSScanner::Token::LeftBrace: onOpeningParenthesis('{', token.offset); break; - case QScriptIncrementalScanner::Token::RightBrace: + case QmlJSScanner::Token::RightBrace: onClosingParenthesis('}', token.offset); break; - case QScriptIncrementalScanner::Token::LeftBracket: + case QmlJSScanner::Token::LeftBracket: onOpeningParenthesis('[', token.offset); break; - case QScriptIncrementalScanner::Token::RightBracket: + case QmlJSScanner::Token::RightBracket: onClosingParenthesis(']', token.offset); break; - case QScriptIncrementalScanner::Token::Identifier: - if (m_duiEnabled && (i + 1 != tokens.size()) && tokens.at(i + 1).kind == QScriptIncrementalScanner::Token::Colon) { + case QmlJSScanner::Token::Identifier: + if (m_duiEnabled && (i + 1 != tokens.size()) && tokens.at(i + 1).kind == QmlJSScanner::Token::Colon) { int j = i; for (; j != -1; --j) { - const QScriptIncrementalScanner::Token &tok = tokens.at(j); - if (tok.is(QScriptIncrementalScanner::Token::Dot) || tok.is(QScriptIncrementalScanner::Token::Identifier)) { + const QmlJSScanner::Token &tok = tokens.at(j); + if (tok.is(QmlJSScanner::Token::Dot) || tok.is(QmlJSScanner::Token::Identifier)) { setFormat(tok.offset, tok.length, m_formats[LabelFormat]); } else { break; @@ -131,15 +131,15 @@ void QScriptHighlighter::highlightBlock(const QString &text) } break; - case QScriptIncrementalScanner::Token::Colon: - if (m_duiEnabled && i > 0 && tokens.at(i - 1).kind == QScriptIncrementalScanner::Token::Identifier) + case QmlJSScanner::Token::Colon: + if (m_duiEnabled && i > 0 && tokens.at(i - 1).kind == QmlJSScanner::Token::Identifier) setFormat(token.offset, token.length, m_formats[LabelFormat]); else setFormat(token.offset, token.length, emptyFormat); break; - case QScriptIncrementalScanner::Token::Operator: - case QScriptIncrementalScanner::Token::Dot: + case QmlJSScanner::Token::Operator: + case QmlJSScanner::Token::Dot: setFormat(token.offset, token.length, emptyFormat); break; @@ -247,7 +247,7 @@ void QScriptHighlighter::onOpeningParenthesis(QChar, int) {} void QScriptHighlighter::onClosingParenthesis(QChar, int) {} void QScriptHighlighter::onBlockEnd(int state, int) { return setCurrentBlockState(state); } -void QScriptHighlighter::highlightWhitespace(const QScriptIncrementalScanner::Token &token, const QString &text, int nonWhitespaceFormat) +void QScriptHighlighter::highlightWhitespace(const QmlJSScanner::Token &token, const QString &text, int nonWhitespaceFormat) { const QTextCharFormat normalFormat = m_formats[nonWhitespaceFormat]; const QTextCharFormat visualSpaceFormat = m_formats[VisualWhitespace]; diff --git a/src/shared/qscripthighlighter/qscripthighlighter.h b/src/libs/qmljs/qmljshighlighter.h similarity index 88% rename from src/shared/qscripthighlighter/qscripthighlighter.h rename to src/libs/qmljs/qmljshighlighter.h index cc5f9c7dd08c114b774cb2e55f60ce5183900608..3655fc7d92553a77729afd84de087e7cd613b16a 100644 --- a/src/shared/qscripthighlighter/qscripthighlighter.h +++ b/src/libs/qmljs/qmljshighlighter.h @@ -30,15 +30,15 @@ #ifndef QSCRIPTSYNTAXHIGHLIGHTER_H #define QSCRIPTSYNTAXHIGHLIGHTER_H -#include <qscripthighlighter/qscriptincrementalscanner.h> +#include <qmljs/qmljsscanner.h> #include <QtCore/QVector> #include <QtCore/QSet> #include <QtGui/QSyntaxHighlighter> -namespace SharedTools { +namespace QmlJS { -class QScriptHighlighter : public QSyntaxHighlighter +class QMLJS_EXPORT QScriptHighlighter : public QSyntaxHighlighter { Q_OBJECT public: @@ -69,16 +69,16 @@ protected: // sets the enriched user state, or simply calls setCurrentBlockState(state); virtual void onBlockEnd(int state, int firstNonSpace); - virtual void highlightWhitespace(const QScriptIncrementalScanner::Token &token, const QString &text, int nonWhitespaceFormat); + virtual void highlightWhitespace(const QmlJSScanner::Token &token, const QString &text, int nonWhitespaceFormat); protected: - QScriptIncrementalScanner m_scanner; + QmlJSScanner m_scanner; private: bool m_duiEnabled; QTextCharFormat m_formats[NumFormats]; }; -} // namespace SharedTools +} // namespace QmlJS #endif // QSCRIPTSYNTAXHIGHLIGHTER_H diff --git a/src/shared/qmljs/qmlidcollector.cpp b/src/libs/qmljs/qmljsidcollector.cpp similarity index 73% rename from src/shared/qmljs/qmlidcollector.cpp rename to src/libs/qmljs/qmljsidcollector.cpp index c45e9089acebcb89c154f7f31f811d84e9bae789..788510cbff3b3e194946de6cc2c6dd413db687ea 100644 --- a/src/shared/qmljs/qmlidcollector.cpp +++ b/src/libs/qmljs/qmljsidcollector.cpp @@ -31,49 +31,49 @@ #include <qmljs/parser/qmljsast_p.h> -#include "qmlidcollector.h" +#include "qmljsidcollector.h" using namespace QmlJS; using namespace QmlJS::AST; -using namespace Qml; -using namespace Qml::Internal; +using namespace QmlJS; +using namespace QmlJS::Internal; -QMap<QString, QmlIdSymbol*> QmlIdCollector::operator()(Qml::QmlDocument &doc) +QMap<QString, IdSymbol*> IdCollector::operator()(QmlJS::Document &doc) { _doc = &doc; _ids.clear(); _currentSymbol = 0; - Node::accept(doc.program(), this); + Node::accept(doc.qmlProgram(), this); return _ids; } -bool QmlIdCollector::visit(UiArrayBinding *ast) +bool IdCollector::visit(UiArrayBinding *ast) { - QmlSymbolFromFile *oldSymbol = switchSymbol(ast); + SymbolFromFile *oldSymbol = switchSymbol(ast); Node::accept(ast->members, this); _currentSymbol = oldSymbol; return false; } -bool QmlIdCollector::visit(QmlJS::AST::UiObjectBinding *ast) +bool IdCollector::visit(QmlJS::AST::UiObjectBinding *ast) { - QmlSymbolFromFile *oldSymbol = switchSymbol(ast); + SymbolFromFile *oldSymbol = switchSymbol(ast); Node::accept(ast->initializer, this); _currentSymbol = oldSymbol; return false; } -bool QmlIdCollector::visit(QmlJS::AST::UiObjectDefinition *ast) +bool IdCollector::visit(QmlJS::AST::UiObjectDefinition *ast) { - QmlSymbolFromFile *oldSymbol = switchSymbol(ast); + SymbolFromFile *oldSymbol = switchSymbol(ast); Node::accept(ast->initializer, this); _currentSymbol = oldSymbol; return false; } -bool QmlIdCollector::visit(QmlJS::AST::UiScriptBinding *ast) +bool IdCollector::visit(QmlJS::AST::UiScriptBinding *ast) { if (!(ast->qualifiedId->next) && ast->qualifiedId->name->asString() == "id") if (ExpressionStatement *e = cast<ExpressionStatement*>(ast->statement)) @@ -84,9 +84,9 @@ bool QmlIdCollector::visit(QmlJS::AST::UiScriptBinding *ast) return false; } -QmlSymbolFromFile *QmlIdCollector::switchSymbol(QmlJS::AST::UiObjectMember *node) +SymbolFromFile *IdCollector::switchSymbol(QmlJS::AST::UiObjectMember *node) { - QmlSymbolFromFile *newSymbol = 0; + SymbolFromFile *newSymbol = 0; if (_currentSymbol == 0) { newSymbol = _doc->findSymbol(node); @@ -94,7 +94,7 @@ QmlSymbolFromFile *QmlIdCollector::switchSymbol(QmlJS::AST::UiObjectMember *node newSymbol = _currentSymbol->findMember(node); } - QmlSymbolFromFile *oldSymbol = _currentSymbol; + SymbolFromFile *oldSymbol = _currentSymbol; if (newSymbol) { _currentSymbol = newSymbol; @@ -106,7 +106,7 @@ QmlSymbolFromFile *QmlIdCollector::switchSymbol(QmlJS::AST::UiObjectMember *node return oldSymbol; } -void QmlIdCollector::addId(const QString &id, QmlJS::AST::UiScriptBinding *ast) +void IdCollector::addId(const QString &id, QmlJS::AST::UiScriptBinding *ast) { if (!_currentSymbol) return; @@ -114,8 +114,8 @@ void QmlIdCollector::addId(const QString &id, QmlJS::AST::UiScriptBinding *ast) if (_ids.contains(id)) { _diagnosticMessages.append(DiagnosticMessage(DiagnosticMessage::Warning, ast->statement->firstSourceLocation(), "Duplicate ID")); } else { - if (QmlSymbolFromFile *symbol = _currentSymbol->findMember(ast)) - if (QmlIdSymbol *idSymbol = symbol->asIdSymbol()) + if (SymbolFromFile *symbol = _currentSymbol->findMember(ast)) + if (IdSymbol *idSymbol = symbol->asIdSymbol()) _ids[id] = idSymbol; } } diff --git a/src/shared/qmljs/qmlidcollector.h b/src/libs/qmljs/qmljsidcollector.h similarity index 66% rename from src/shared/qmljs/qmlidcollector.h rename to src/libs/qmljs/qmljsidcollector.h index 310959c240434683799c43cabcc6e5b805b1ea73..fbf520938e8ae632db2f67b224230aac264c5a9b 100644 --- a/src/shared/qmljs/qmlidcollector.h +++ b/src/libs/qmljs/qmljsidcollector.h @@ -32,40 +32,40 @@ #include <qmljs/parser/qmljsastvisitor_p.h> #include <qmljs/parser/qmljsengine_p.h> -#include <qmljs/qmldocument.h> -#include <qmljs/qmlsymbol.h> +#include <qmljs/qmljsdocument.h> +#include <qmljs/qmljssymbol.h> #include <QMap> #include <QPair> #include <QStack> #include <QString> -namespace Qml { +namespace QmlJS { namespace Internal { -class QML_EXPORT QmlIdCollector: protected QmlJS::AST::Visitor +class QMLJS_EXPORT IdCollector: protected AST::Visitor { public: - QMap<QString, Qml::QmlIdSymbol*> operator()(Qml::QmlDocument &doc); + QMap<QString, IdSymbol*> operator()(Document &doc); - QList<QmlJS::DiagnosticMessage> diagnosticMessages() + QList<DiagnosticMessage> diagnosticMessages() { return _diagnosticMessages; } protected: - virtual bool visit(QmlJS::AST::UiArrayBinding *ast); - virtual bool visit(QmlJS::AST::UiObjectBinding *ast); - virtual bool visit(QmlJS::AST::UiObjectDefinition *ast); - virtual bool visit(QmlJS::AST::UiScriptBinding *ast); + virtual bool visit(AST::UiArrayBinding *ast); + virtual bool visit(AST::UiObjectBinding *ast); + virtual bool visit(AST::UiObjectDefinition *ast); + virtual bool visit(AST::UiScriptBinding *ast); private: - Qml::QmlSymbolFromFile *switchSymbol(QmlJS::AST::UiObjectMember *node); - void addId(const QString &id, QmlJS::AST::UiScriptBinding *ast); + SymbolFromFile *switchSymbol(AST::UiObjectMember *node); + void addId(const QString &id, AST::UiScriptBinding *ast); private: - Qml::QmlDocument *_doc; - QMap<QString, Qml::QmlIdSymbol*> _ids; - Qml::QmlSymbolFromFile *_currentSymbol; - QList<QmlJS::DiagnosticMessage> _diagnosticMessages; + Document *_doc; + QMap<QString, IdSymbol*> _ids; + SymbolFromFile *_currentSymbol; + QList<DiagnosticMessage> _diagnosticMessages; }; } // namespace Internal diff --git a/src/shared/qscripthighlighter/qscriptindenter.cpp b/src/libs/qmljs/qmljsindenter.cpp similarity index 85% rename from src/shared/qscripthighlighter/qscriptindenter.cpp rename to src/libs/qmljs/qmljsindenter.cpp index 0abaf574dc92e0c9cd0cd61f0174db29d40f7d73..dc5407c8c9361bc1116e91d4d7ad9d6cf4dbfaba 100644 --- a/src/shared/qscripthighlighter/qscriptindenter.cpp +++ b/src/libs/qmljs/qmljsindenter.cpp @@ -65,11 +65,12 @@ as comments and string literals are removed beforehand. */ -#include "qscriptindenter.h" -#include "qscriptincrementalscanner.h" +#include <qmljs/qmljsindenter.h> +#include <qmljs/qmljsscanner.h> + #include <QtDebug> -using namespace SharedTools; +using namespace QmlJS; /* The indenter avoids getting stuck in almost infinite loops by @@ -79,10 +80,10 @@ using namespace SharedTools; For example, the indenter never considers more than BigRoof lines backwards when looking for the start of a C-style comment. */ -const int QScriptIndenter::SmallRoof = 40; -const int QScriptIndenter::BigRoof = 400; +const int QmlJSIndenter::SmallRoof = 40; +const int QmlJSIndenter::BigRoof = 400; -QScriptIndenter::QScriptIndenter() +QmlJSIndenter::QmlJSIndenter() : label(QRegExp(QLatin1String("^\\s*((?:case\\b([^:])+|[a-zA-Z_0-9.]+)(?:\\s+)?:)(?!:)"))), braceX(QRegExp(QLatin1String("^\\s*\\}\\s*(?:else|catch)\\b"))), iflikeKeyword(QRegExp(QLatin1String("\\b(?:catch|do|for|if|while|with)\\b"))) @@ -120,16 +121,16 @@ QScriptIndenter::QScriptIndenter() yyLeftBraceFollows = 0; } -QScriptIndenter::~QScriptIndenter() +QmlJSIndenter::~QmlJSIndenter() { } -void QScriptIndenter::setTabSize(int size) +void QmlJSIndenter::setTabSize(int size) { ppHardwareTabSize = size; } -void QScriptIndenter::setIndentSize(int size) +void QmlJSIndenter::setIndentSize(int size) { ppIndentSize = size; ppContinuationIndentSize = 2 * size; @@ -139,7 +140,7 @@ void QScriptIndenter::setIndentSize(int size) Returns the first non-space character in the string t, or QChar() if the string is made only of white space. */ -QChar QScriptIndenter::firstNonWhiteSpace(const QString &t) const +QChar QmlJSIndenter::firstNonWhiteSpace(const QString &t) const { int i = 0; while (i < t.length()) { @@ -154,7 +155,7 @@ QChar QScriptIndenter::firstNonWhiteSpace(const QString &t) const Returns true if string t is made only of white space; otherwise returns false. */ -bool QScriptIndenter::isOnlyWhiteSpace(const QString &t) const +bool QmlJSIndenter::isOnlyWhiteSpace(const QString &t) const { return firstNonWhiteSpace(t).isNull(); } @@ -164,7 +165,7 @@ bool QScriptIndenter::isOnlyWhiteSpace(const QString &t) const index. Column numbers and index are identical for strings that don't contain '\t's. */ -int QScriptIndenter::columnForIndex(const QString &t, int index) const +int QmlJSIndenter::columnForIndex(const QString &t, int index) const { int col = 0; if (index > t.length()) @@ -183,7 +184,7 @@ int QScriptIndenter::columnForIndex(const QString &t, int index) const /* Returns the indentation size of string t. */ -int QScriptIndenter::indentOfLine(const QString &t) const +int QmlJSIndenter::indentOfLine(const QString &t) const { return columnForIndex(t, t.indexOf(firstNonWhiteSpace(t))); } @@ -194,7 +195,7 @@ int QScriptIndenter::indentOfLine(const QString &t) const provisions are taken against '\n' or '\r', which shouldn't occur in t anyway. */ -void QScriptIndenter::eraseChar(QString &t, int k, QChar ch) const +void QmlJSIndenter::eraseChar(QString &t, int k, QChar ch) const { if (t.at(k) != QLatin1Char('\t')) t[k] = ch; @@ -204,9 +205,9 @@ void QScriptIndenter::eraseChar(QString &t, int k, QChar ch) const Removes some nefast constructs from a code line and returns the resulting line. */ -QString QScriptIndenter::trimmedCodeLine(const QString &t) +QString QmlJSIndenter::trimmedCodeLine(const QString &t) { - QScriptIncrementalScanner scanner; + QmlJSScanner scanner; QTextBlock currentLine = yyLinizerState.iter; int startState = qMax(0, currentLine.previous().userState()) & 0xff; @@ -214,14 +215,14 @@ QString QScriptIndenter::trimmedCodeLine(const QString &t) yyLinizerState.tokens = scanner(t, startState); QString trimmed; int previousTokenEnd = 0; - foreach (const QScriptIncrementalScanner::Token &token, yyLinizerState.tokens) { + foreach (const QmlJSScanner::Token &token, yyLinizerState.tokens) { trimmed.append(t.midRef(previousTokenEnd, token.begin() - previousTokenEnd)); - if (token.is(QScriptIncrementalScanner::Token::String)) { + if (token.is(QmlJSScanner::Token::String)) { for (int i = 0; i < token.length; ++i) trimmed.append(QLatin1Char('X')); - } else if (token.is(QScriptIncrementalScanner::Token::Comment)) { + } else if (token.is(QmlJSScanner::Token::Comment)) { for (int i = 0; i < token.length; ++i) trimmed.append(QLatin1Char(' ')); @@ -234,43 +235,43 @@ QString QScriptIndenter::trimmedCodeLine(const QString &t) int index = yyLinizerState.tokens.size() - 1; for (; index != -1; --index) { - const QScriptIncrementalScanner::Token &token = yyLinizerState.tokens.at(index); - if (token.isNot(QScriptIncrementalScanner::Token::Comment)) + const QmlJSScanner::Token &token = yyLinizerState.tokens.at(index); + if (token.isNot(QmlJSScanner::Token::Comment)) break; } bool isBinding = false; - foreach (const QScriptIncrementalScanner::Token &token, yyLinizerState.tokens) { - if (token.is(QScriptIncrementalScanner::Token::Colon)) { + foreach (const QmlJSScanner::Token &token, yyLinizerState.tokens) { + if (token.is(QmlJSScanner::Token::Colon)) { isBinding = true; break; } } if (index != -1) { - const QScriptIncrementalScanner::Token &last = yyLinizerState.tokens.at(index); + const QmlJSScanner::Token &last = yyLinizerState.tokens.at(index); switch (last.kind) { - case QScriptIncrementalScanner::Token::LeftParenthesis: - case QScriptIncrementalScanner::Token::LeftBrace: - case QScriptIncrementalScanner::Token::Semicolon: - case QScriptIncrementalScanner::Token::Operator: + case QmlJSScanner::Token::LeftParenthesis: + case QmlJSScanner::Token::LeftBrace: + case QmlJSScanner::Token::Semicolon: + case QmlJSScanner::Token::Operator: break; - case QScriptIncrementalScanner::Token::RightParenthesis: - case QScriptIncrementalScanner::Token::RightBrace: + case QmlJSScanner::Token::RightParenthesis: + case QmlJSScanner::Token::RightBrace: if (isBinding) trimmed.append(QLatin1Char(';')); break; - case QScriptIncrementalScanner::Token::Colon: - case QScriptIncrementalScanner::Token::LeftBracket: - case QScriptIncrementalScanner::Token::RightBracket: + case QmlJSScanner::Token::Colon: + case QmlJSScanner::Token::LeftBracket: + case QmlJSScanner::Token::RightBracket: trimmed.append(QLatin1Char(';')); break; - case QScriptIncrementalScanner::Token::Identifier: - case QScriptIncrementalScanner::Token::Keyword: + case QmlJSScanner::Token::Identifier: + case QmlJSScanner::Token::Keyword: if (t.midRef(last.offset, last.length) != QLatin1String("else")) trimmed.append(QLatin1Char(';')); break; @@ -288,7 +289,7 @@ QString QScriptIndenter::trimmedCodeLine(const QString &t) Returns '(' if the last parenthesis is opening, ')' if it is closing, and QChar() if there are no parentheses in t. */ -QChar QScriptIndenter::lastParen(const QString &t) const +QChar QmlJSIndenter::lastParen(const QString &t) const { int i = t.length(); while (i > 0) { @@ -303,7 +304,7 @@ QChar QScriptIndenter::lastParen(const QString &t) const Returns true if typedIn the same as okayCh or is null; otherwise returns false. */ -bool QScriptIndenter::okay(QChar typedIn, QChar okayCh) const +bool QmlJSIndenter::okay(QChar typedIn, QChar okayCh) const { return typedIn == QChar() || typedIn == okayCh; } @@ -320,7 +321,7 @@ bool QScriptIndenter::okay(QChar typedIn, QChar okayCh) const accordingly. yyLine is cleaned from comments and other damageable constructs. Empty lines are skipped. */ -bool QScriptIndenter::readLine() +bool QmlJSIndenter::readLine() { int k; @@ -394,7 +395,7 @@ bool QScriptIndenter::readLine() Resets the linizer to its initial state, with yyLine containing the line above the bottom line of the program. */ -void QScriptIndenter::startLinizer() +void QmlJSIndenter::startLinizer() { yyLinizerState.braceDepth = 0; yyLinizerState.pendingRightBrace = false; @@ -414,7 +415,7 @@ void QScriptIndenter::startLinizer() potentially the whole line) is part of a C-style comment; otherwise returns false. */ -bool QScriptIndenter::bottomLineStartsInMultilineComment() +bool QmlJSIndenter::bottomLineStartsInMultilineComment() { QTextBlock currentLine = yyProgram.lastBlock().previous(); QTextBlock previousLine = currentLine.previous(); @@ -434,7 +435,7 @@ bool QScriptIndenter::bottomLineStartsInMultilineComment() Essentially, we're trying to align against some text on the previous line. */ -int QScriptIndenter::indentWhenBottomLineStartsInMultiLineComment() +int QmlJSIndenter::indentWhenBottomLineStartsInMultiLineComment() { QTextBlock block = yyProgram.lastBlock().previous(); QString blockText; @@ -467,42 +468,86 @@ int QScriptIndenter::indentWhenBottomLineStartsInMultiLineComment() if (x) y; */ -bool QScriptIndenter::matchBracelessControlStatement() +bool QmlJSIndenter::matchBracelessControlStatement() { int delimDepth = 0; - if (yyLine->endsWith(QLatin1String("else"))) - return true; + if (! yyLinizerState.tokens.isEmpty()) { + const QmlJSScanner::Token &tk = yyLinizerState.tokens.last(); - if (!yyLine->endsWith(QLatin1String(")"))) - return false; + if (tk.is(QmlJSScanner::Token::Identifier) && + yyLinizerState.line.midRef(tk.offset, tk.length) == QLatin1String("else")) + return true; + + else if (tk.isNot(QmlJSScanner::Token::RightParenthesis)) + return false; + } for (int i = 0; i < SmallRoof; i++) { - int j = yyLine->length(); - while (j > 0) { - j--; - QChar ch = yyLine->at(j); + for (int tokenIndex = yyLinizerState.tokens.size() - 1; tokenIndex != -1; --tokenIndex) { + const QmlJSScanner::Token &token = yyLinizerState.tokens.at(tokenIndex); - switch (ch.unicode()) { - case ')': - delimDepth++; + switch (token.kind) { + default: break; - case '(': - delimDepth--; - if (delimDepth == 0) { - if (yyLine->indexOf(iflikeKeyword) != -1) { + + case QmlJSScanner::Token::RightParenthesis: + ++delimDepth; + break; + + case QmlJSScanner::Token::LeftBrace: + case QmlJSScanner::Token::RightBrace: + case QmlJSScanner::Token::Semicolon: + /* + We met a statement separator, but not where we + expected it. What follows is probably a weird + continuation line. Be careful with ';' in for, + though. + */ + if (token.kind != QmlJSScanner::Token::Semicolon || delimDepth == 0) + return false; + + + case QmlJSScanner::Token::LeftParenthesis: + --delimDepth; + + if (delimDepth == 0 && tokenIndex > 0) { + const QmlJSScanner::Token &tk = yyLinizerState.tokens.at(tokenIndex - 1); + + if (tk.is(QmlJSScanner::Token::Identifier)) { + const QStringRef tokenText = yyLinizerState.line.midRef(tk.offset, tk.length); + /* We have - if (x) + if-like (x) y "if (x)" is not part of the statement "y". */ - return true; + + + if (tk.length == 5 && tokenText == QLatin1String("catch")) + return true; + + else if (tk.length == 2 && tokenText == QLatin1String("do")) + return true; + + else if (tk.length == 3 && tokenText == QLatin1String("for")) + return true; + + else if (tk.length == 2 && tokenText == QLatin1String("if")) + return true; + + else if (tk.length == 5 && tokenText == QLatin1String("while")) + return true; + + else if (tk.length == 4 && tokenText == QLatin1String("with")) + return true; } } + if (delimDepth == -1) { /* We have @@ -518,23 +563,14 @@ bool QScriptIndenter::matchBracelessControlStatement() return false; } break; - case '{': - case '}': - case ';': - /* - We met a statement separator, but not where we - expected it. What follows is probably a weird - continuation line. Be careful with ';' in for, - though. - */ - if (ch != QLatin1Char(';') || delimDepth == 0) - return false; - } + + } // end of switch } - if (!readLine()) + if (! readLine()) break; } + return false; } @@ -552,7 +588,7 @@ bool QScriptIndenter::matchBracelessControlStatement() f + // unfinished continuation line g; // continuation line */ -bool QScriptIndenter::isUnfinishedLine() +bool QmlJSIndenter::isUnfinishedLine() { bool unf = false; @@ -599,7 +635,7 @@ bool QScriptIndenter::isUnfinishedLine() Returns true if yyLine is a continuation line; otherwise returns false. */ -bool QScriptIndenter::isContinuationLine() +bool QmlJSIndenter::isContinuationLine() { bool cont = false; @@ -618,7 +654,7 @@ bool QScriptIndenter::isContinuationLine() or other bracked left opened on a previous line, or some interesting operator such as '='. */ -int QScriptIndenter::indentForContinuationLine() +int QmlJSIndenter::indentForContinuationLine() { int braceDepth = 0; int delimDepth = 0; @@ -862,7 +898,7 @@ int QScriptIndenter::indentForContinuationLine() accommodate people with irregular indentation schemes. A hook line near at hand is much more reliable than a remote one. */ -int QScriptIndenter::indentForStandaloneLine() +int QmlJSIndenter::indentForStandaloneLine() { for (int i = 0; i < SmallRoof; i++) { if (!*yyLeftBraceFollows) { @@ -947,7 +983,7 @@ int QScriptIndenter::indentForStandaloneLine() slighly more liberal if typedIn is always null. The user might be annoyed by the liberal behavior. */ -int QScriptIndenter::indentForBottomLine(QTextBlock begin, QTextBlock end, QChar typedIn) +int QmlJSIndenter::indentForBottomLine(QTextBlock begin, QTextBlock end, QChar typedIn) { if (begin == end) return 0; diff --git a/src/shared/qscripthighlighter/qscriptindenter.h b/src/libs/qmljs/qmljsindenter.h similarity index 91% rename from src/shared/qscripthighlighter/qscriptindenter.h rename to src/libs/qmljs/qmljsindenter.h index 6bb0296c5a4f7b6d3a86d36d7319607157735cdc..d880a1a39395bf8dfd31c739f0ae9d55ce0bfd32 100644 --- a/src/shared/qscripthighlighter/qscriptindenter.h +++ b/src/libs/qmljs/qmljsindenter.h @@ -27,23 +27,25 @@ ** **************************************************************************/ -#ifndef QTSCRIPTINDENTER_H -#define QTSCRIPTINDENTER_H +#ifndef QMLJSINDENTER_H +#define QMLJSINDENTER_H + +#include <qmljs/qmljs_global.h> +#include <qmljs/qmljsscanner.h> -#include <qscripthighlighter/qscriptincrementalscanner.h> #include <QtCore/QRegExp> #include <QtCore/QStringList> #include <QtGui/QTextBlock> -namespace SharedTools { +namespace QmlJS { -class QScriptIndenter +class QMLJS_EXPORT QmlJSIndenter { - Q_DISABLE_COPY(QScriptIndenter) + Q_DISABLE_COPY(QmlJSIndenter) public: - QScriptIndenter(); - ~QScriptIndenter(); + QmlJSIndenter(); + ~QmlJSIndenter(); void setTabSize(int size); void setIndentSize(int size); @@ -101,7 +103,7 @@ private: bool leftBraceFollows; bool pendingRightBrace; QString line; - QList<QScriptIncrementalScanner::Token> tokens; + QList<QmlJSScanner::Token> tokens; QTextBlock iter; }; @@ -132,7 +134,7 @@ private: QRegExp iflikeKeyword; }; -} // namespace SharedTools +} // namespace QmlJS -#endif // QTSCRIPTINDENTER_H +#endif // QMLJSINDENTER_H diff --git a/src/shared/qmljs/QmlMetaTypeBackend.cpp b/src/libs/qmljs/qmljsmetatypebackend.cpp similarity index 87% rename from src/shared/qmljs/QmlMetaTypeBackend.cpp rename to src/libs/qmljs/qmljsmetatypebackend.cpp index 9c4ee0defdfc77df82715f60d259f16d292f339c..374bb304aee2f5ad37a494e1e8dd1f2de8d596cb 100644 --- a/src/shared/qmljs/QmlMetaTypeBackend.cpp +++ b/src/libs/qmljs/qmljsmetatypebackend.cpp @@ -27,17 +27,17 @@ ** **************************************************************************/ -#include "QmlMetaTypeBackend.h" -#include "qmltypesystem.h" +#include "qmljsmetatypebackend.h" +#include "qmljstypesystem.h" -using namespace Qml; +using namespace QmlJS; -QmlMetaTypeBackend::QmlMetaTypeBackend(QmlTypeSystem *typeSystem): +MetaTypeBackend::MetaTypeBackend(TypeSystem *typeSystem): m_typeSystem(typeSystem) { Q_ASSERT(typeSystem); } -QmlMetaTypeBackend::~QmlMetaTypeBackend() +MetaTypeBackend::~MetaTypeBackend() { } diff --git a/src/shared/qmljs/QmlMetaTypeBackend.h b/src/libs/qmljs/qmljsmetatypebackend.h similarity index 72% rename from src/shared/qmljs/QmlMetaTypeBackend.h rename to src/libs/qmljs/qmljsmetatypebackend.h index 37f835449a05bcfe31bcd62cd942cef52ee84299..d21a105df15fbc1244c0f70c0ad0b3207ca841f3 100644 --- a/src/shared/qmljs/QmlMetaTypeBackend.h +++ b/src/libs/qmljs/qmljsmetatypebackend.h @@ -30,29 +30,29 @@ #ifndef QMLMETATYPEBACKEND_H #define QMLMETATYPEBACKEND_H -#include <qmljs/qml_global.h> -#include <qmljs/qmlpackageinfo.h> -#include <qmljs/qmlsymbol.h> +#include <qmljs/qmljs_global.h> +#include <qmljs/qmljspackageinfo.h> +#include <qmljs/qmljssymbol.h> -namespace Qml { +namespace QmlJS { -class QmlTypeSystem; +class TypeSystem; -class QML_EXPORT QmlMetaTypeBackend +class QMLJS_EXPORT MetaTypeBackend { public: - QmlMetaTypeBackend(QmlTypeSystem *typeSystem); - virtual ~QmlMetaTypeBackend() = 0; + MetaTypeBackend(TypeSystem *typeSystem); + virtual ~MetaTypeBackend() = 0; - virtual QList<QmlSymbol *> availableTypes(const QString &package, int majorVersion, int minorVersion) = 0; - virtual QmlSymbol *resolve(const QString &typeName, const QList<PackageInfo> &packages) = 0; + virtual QList<Symbol *> availableTypes(const QString &package, int majorVersion, int minorVersion) = 0; + virtual Symbol *resolve(const QString &typeName, const QList<PackageInfo> &packages) = 0; protected: - QmlTypeSystem *typeSystem() const + TypeSystem *typeSystem() const { return m_typeSystem; } private: - QmlTypeSystem *m_typeSystem; + TypeSystem *m_typeSystem; }; } // namespace Qml diff --git a/src/shared/qmljs/qmlpackageinfo.cpp b/src/libs/qmljs/qmljspackageinfo.cpp similarity index 96% rename from src/shared/qmljs/qmlpackageinfo.cpp rename to src/libs/qmljs/qmljspackageinfo.cpp index bc56a420505bcd2d4f385cd259fc9d6c0df2a149..0a89a6f917c5b57f5e4b12d809dc0d0f282ccb53 100644 --- a/src/shared/qmljs/qmlpackageinfo.cpp +++ b/src/libs/qmljs/qmljspackageinfo.cpp @@ -27,9 +27,9 @@ ** **************************************************************************/ -#include "qmlpackageinfo.h" +#include "qmljspackageinfo.h" -using namespace Qml; +using namespace QmlJS; PackageInfo::PackageInfo(const QString &name, int majorVersion, int minorVersion): m_name(name), diff --git a/src/shared/qmljs/qmlpackageinfo.h b/src/libs/qmljs/qmljspackageinfo.h similarity index 95% rename from src/shared/qmljs/qmlpackageinfo.h rename to src/libs/qmljs/qmljspackageinfo.h index bcb21172fe7b498a67ea63ba302e4c281ed15a69..b63cecbb8ecfc172c185dde8708b4e83145699c1 100644 --- a/src/shared/qmljs/qmlpackageinfo.h +++ b/src/libs/qmljs/qmljspackageinfo.h @@ -30,13 +30,13 @@ #ifndef PACKAGEINFO_H #define PACKAGEINFO_H -#include <qmljs/qml_global.h> +#include <qmljs/qmljs_global.h> #include <QtCore/QString> -namespace Qml { +namespace QmlJS { -class QML_EXPORT PackageInfo +class QMLJS_EXPORT PackageInfo { public: PackageInfo(const QString &name, int majorVersion, int minorVersion); diff --git a/src/shared/qscripthighlighter/qscriptincrementalscanner.cpp b/src/libs/qmljs/qmljsscanner.cpp similarity index 95% rename from src/shared/qscripthighlighter/qscriptincrementalscanner.cpp rename to src/libs/qmljs/qmljsscanner.cpp index 0e5a2978bcb5342516e088ed456e1c48e01d8df9..039b7fb1a2b2f2f54868130bae2db747faedc754 100644 --- a/src/shared/qscripthighlighter/qscriptincrementalscanner.cpp +++ b/src/libs/qmljs/qmljsscanner.cpp @@ -27,28 +27,28 @@ ** **************************************************************************/ -#include "qscriptincrementalscanner.h" +#include <qmljs/qmljsscanner.h> #include <QTextCharFormat> -using namespace SharedTools; +using namespace QmlJS; -QScriptIncrementalScanner::QScriptIncrementalScanner() +QmlJSScanner::QmlJSScanner() { reset(); } -QScriptIncrementalScanner::~QScriptIncrementalScanner() +QmlJSScanner::~QmlJSScanner() {} -void QScriptIncrementalScanner::reset() +void QmlJSScanner::reset() { m_endState = -1; m_firstNonSpace = -1; m_tokens.clear(); } -QList<QScriptIncrementalScanner::Token> QScriptIncrementalScanner::operator()(const QString &text, int startState) +QList<QmlJSScanner::Token> QmlJSScanner::operator()(const QString &text, int startState) { reset(); @@ -301,7 +301,7 @@ QList<QScriptIncrementalScanner::Token> QScriptIncrementalScanner::operator()(co return m_tokens; } -void QScriptIncrementalScanner::insertToken(int start, int length, Token::Kind kind, bool forceNewToken) +void QmlJSScanner::insertToken(int start, int length, Token::Kind kind, bool forceNewToken) { if (m_tokens.isEmpty() || forceNewToken) { m_tokens.append(Token(start, length, kind)); @@ -316,7 +316,7 @@ void QScriptIncrementalScanner::insertToken(int start, int length, Token::Kind k } } -void QScriptIncrementalScanner::insertCharToken(int start, const char c) +void QmlJSScanner::insertCharToken(int start, const char c) { Token::Kind kind; @@ -348,7 +348,7 @@ void QScriptIncrementalScanner::insertCharToken(int start, const char c) insertToken(start, 1, kind, true); } -void QScriptIncrementalScanner::scanForKeywords(const QString &text) +void QmlJSScanner::scanForKeywords(const QString &text) { for (int i = 0; i < m_tokens.length(); ++i) { Token &t(m_tokens[i]); diff --git a/src/shared/qscripthighlighter/qscriptincrementalscanner.h b/src/libs/qmljs/qmljsscanner.h similarity index 86% rename from src/shared/qscripthighlighter/qscriptincrementalscanner.h rename to src/libs/qmljs/qmljsscanner.h index 403a174a47410b53ccb6b5a48b80d62026f9344f..9a6abb770213f9547afba391c1b2f7a93d019f1a 100644 --- a/src/shared/qscripthighlighter/qscriptincrementalscanner.h +++ b/src/libs/qmljs/qmljsscanner.h @@ -27,16 +27,18 @@ ** **************************************************************************/ -#ifndef QSCRIPTINCREMENTALSCANNER_H -#define QSCRIPTINCREMENTALSCANNER_H +#ifndef QMLJSSCANNER_H +#define QMLJSSCANNER_H + +#include <qmljs/qmljs_global.h> #include <QtCore/QList> #include <QtCore/QSet> #include <QtCore/QString> -namespace SharedTools { +namespace QmlJS { -class QScriptIncrementalScanner +class QMLJS_EXPORT QmlJSScanner { public: @@ -70,15 +72,15 @@ public: }; public: - QScriptIncrementalScanner(); - virtual ~QScriptIncrementalScanner(); + QmlJSScanner(); + virtual ~QmlJSScanner(); void setKeywords(const QSet<QString> keywords) { m_keywords = keywords;; } void reset(); - QList<QScriptIncrementalScanner::Token> operator()(const QString &text, int startState = 0); + QList<QmlJSScanner::Token> operator()(const QString &text, int startState = 0); int endState() const { return m_endState; } @@ -86,7 +88,7 @@ public: int firstNonSpace() const { return m_firstNonSpace; } - QList<QScriptIncrementalScanner::Token> tokens() const + QList<QmlJSScanner::Token> tokens() const { return m_tokens; } private: @@ -108,9 +110,9 @@ private: QSet<QString> m_keywords; int m_endState; int m_firstNonSpace; - QList<QScriptIncrementalScanner::Token> m_tokens; + QList<QmlJSScanner::Token> m_tokens; }; -} // namespace SharedTools +} // namespace QmlJS -#endif // QSCRIPTINCREMENTALSCANNER_H +#endif // QMLJSSCANNER_H diff --git a/src/shared/qmljs/qmlsymbol.cpp b/src/libs/qmljs/qmljssymbol.cpp similarity index 66% rename from src/shared/qmljs/qmlsymbol.cpp rename to src/libs/qmljs/qmljssymbol.cpp index 96e946a7561250be0a436847a78b78fbc89ebecb..ca20e4319a2f0d0f7e689ebb03500308eb862b7b 100644 --- a/src/shared/qmljs/qmlsymbol.cpp +++ b/src/libs/qmljs/qmljssymbol.cpp @@ -27,56 +27,56 @@ ** **************************************************************************/ -#include "qmlsymbol.h" +#include "qmljssymbol.h" #include <qmljs/parser/qmljsast_p.h> #include <qmljs/parser/qmljsengine_p.h> -using namespace Qml; +using namespace QmlJS; using namespace QmlJS; using namespace QmlJS::AST; -QmlSymbol::~QmlSymbol() +Symbol::~Symbol() { } -bool QmlSymbol::isBuildInSymbol() -{ return asBuildInSymbol() != 0; } +bool Symbol::isBuildInSymbol() +{ return asPrimitiveSymbol() != 0; } -bool QmlSymbol::isSymbolFromFile() +bool Symbol::isSymbolFromFile() { return asSymbolFromFile() != 0; } -bool QmlSymbol::isIdSymbol() +bool Symbol::isIdSymbol() { return asIdSymbol() != 0; } -bool QmlSymbol::isPropertyDefinitionSymbol() +bool Symbol::isPropertyDefinitionSymbol() { return asPropertyDefinitionSymbol() != 0; } -QmlBuildInSymbol *QmlSymbol::asBuildInSymbol() +PrimitiveSymbol *Symbol::asPrimitiveSymbol() { return 0; } -QmlSymbolFromFile *QmlSymbol::asSymbolFromFile() +SymbolFromFile *Symbol::asSymbolFromFile() { return 0; } -QmlIdSymbol *QmlSymbol::asIdSymbol() +IdSymbol *Symbol::asIdSymbol() { return 0; } -QmlPropertyDefinitionSymbol *QmlSymbol::asPropertyDefinitionSymbol() +PropertyDefinitionSymbol *Symbol::asPropertyDefinitionSymbol() { return 0; } -QmlBuildInSymbol::~QmlBuildInSymbol() +PrimitiveSymbol::~PrimitiveSymbol() {} -QmlBuildInSymbol *QmlBuildInSymbol::asBuildInSymbol() +PrimitiveSymbol *PrimitiveSymbol::asPrimitiveSymbol() { return this; } -QmlSymbolWithMembers::~QmlSymbolWithMembers() +SymbolWithMembers::~SymbolWithMembers() { qDeleteAll(_members); } -const QmlSymbol::List QmlSymbolWithMembers::members() +const Symbol::List SymbolWithMembers::members() { return _members; } -QmlSymbolFromFile::QmlSymbolFromFile(const QString &fileName, QmlJS::AST::UiObjectMember *node): +SymbolFromFile::SymbolFromFile(const QString &fileName, QmlJS::AST::UiObjectMember *node): _fileName(fileName), _node(node) { @@ -97,16 +97,16 @@ QmlSymbolFromFile::QmlSymbolFromFile(const QString &fileName, QmlJS::AST::UiObje } } -QmlSymbolFromFile::~QmlSymbolFromFile() +SymbolFromFile::~SymbolFromFile() {} -QmlSymbolFromFile *QmlSymbolFromFile::asSymbolFromFile() +SymbolFromFile *SymbolFromFile::asSymbolFromFile() { return this; } -int QmlSymbolFromFile::line() const +int SymbolFromFile::line() const { return _node->firstSourceLocation().startLine; } -int QmlSymbolFromFile::column() const +int SymbolFromFile::column() const { return _node->firstSourceLocation().startColumn; } static inline QString toString(UiQualifiedId *qId) @@ -126,7 +126,7 @@ static inline QString toString(UiQualifiedId *qId) return result; } -const QString QmlSymbolFromFile::name() const +const QString SymbolFromFile::name() const { if (UiObjectBinding *objectBinding = cast<UiObjectBinding*>(_node)) return toString(objectBinding->qualifiedId); @@ -140,23 +140,23 @@ const QString QmlSymbolFromFile::name() const return QString::null; } -const QmlSymbol::List QmlSymbolFromFile::members() +const Symbol::List SymbolFromFile::members() { if (!todo.isEmpty()) { foreach (Node *todoNode, todo) { if (UiObjectBinding *objectBinding = cast<UiObjectBinding*>(todoNode)) - _members.append(new QmlSymbolFromFile(fileName(), objectBinding)); + _members.append(new SymbolFromFile(fileName(), objectBinding)); else if (UiObjectDefinition *objectDefinition = cast<UiObjectDefinition*>(todoNode)) - _members.append(new QmlSymbolFromFile(fileName(), objectDefinition)); + _members.append(new SymbolFromFile(fileName(), objectDefinition)); else if (UiArrayBinding *arrayBinding = cast<UiArrayBinding*>(todoNode)) - _members.append(new QmlSymbolFromFile(fileName(), arrayBinding)); + _members.append(new SymbolFromFile(fileName(), arrayBinding)); else if (UiPublicMember *publicMember = cast<UiPublicMember*>(todoNode)) - _members.append(new QmlPropertyDefinitionSymbol(fileName(), publicMember)); + _members.append(new PropertyDefinitionSymbol(fileName(), publicMember)); else if (UiScriptBinding *scriptBinding = cast<UiScriptBinding*>(todoNode)) { if (scriptBinding->qualifiedId && scriptBinding->qualifiedId->name && scriptBinding->qualifiedId->name->asString() == QLatin1String("id") && !scriptBinding->qualifiedId->next) - _members.append(new QmlIdSymbol(fileName(), scriptBinding, this)); + _members.append(new IdSymbol(fileName(), scriptBinding, this)); else - _members.append(new QmlSymbolFromFile(fileName(), scriptBinding)); + _members.append(new SymbolFromFile(fileName(), scriptBinding)); } } @@ -166,14 +166,14 @@ const QmlSymbol::List QmlSymbolFromFile::members() return _members; } -bool QmlSymbolFromFile::isProperty() const +bool SymbolFromFile::isProperty() const { return cast<UiObjectDefinition*>(_node) == 0; } -QmlSymbolFromFile *QmlSymbolFromFile::findMember(QmlJS::AST::Node *memberNode) +SymbolFromFile *SymbolFromFile::findMember(QmlJS::AST::Node *memberNode) { List symbols = members(); - foreach (QmlSymbol *symbol, symbols) + foreach (Symbol *symbol, symbols) if (symbol->isSymbolFromFile()) if (memberNode == symbol->asSymbolFromFile()->node()) return symbol->asSymbolFromFile(); @@ -181,24 +181,24 @@ QmlSymbolFromFile *QmlSymbolFromFile::findMember(QmlJS::AST::Node *memberNode) return 0; } -QmlIdSymbol::QmlIdSymbol(const QString &fileName, QmlJS::AST::UiScriptBinding *idNode, QmlSymbolFromFile *parentNode): - QmlSymbolFromFile(fileName, idNode), +IdSymbol::IdSymbol(const QString &fileName, QmlJS::AST::UiScriptBinding *idNode, SymbolFromFile *parentNode): + SymbolFromFile(fileName, idNode), _parentNode(parentNode) {} -QmlIdSymbol::~QmlIdSymbol() +IdSymbol::~IdSymbol() {} -QmlIdSymbol *QmlIdSymbol::asIdSymbol() +IdSymbol *IdSymbol::asIdSymbol() { return this; } -int QmlIdSymbol::line() const +int IdSymbol::line() const { return idNode()->statement->firstSourceLocation().startLine; } -int QmlIdSymbol::column() const +int IdSymbol::column() const { return idNode()->statement->firstSourceLocation().startColumn; } -const QString QmlIdSymbol::id() const +const QString IdSymbol::id() const { if (ExpressionStatement *e = cast<ExpressionStatement*>(idNode()->statement)) if (IdentifierExpression *i = cast<IdentifierExpression*>(e->expression)) @@ -208,27 +208,27 @@ const QString QmlIdSymbol::id() const return QString(); } -QmlJS::AST::UiScriptBinding *QmlIdSymbol::idNode() const +QmlJS::AST::UiScriptBinding *IdSymbol::idNode() const { return cast<UiScriptBinding*>(node()); } -QmlPropertyDefinitionSymbol::QmlPropertyDefinitionSymbol(const QString &fileName, QmlJS::AST::UiPublicMember *propertyNode): - QmlSymbolFromFile(fileName, propertyNode) +PropertyDefinitionSymbol::PropertyDefinitionSymbol(const QString &fileName, QmlJS::AST::UiPublicMember *propertyNode): + SymbolFromFile(fileName, propertyNode) {} -QmlPropertyDefinitionSymbol::~QmlPropertyDefinitionSymbol() +PropertyDefinitionSymbol::~PropertyDefinitionSymbol() {} -QmlPropertyDefinitionSymbol *QmlPropertyDefinitionSymbol::asPropertyDefinitionSymbol() +PropertyDefinitionSymbol *PropertyDefinitionSymbol::asPropertyDefinitionSymbol() { return this; } -int QmlPropertyDefinitionSymbol::line() const +int PropertyDefinitionSymbol::line() const { return propertyNode()->identifierToken.startLine; } -int QmlPropertyDefinitionSymbol::column() const +int PropertyDefinitionSymbol::column() const { return propertyNode()->identifierToken.startColumn; } -QmlJS::AST::UiPublicMember *QmlPropertyDefinitionSymbol::propertyNode() const +QmlJS::AST::UiPublicMember *PropertyDefinitionSymbol::propertyNode() const { return cast<UiPublicMember*>(node()); } -const QString QmlPropertyDefinitionSymbol::name() const +const QString PropertyDefinitionSymbol::name() const { return propertyNode()->name->asString(); } diff --git a/src/shared/qmljs/qmlsymbol.h b/src/libs/qmljs/qmljssymbol.h similarity index 63% rename from src/shared/qmljs/qmlsymbol.h rename to src/libs/qmljs/qmljssymbol.h index 35ca2f3c8c8d1d074ceafca6e4bd41ae2686d391..ebd969bb83196692e4bcf55e347d4f76057462a0 100644 --- a/src/shared/qmljs/qmlsymbol.h +++ b/src/libs/qmljs/qmljssymbol.h @@ -31,20 +31,20 @@ #define QMLSYMBOL_H #include <qmljs/parser/qmljsastfwd_p.h> -#include <qmljs/qml_global.h> +#include <qmljs/qmljs_global.h> #include <QList> #include <QString> -namespace Qml { +namespace QmlJS { -class QML_EXPORT QmlSymbol +class QMLJS_EXPORT Symbol { public: - typedef QList<QmlSymbol *> List; + typedef QList<Symbol *> List; public: - virtual ~QmlSymbol() = 0; + virtual ~Symbol() = 0; virtual const QString name() const = 0; virtual const List members() = 0; @@ -55,28 +55,28 @@ public: bool isIdSymbol(); bool isPropertyDefinitionSymbol(); - virtual class QmlBuildInSymbol *asBuildInSymbol(); - virtual class QmlSymbolFromFile *asSymbolFromFile(); - virtual class QmlIdSymbol *asIdSymbol(); - virtual class QmlPropertyDefinitionSymbol *asPropertyDefinitionSymbol(); + virtual class PrimitiveSymbol *asPrimitiveSymbol(); + virtual class SymbolFromFile *asSymbolFromFile(); + virtual class IdSymbol *asIdSymbol(); + virtual class PropertyDefinitionSymbol *asPropertyDefinitionSymbol(); }; -class QML_EXPORT QmlBuildInSymbol: public QmlSymbol +class QMLJS_EXPORT PrimitiveSymbol: public Symbol { public: - virtual ~QmlBuildInSymbol() = 0; + virtual ~PrimitiveSymbol() = 0; - virtual QmlBuildInSymbol *asBuildInSymbol(); + virtual PrimitiveSymbol *asPrimitiveSymbol(); - virtual QmlBuildInSymbol *type() const = 0; - using QmlSymbol::members; + virtual PrimitiveSymbol *type() const = 0; + using Symbol::members; virtual List members(bool includeBaseClassMembers) = 0; }; -class QML_EXPORT QmlSymbolWithMembers: public QmlSymbol +class QMLJS_EXPORT SymbolWithMembers: public Symbol { public: - virtual ~QmlSymbolWithMembers() = 0; + virtual ~SymbolWithMembers() = 0; virtual const List members(); @@ -84,13 +84,13 @@ protected: List _members; }; -class QML_EXPORT QmlSymbolFromFile: public QmlSymbolWithMembers +class QMLJS_EXPORT SymbolFromFile: public SymbolWithMembers { public: - QmlSymbolFromFile(const QString &fileName, QmlJS::AST::UiObjectMember *node); - virtual ~QmlSymbolFromFile(); + SymbolFromFile(const QString &fileName, QmlJS::AST::UiObjectMember *node); + virtual ~SymbolFromFile(); - virtual QmlSymbolFromFile *asSymbolFromFile(); + virtual SymbolFromFile *asSymbolFromFile(); QString fileName() const { return _fileName; } @@ -104,7 +104,7 @@ public: virtual const QString name() const; virtual const List members(); virtual bool isProperty() const; - virtual QmlSymbolFromFile *findMember(QmlJS::AST::Node *memberNode); + virtual SymbolFromFile *findMember(QmlJS::AST::Node *memberNode); private: void fillTodo(QmlJS::AST::UiObjectMemberList *members); @@ -115,18 +115,18 @@ private: QList<QmlJS::AST::Node*> todo; }; -class QML_EXPORT QmlIdSymbol: public QmlSymbolFromFile +class QMLJS_EXPORT IdSymbol: public SymbolFromFile { public: - QmlIdSymbol(const QString &fileName, QmlJS::AST::UiScriptBinding *idNode, QmlSymbolFromFile *parentNode); - virtual ~QmlIdSymbol(); + IdSymbol(const QString &fileName, QmlJS::AST::UiScriptBinding *idNode, SymbolFromFile *parentNode); + virtual ~IdSymbol(); - QmlIdSymbol *asIdSymbol(); + IdSymbol *asIdSymbol(); virtual int line() const; virtual int column() const; - QmlSymbolFromFile *parentNode() const + SymbolFromFile *parentNode() const { return _parentNode; } virtual const QString name() const @@ -138,16 +138,16 @@ private: QmlJS::AST::UiScriptBinding *idNode() const; private: - QmlSymbolFromFile *_parentNode; + SymbolFromFile *_parentNode; }; -class QML_EXPORT QmlPropertyDefinitionSymbol: public QmlSymbolFromFile +class QMLJS_EXPORT PropertyDefinitionSymbol: public SymbolFromFile { public: - QmlPropertyDefinitionSymbol(const QString &fileName, QmlJS::AST::UiPublicMember *propertyNode); - virtual ~QmlPropertyDefinitionSymbol(); + PropertyDefinitionSymbol(const QString &fileName, QmlJS::AST::UiPublicMember *propertyNode); + virtual ~PropertyDefinitionSymbol(); - QmlPropertyDefinitionSymbol *asPropertyDefinitionSymbol(); + PropertyDefinitionSymbol *asPropertyDefinitionSymbol(); virtual int line() const; virtual int column() const; diff --git a/src/shared/qmljs/qmltypesystem.cpp b/src/libs/qmljs/qmljstypesystem.cpp similarity index 73% rename from src/shared/qmljs/qmltypesystem.cpp rename to src/libs/qmljs/qmljstypesystem.cpp index 1b3c568d446adeaab6bed1ca327bd1df77b19f3d..b4add55970dab203c9cb373716d698aaedca7d23 100644 --- a/src/shared/qmljs/qmltypesystem.cpp +++ b/src/libs/qmljs/qmljstypesystem.cpp @@ -27,43 +27,43 @@ ** **************************************************************************/ -#include "QmlMetaTypeBackend.h" -#include "qmltypesystem.h" +#include "qmljsmetatypebackend.h" +#include "qmljstypesystem.h" #ifdef BUILD_DECLARATIVE_BACKEND -# include "QtDeclarativeMetaTypeBackend.h" +# include "qtdeclarativemetatypebackend.h" #endif // BUILD_DECLARATIVE_BACKEND #include <QDebug> -using namespace Qml; +using namespace QmlJS; -QmlTypeSystem::QmlTypeSystem() +TypeSystem::TypeSystem() { #ifdef BUILD_DECLARATIVE_BACKEND backends.append(new Internal::QtDeclarativeMetaTypeBackend(this)); #endif // BUILD_DECLARATIVE_BACKEND } -QmlTypeSystem::~QmlTypeSystem() +TypeSystem::~TypeSystem() { qDeleteAll(backends); } -QList<QmlSymbol *> QmlTypeSystem::availableTypes(const QString &package, int majorVersion, int minorVersion) +QList<Symbol *> TypeSystem::availableTypes(const QString &package, int majorVersion, int minorVersion) { - QList<QmlSymbol *> results; + QList<Symbol *> results; - foreach (QmlMetaTypeBackend *backend, backends) + foreach (MetaTypeBackend *backend, backends) results.append(backend->availableTypes(package, majorVersion, minorVersion)); return results; } -QmlSymbol *QmlTypeSystem::resolve(const QString &typeName, const QList<PackageInfo> &packages) +Symbol *TypeSystem::resolve(const QString &typeName, const QList<PackageInfo> &packages) { - foreach (QmlMetaTypeBackend *backend, backends) - if (QmlSymbol *symbol = backend->resolve(typeName, packages)) + foreach (MetaTypeBackend *backend, backends) + if (Symbol *symbol = backend->resolve(typeName, packages)) return symbol; return 0; diff --git a/src/shared/qmljs/qmltypesystem.h b/src/libs/qmljs/qmljstypesystem.h similarity index 75% rename from src/shared/qmljs/qmltypesystem.h rename to src/libs/qmljs/qmljstypesystem.h index 3a0ff57577ce1a144a52491538cd085ee26d9319..001da3b7db5259c403535a9b27383fb7c4b18b9b 100644 --- a/src/shared/qmljs/qmltypesystem.h +++ b/src/libs/qmljs/qmljstypesystem.h @@ -30,30 +30,30 @@ #ifndef QMLTYPESYSTEM_H #define QMLTYPESYSTEM_H -#include <qmljs/qml_global.h> -#include <qmljs/qmlpackageinfo.h> -#include <qmljs/qmlsymbol.h> +#include <qmljs/qmljs_global.h> +#include <qmljs/qmljspackageinfo.h> +#include <qmljs/qmljssymbol.h> #include <QtCore/QList> #include <QtCore/QObject> -namespace Qml { +namespace QmlJS { -class QmlMetaTypeBackend; +class MetaTypeBackend; -class QML_EXPORT QmlTypeSystem: public QObject +class QMLJS_EXPORT TypeSystem: public QObject { Q_OBJECT public: - QmlTypeSystem(); - virtual ~QmlTypeSystem(); + TypeSystem(); + virtual ~TypeSystem(); - QList<QmlSymbol *> availableTypes(const QString &package, int majorVersion, int minorVersion); - QmlSymbol *resolve(const QString &typeName, const QList<PackageInfo> &packages); + QList<Symbol *> availableTypes(const QString &package, int majorVersion, int minorVersion); + Symbol *resolve(const QString &typeName, const QList<PackageInfo> &packages); private: - QList<QmlMetaTypeBackend *> backends; + QList<MetaTypeBackend *> backends; }; } // namespace Qml diff --git a/src/shared/qmljs/QtDeclarativeMetaTypeBackend.cpp b/src/libs/qmljs/qtdeclarativemetatypebackend.cpp similarity index 67% rename from src/shared/qmljs/QtDeclarativeMetaTypeBackend.cpp rename to src/libs/qmljs/qtdeclarativemetatypebackend.cpp index 963423994bea0e30f3000dcf93fc28ed0f5b8849..b67fa018a010ae1ea4bb03f815da10aef9de6d36 100644 --- a/src/shared/qmljs/QtDeclarativeMetaTypeBackend.cpp +++ b/src/libs/qmljs/qtdeclarativemetatypebackend.cpp @@ -27,21 +27,21 @@ ** **************************************************************************/ -#include "QtDeclarativeMetaTypeBackend.h" +#include "qtdeclarativemetatypebackend.h" #include <QDebug> -namespace Qml { +namespace QmlJS { namespace Internal { -class QmlDeclarativeSymbol: public QmlBuildInSymbol +class DeclarativeSymbol: public PrimitiveSymbol { public: - virtual ~QmlDeclarativeSymbol() + virtual ~DeclarativeSymbol() {} protected: - QmlDeclarativeSymbol(QtDeclarativeMetaTypeBackend* backend): + DeclarativeSymbol(QtDeclarativeMetaTypeBackend* backend): m_backend(backend) { Q_ASSERT(backend); } @@ -52,24 +52,24 @@ private: QtDeclarativeMetaTypeBackend* m_backend; }; -class QmlDeclarativeObjectSymbol: public QmlDeclarativeSymbol +class DeclarativeObjectSymbol: public DeclarativeSymbol { - QmlDeclarativeObjectSymbol(const QmlDeclarativeObjectSymbol &); - QmlDeclarativeObjectSymbol &operator=(const QmlDeclarativeObjectSymbol &); + DeclarativeObjectSymbol(const DeclarativeObjectSymbol &); + DeclarativeObjectSymbol &operator=(const DeclarativeObjectSymbol &); public: - QmlDeclarativeObjectSymbol(QtDeclarativeMetaTypeBackend* backend): - QmlDeclarativeSymbol(backend) + DeclarativeObjectSymbol(QtDeclarativeMetaTypeBackend* backend): + DeclarativeSymbol(backend) { } - virtual ~QmlDeclarativeObjectSymbol() + virtual ~DeclarativeObjectSymbol() { qDeleteAll(m_members); } virtual const QString name() const { return m_name; } - virtual QmlBuildInSymbol *type() const + virtual PrimitiveSymbol *type() const { return 0; } virtual const List members() @@ -114,24 +114,24 @@ private: List m_members; }; -class QmlDeclarativePropertySymbol: public QmlDeclarativeSymbol +class DeclarativePropertySymbol: public DeclarativeSymbol { - QmlDeclarativePropertySymbol(const QmlDeclarativePropertySymbol &); - QmlDeclarativePropertySymbol &operator=(const QmlDeclarativePropertySymbol &); + DeclarativePropertySymbol(const DeclarativePropertySymbol &); + DeclarativePropertySymbol &operator=(const DeclarativePropertySymbol &); public: - QmlDeclarativePropertySymbol(QtDeclarativeMetaTypeBackend* backend): - QmlDeclarativeSymbol(backend) + DeclarativePropertySymbol(QtDeclarativeMetaTypeBackend* backend): + DeclarativeSymbol(backend) { } - virtual ~QmlDeclarativePropertySymbol() + virtual ~DeclarativePropertySymbol() {} virtual const QString name() const { return QString(); } - virtual QmlBuildInSymbol *type() const + virtual PrimitiveSymbol *type() const { return 0; } virtual const List members() @@ -153,11 +153,11 @@ private: } // namespace Internal } // namespace Qml -using namespace Qml; -using namespace Qml::Internal; +using namespace QmlJS; +using namespace QmlJS::Internal; -QtDeclarativeMetaTypeBackend::QtDeclarativeMetaTypeBackend(QmlTypeSystem *typeSystem): - QmlMetaTypeBackend(typeSystem) +QtDeclarativeMetaTypeBackend::QtDeclarativeMetaTypeBackend(TypeSystem *typeSystem): + MetaTypeBackend(typeSystem) { } @@ -165,16 +165,16 @@ QtDeclarativeMetaTypeBackend::~QtDeclarativeMetaTypeBackend() { } -QList<QmlSymbol *> QtDeclarativeMetaTypeBackend::availableTypes(const QString &package, int majorVersion, int minorVersion) +QList<Symbol *> QtDeclarativeMetaTypeBackend::availableTypes(const QString &package, int majorVersion, int minorVersion) { - QList<QmlSymbol *> result; + QList<Symbol *> result; return result; } -QmlSymbol *QtDeclarativeMetaTypeBackend::resolve(const QString &typeName, const QList<PackageInfo> &packages) +Symbol *QtDeclarativeMetaTypeBackend::resolve(const QString &typeName, const QList<PackageInfo> &packages) { - QList<QmlSymbol *> result; + QList<Symbol *> result; return 0; diff --git a/src/shared/qmljs/QtDeclarativeMetaTypeBackend.h b/src/libs/qmljs/qtdeclarativemetatypebackend.h similarity index 63% rename from src/shared/qmljs/QtDeclarativeMetaTypeBackend.h rename to src/libs/qmljs/qtdeclarativemetatypebackend.h index dd565e5d57038a4061a382dbbfe31f9a4bdf0163..5b7cc6a080034499b0a4b2647bfe6337f19750e2 100644 --- a/src/shared/qmljs/QtDeclarativeMetaTypeBackend.h +++ b/src/libs/qmljs/qtdeclarativemetatypebackend.h @@ -30,37 +30,37 @@ #ifndef QTDECLARATIVEMETATYPEBACKEND_H #define QTDECLARATIVEMETATYPEBACKEND_H -#include <qmljs/QmlMetaTypeBackend.h> +#include <qmljs/qmljsmetatypebackend.h> #include <QtCore/QList> -namespace Qml { +namespace QmlJS { namespace Internal { -class QmlDeclarativeSymbol; -class QmlDeclarativeObjectSymbol; -class QmlDeclarativePropertySymbol; +class DeclarativeSymbol; +class DeclarativeObjectSymbol; +class DeclarativePropertySymbol; -class QtDeclarativeMetaTypeBackend: public QmlMetaTypeBackend +class QtDeclarativeMetaTypeBackend: public MetaTypeBackend { - friend class QmlDeclarativeSymbol; - friend class QmlDeclarativeObjectSymbol; - friend class QmlDeclarativePropertySymbol; + friend class DeclarativeSymbol; + friend class DeclarativeObjectSymbol; + friend class DeclarativePropertySymbol; public: - QtDeclarativeMetaTypeBackend(QmlTypeSystem *typeSystem); + QtDeclarativeMetaTypeBackend(TypeSystem *typeSystem); ~QtDeclarativeMetaTypeBackend(); - virtual QList<QmlSymbol *> availableTypes(const QString &package, int majorVersion, int minorVersion); - virtual QmlSymbol *resolve(const QString &typeName, const QList<PackageInfo> &packages); + virtual QList<Symbol *> availableTypes(const QString &package, int majorVersion, int minorVersion); + virtual Symbol *resolve(const QString &typeName, const QList<PackageInfo> &packages); protected: -// QList<QmlSymbol *> members(const Qml::NodeMetaInfo &metaInfo); -// QList<QmlSymbol *> inheritedMembers(const Qml::NodeMetaInfo &metaInfo); -// QmlDeclarativeSymbol *typeOf(const Qml::PropertyMetaInfo &metaInfo); +// QList<QmlSymbol *> members(const QmlJS::NodeMetaInfo &metaInfo); +// QList<QmlSymbol *> inheritedMembers(const QmlJS::NodeMetaInfo &metaInfo); +// QmlDeclarativeSymbol *typeOf(const QmlJS::PropertyMetaInfo &metaInfo); private: -// QmlDeclarativeSymbol *getSymbol(const Qml::NodeMetaInfo &metaInfo); +// QmlDeclarativeSymbol *getSymbol(const QmlJS::NodeMetaInfo &metaInfo); private: // QMap<QString, QmlDeclarativeSymbol*> m_symbols; diff --git a/src/shared/qscripthighlighter/test/main.cpp b/src/libs/qmljs/test/main.cpp similarity index 100% rename from src/shared/qscripthighlighter/test/main.cpp rename to src/libs/qmljs/test/main.cpp diff --git a/src/shared/qscripthighlighter/test/test.pro b/src/libs/qmljs/test/test.pro similarity index 100% rename from src/shared/qscripthighlighter/test/test.pro rename to src/libs/qmljs/test/test.pro diff --git a/src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.cpp b/src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.cpp index 1eaee5f2ce6d311ff256e4815c6fb90f773f110e..abd51592268d75ceb2b8010817c8c45c0ae3ca87 100644 --- a/src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.cpp +++ b/src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.cpp @@ -123,6 +123,20 @@ void MessageManagerPrototype::printToOutputPane(const QString &text, bool bringT mm->printToOutputPane(text, bringToForeground); } +void MessageManagerPrototype::printToOutputPanePopup(const QString &text) +{ + MessageManager *mm = qscriptvalue_cast<MessageManager *>(thisObject()); + QTC_ASSERT(mm, return); + mm->printToOutputPanePopup(text); +} + +void MessageManagerPrototype::printToOutputPane(const QString &text) +{ + MessageManager *mm = qscriptvalue_cast<MessageManager *>(thisObject()); + QTC_ASSERT(mm, return); + mm->printToOutputPane(text); +} + QString MessageManagerPrototype::toString() const { return QLatin1String("MessageManager"); diff --git a/src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.h b/src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.h index 86f0859b1fb52c9ebe01587630ba9217a1847f02..834a4e27c4684ba01a98848f30e3ef1ff42c1807 100644 --- a/src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.h +++ b/src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.h @@ -87,7 +87,10 @@ public: public slots: void displayStatusBarMessage(const QString &text, int ms = 0); - void printToOutputPane(const QString &text, bool bringToForeground = true); + void printToOutputPane(const QString &text, bool bringToForeground); + void printToOutputPanePopup(const QString &text); // pops up + void printToOutputPane(const QString &text); + QString toString() const; }; diff --git a/src/plugins/coreplugin/scriptmanager/scriptmanager.cpp b/src/plugins/coreplugin/scriptmanager/scriptmanager.cpp index 8d7761b7285b27d02c9fde2a4418e6f4c5b43602..aca9e68df375c95fb27a5d989716e430c1f6725e 100644 --- a/src/plugins/coreplugin/scriptmanager/scriptmanager.cpp +++ b/src/plugins/coreplugin/scriptmanager/scriptmanager.cpp @@ -235,13 +235,13 @@ ScriptManager::QScriptEnginePtr ScriptManagerPrivate::ensureEngineInitialized() { if (!m_engine.isNull()) return m_engine; - m_engine = QScriptEnginePtr(new QScriptEngine(this)); + m_engine = QScriptEnginePtr(new QScriptEngine); // register QObjects that occur as properties SharedTools::registerQObject<QMainWindow>(m_engine.data()); SharedTools::registerQObject<QStatusBar>(m_engine.data()); SharedTools::registerQObject<QSettings>(m_engine.data()); // WB interfaces -// SharedTools::registerQObjectInterface<Core::MessageManager, MessageManagerPrototype>(m_engine); + SharedTools::registerQObjectInterface<Core::MessageManager, MessageManagerPrototype>(m_engine.data()); // SharedTools::registerQObjectInterface<Core::IFile, FilePrototype>(m_engine); // qScriptRegisterSequenceMetaType<QList<Core::IFile *> >(m_engine); diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index 6f7245072f21ee02772f7ef58f67ef6399d6b53a..dd346e9cb79b84f8808546990de072cba5156f41 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -161,73 +161,7 @@ static const char pp_configuration[] = "#define __declspec(a)\n" "#define STDMETHOD(method) virtual HRESULT STDMETHODCALLTYPE method\n"; -namespace CppTools { -namespace Internal { - -class CppPreprocessor: public CPlusPlus::Client -{ -public: - CppPreprocessor(QPointer<CppModelManager> modelManager); - virtual ~CppPreprocessor(); - - void setRevision(unsigned revision); - void setWorkingCopy(const CppModelManagerInterface::WorkingCopy &workingCopy); - void setIncludePaths(const QStringList &includePaths); - void setFrameworkPaths(const QStringList &frameworkPaths); - void setProjectFiles(const QStringList &files); - void setTodo(const QStringList &files); - - void run(const QString &fileName); - - void resetEnvironment(); - - const QSet<QString> &todo() const - { return m_todo; } - -public: // attributes - Snapshot snapshot; - -protected: - CPlusPlus::Document::Ptr switchDocument(CPlusPlus::Document::Ptr doc); - - bool includeFile(const QString &absoluteFilePath, QString *result, unsigned *revision); - QString tryIncludeFile(QString &fileName, IncludeType type, unsigned *revision); - - void mergeEnvironment(CPlusPlus::Document::Ptr doc); - - virtual void macroAdded(const Macro ¯o); - virtual void passedMacroDefinitionCheck(unsigned offset, const Macro ¯o); - virtual void failedMacroDefinitionCheck(unsigned offset, const QByteArray &name); - virtual void startExpandingMacro(unsigned offset, - const Macro ¯o, - const QByteArray &originalText, - bool inCondition, - const QVector<MacroArgumentReference> &actuals); - virtual void stopExpandingMacro(unsigned offset, const Macro ¯o); - virtual void startSkippingBlocks(unsigned offset); - virtual void stopSkippingBlocks(unsigned offset); - virtual void sourceNeeded(QString &fileName, IncludeType type, - unsigned line); - -private: - QPointer<CppModelManager> m_modelManager; - Environment env; - Preprocessor preprocess; - QStringList m_includePaths; - QStringList m_systemIncludePaths; - CppModelManagerInterface::WorkingCopy m_workingCopy; - QStringList m_projectFiles; - QStringList m_frameworkPaths; - QSet<QString> m_included; - Document::Ptr m_currentDoc; - QSet<QString> m_todo; - QSet<QString> m_processed; - unsigned m_revision; -}; - -} // namespace Internal -} // namespace CppTools - +#ifndef ICHECK_BUILD CppPreprocessor::CppPreprocessor(QPointer<CppModelManager> modelManager) : snapshot(modelManager->snapshot()), m_modelManager(modelManager), @@ -235,6 +169,15 @@ CppPreprocessor::CppPreprocessor(QPointer<CppModelManager> modelManager) m_revision(0) { } +#else + +CppPreprocessor::CppPreprocessor(QPointer<CPlusPlus::ParseManager> modelManager) + : preprocess(this, &env), + m_revision(0) +{ +} +#endif + CppPreprocessor::~CppPreprocessor() { } @@ -258,7 +201,7 @@ void CppPreprocessor::setTodo(const QStringList &files) namespace { - +#ifndef ICHECK_BUILD class Process: public std::unary_function<Document::Ptr, void> { QPointer<CppModelManager> _modelManager; @@ -313,7 +256,7 @@ public: _modelManager->emitDocumentUpdated(doc); // ### TODO: compress } }; - +#endif } // end of anonymous namespace void CppPreprocessor::run(const QString &fileName) @@ -580,11 +523,19 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type, unsigned snapshot.insert(doc); m_todo.remove(fileName); +#ifndef ICHECK_BUILD Process process(m_modelManager, snapshot, m_workingCopy); process(doc); (void) switchDocument(previousDoc); +#else + (void) switchDocument(previousDoc); + Document::CheckMode mode = Document::FastCheck; + mode = Document::FullCheck; + doc->parse(); + doc->check(mode); +#endif } Document::Ptr CppPreprocessor::switchDocument(Document::Ptr doc) @@ -594,6 +545,7 @@ Document::Ptr CppPreprocessor::switchDocument(Document::Ptr doc) return previousDoc; } +#ifndef ICHECK_BUILD void CppTools::CppModelManagerInterface::updateModifiedSourceFiles() { const Snapshot snapshot = this->snapshot(); @@ -1397,5 +1349,5 @@ void CppModelManager::GC() m_snapshot = newSnapshot; protectSnapshot.unlock(); } - +#endif diff --git a/src/plugins/cpptools/cppmodelmanager.h b/src/plugins/cpptools/cppmodelmanager.h index bd5b7c0768f240b3aa82e651aa1abecd3633adeb..1ebac420beb231e308755679bc91b3304f651e13 100644 --- a/src/plugins/cpptools/cppmodelmanager.h +++ b/src/plugins/cpptools/cppmodelmanager.h @@ -33,9 +33,13 @@ #include <cpptools/cppmodelmanagerinterface.h> #include <projectexplorer/project.h> #include <cplusplus/CppDocument.h> - +#include <cplusplus/PreprocessorClient.h> #include <texteditor/basetexteditor.h> - +#include <cplusplus/PreprocessorEnvironment.h> +#include <cplusplus/pp-engine.h> +#ifdef ICHECK_BUILD +# include "ParseManager.h" +#endif #include <QtCore/QHash> #include <QtCore/QFutureInterface> #include <QtCore/QFutureSynchronizer> @@ -57,13 +61,19 @@ namespace ProjectExplorer { class ProjectExplorerPlugin; } +namespace CPlusPlus { + class ParseManager; +} + namespace CppTools { + namespace Internal { class CppEditorSupport; class CppPreprocessor; class CppFindReferences; +#ifndef ICHECK_BUILD class CppModelManager : public CppModelManagerInterface { Q_OBJECT @@ -221,6 +231,75 @@ private: CppFindReferences *m_findReferences; bool m_indexerEnabled; }; +#endif + +using namespace CPlusPlus; +class CppPreprocessor: public CPlusPlus::Client +{ +public: +#ifndef ICHECK_BUILD + CppPreprocessor(QPointer<CppModelManager> modelManager); +#else + CppPreprocessor(QPointer<CPlusPlus::ParseManager> modelManager); +#endif + virtual ~CppPreprocessor(); + + void setRevision(unsigned revision); + void setWorkingCopy(const CppModelManagerInterface::WorkingCopy &workingCopy); + void setIncludePaths(const QStringList &includePaths); + void setFrameworkPaths(const QStringList &frameworkPaths); + void setProjectFiles(const QStringList &files); + void setTodo(const QStringList &files); + + void run(const QString &fileName); + + void resetEnvironment(); + + const QSet<QString> &todo() const + { return m_todo; } + +public: // attributes + Snapshot snapshot; + +protected: + CPlusPlus::Document::Ptr switchDocument(CPlusPlus::Document::Ptr doc); + + bool includeFile(const QString &absoluteFilePath, QString *result, unsigned *revision); + QString tryIncludeFile(QString &fileName, IncludeType type, unsigned *revision); + + void mergeEnvironment(CPlusPlus::Document::Ptr doc); + + virtual void macroAdded(const Macro ¯o); + virtual void passedMacroDefinitionCheck(unsigned offset, const Macro ¯o); + virtual void failedMacroDefinitionCheck(unsigned offset, const QByteArray &name); + virtual void startExpandingMacro(unsigned offset, + const Macro ¯o, + const QByteArray &originalText, + bool inCondition, + const QVector<MacroArgumentReference> &actuals); + virtual void stopExpandingMacro(unsigned offset, const Macro ¯o); + virtual void startSkippingBlocks(unsigned offset); + virtual void stopSkippingBlocks(unsigned offset); + virtual void sourceNeeded(QString &fileName, IncludeType type, + unsigned line); + +private: +#ifndef ICHECK_BUILD + QPointer<CppModelManager> m_modelManager; +#endif + Environment env; + Preprocessor preprocess; + QStringList m_includePaths; + QStringList m_systemIncludePaths; + CppModelManagerInterface::WorkingCopy m_workingCopy; + QStringList m_projectFiles; + QStringList m_frameworkPaths; + QSet<QString> m_included; + Document::Ptr m_currentDoc; + QSet<QString> m_todo; + QSet<QString> m_processed; + unsigned m_revision; +}; } // namespace Internal } // namespace CppTools diff --git a/src/plugins/debugger/script/scriptengine.cpp b/src/plugins/debugger/script/scriptengine.cpp index ca6989c25272759e3438df2bb629cf2f90e95891..f5197a64397d212809f7d4366fa867c82ae6a27f 100644 --- a/src/plugins/debugger/script/scriptengine.cpp +++ b/src/plugins/debugger/script/scriptengine.cpp @@ -27,6 +27,8 @@ ** **************************************************************************/ +#define QT_NO_CAST_FROM_ASCII + #include "scriptengine.h" #include "debuggerdialogs.h" @@ -52,7 +54,6 @@ #include <QtCore/QFileInfo> #include <QtCore/QTimer> -#include <QtGui/QAction> #include <QtGui/QApplication> #include <QtGui/QToolTip> @@ -286,8 +287,8 @@ bool ScriptEngine::importExtensions() extensions.append(QLatin1String(qtExtensionsC[e])); if (m_scriptEngine->importedExtensions().contains(extensions.front())) return true; - QDir dir("/home/apoenitz/dev/qtscriptgenerator"); - if (!dir.cd("plugins")) { + QDir dir(QLatin1String("/home/apoenitz/dev/qtscriptgenerator")); + if (!dir.cd(QLatin1String("plugins"))) { fprintf(stderr, "plugins folder does not exist -- did you build the bindings?\n"); return false; } @@ -313,7 +314,7 @@ bool ScriptEngine::importExtensions() "Make sure that the bindings have been built, " "and that this executable and the plugins are " "using compatible Qt libraries.", - qPrintable(failExtensions.join(", ")), qPrintable(dir.absolutePath())); + qPrintable(failExtensions.join(QLatin1String(", "))), qPrintable(dir.absolutePath())); } } return failExtensions.isEmpty(); @@ -495,7 +496,7 @@ void ScriptEngine::setToolTipExpression(const QPoint &mousePos, */ QToolTip::hideText(); - if (exp.isEmpty() || exp.startsWith("#")) { + if (exp.isEmpty() || exp.startsWith(QLatin1Char('#'))) { QToolTip::hideText(); return; } @@ -505,18 +506,18 @@ void ScriptEngine::setToolTipExpression(const QPoint &mousePos, return; } - if (exp.startsWith('"') && exp.endsWith('"')) { + if (exp.startsWith(QLatin1Char('"')) && exp.endsWith(QLatin1Char('"'))) { QToolTip::showText(m_toolTipPos, tr("String literal %1").arg(exp)); return; } - if (exp.startsWith("++") || exp.startsWith("--")) - exp = exp.mid(2); + if (exp.startsWith(QLatin1String("++")) || exp.startsWith(QLatin1String("--"))) + exp.remove(0, 2); - if (exp.endsWith("++") || exp.endsWith("--")) - exp = exp.mid(2); + if (exp.endsWith(QLatin1String("++")) || exp.endsWith(QLatin1String("--"))) + exp.remove(0, 2); - if (exp.startsWith("<") || exp.startsWith("[")) + if (exp.startsWith(QLatin1Char('<')) || exp.startsWith(QLatin1Char('['))) return; if (hasSideEffects(exp)) { @@ -549,8 +550,8 @@ void ScriptEngine::setToolTipExpression(const QPoint &mousePos, void ScriptEngine::assignValueInDebugger(const QString &expression, const QString &value) { - XSDEBUG("ASSIGNING: " << expression + '=' + value); - m_scriptEngine->evaluate(expression + '=' + value); + XSDEBUG("ASSIGNING: " << (expression + QLatin1Char('=') + value)); + m_scriptEngine->evaluate(expression + QLatin1Char('=') + value); updateLocals(); } @@ -652,16 +653,17 @@ void ScriptEngine::updateLocals() manager()->stackHandler()->setFrames(stackFrames); // - // Build locals + // Build locals, deactivate agent meanwhile. // + m_scriptEngine->setAgent(0); + WatchData data; data.iname = "local"; - data.name = "local"; + data.name = QString::fromLatin1(data.iname); data.scriptValue = context->activationObject(); manager()->watchHandler()->beginCycle(); updateSubItem(data); manager()->watchHandler()->endCycle(); - // FIXME: Use an extra thread. This here is evil m_stopped = true; showStatusMessage(tr("Stopped."), 5000); @@ -669,116 +671,122 @@ void ScriptEngine::updateLocals() //SDEBUG("LOOPING"); QApplication::processEvents(); } - //SDEBUG("RUNNING AGAIN"); + setState(InferiorRunningRequested); + setState(InferiorRunning); + // Clear any exceptions occurred during locals evaluation. + m_scriptEngine->clearExceptions(); + m_scriptEngine->setAgent(m_scriptAgent.data()); + SDEBUG("Continuing"); } void ScriptEngine::updateWatchData(const WatchData &data) { updateSubItem(data); - //manager()->watchHandler()->rebuildModel(); +} + +static inline QString msgDebugInsert(const WatchData &d0, const QList<WatchData>& children) +{ + QString rc; + QTextStream str(&rc); + str << "INSERTING " << d0.toString() << '\n'; + foreach(const WatchData &c, children) + str << " " << c.toString() << '\n'; + return rc; } void ScriptEngine::updateSubItem(const WatchData &data0) { WatchData data = data0; - //SDEBUG("\nUPDATE SUBITEM: " << data.toString()); + QList<WatchData> children; + SDEBUG("\nUPDATE SUBITEM: " << data.toString() << data.scriptValue.toString()); QTC_ASSERT(data.isValid(), return); if (data.isTypeNeeded() || data.isValueNeeded()) { - QScriptValue ob = data.scriptValue; + const QScriptValue &ob = data.scriptValue; if (ob.isArray()) { - data.setType("Array"); - data.setValue(" "); + data.setType(QLatin1String("Array"), false); + data.setValue(QString(QLatin1Char(' '))); } else if (ob.isBool()) { - data.setType("Bool"); - data.setValue(ob.toBool() ? "true" : "false"); + data.setType(QLatin1String("Bool"), false); + data.setValue(ob.toBool() ? QLatin1String("true") : QLatin1String("false")); data.setHasChildren(false); } else if (ob.isDate()) { - data.setType("Date"); - data.setValue(ob.toDateTime().toString().toUtf8()); + data.setType(QLatin1String("Date"), false); + data.setValue(ob.toDateTime().toString()); data.setHasChildren(false); } else if (ob.isError()) { - data.setType("Error"); - data.setValue(" "); + data.setType(QLatin1String("Error"), false); + data.setValue(QString(QLatin1Char(' '))); } else if (ob.isFunction()) { - data.setType("Function"); - data.setValue(" "); + data.setType(QLatin1String("Function"), false); + data.setValue(QString(QLatin1Char(' '))); } else if (ob.isNull()) { - data.setType("<null>"); - data.setValue("<null>"); + const QString nullValue = QLatin1String("<null>"); + data.setType(nullValue, false); + data.setValue(nullValue); } else if (ob.isNumber()) { - data.setType("Number"); - data.setValue(QString::number(ob.toNumber()).toUtf8()); + data.setType(QLatin1String("Number"), false); + data.setValue(QString::number(ob.toNumber())); data.setHasChildren(false); } else if (ob.isObject()) { - data.setType("Object"); - data.setValue(" "); + data.setType(QLatin1String("Object"), false); + data.setValue(QString(QLatin1Char(' '))); } else if (ob.isQMetaObject()) { - data.setType("QMetaObject"); - data.setValue(" "); + data.setType(QLatin1String("QMetaObject"), false); + data.setValue(QString(QLatin1Char(' '))); } else if (ob.isQObject()) { - data.setType("QObject"); - data.setValue(" "); + data.setType(QLatin1String("QObject"), false); + data.setValue(QString(QLatin1Char(' '))); } else if (ob.isRegExp()) { - data.setType("RegExp"); - data.setValue(ob.toRegExp().pattern().toUtf8()); + data.setType(QLatin1String("RegExp"), false); + data.setValue(ob.toRegExp().pattern()); } else if (ob.isString()) { - data.setType("String"); - data.setValue(ob.toString().toUtf8()); + data.setType(QLatin1String("String"), false); + data.setValue(ob.toString()); } else if (ob.isVariant()) { - data.setType("Variant"); - data.setValue(" "); + data.setType(QLatin1String("Variant"), false); + data.setValue(QString(QLatin1Char(' '))); } else if (ob.isUndefined()) { - data.setType("<undefined>"); - data.setValue("<unknown>"); + data.setType(QLatin1String("<undefined>"), false); + data.setValue(QLatin1String("<unknown>")); data.setHasChildren(false); } else { - data.setType("<unknown>"); - data.setValue("<unknown>"); + const QString unknown = QLatin1String("<unknown>"); + data.setType(unknown, false); + data.setValue(unknown); data.setHasChildren(false); } - manager()->watchHandler()->insertData(data); - return; } if (data.isChildrenNeeded()) { - int numChild = 0; QScriptValueIterator it(data.scriptValue); while (it.hasNext()) { it.next(); WatchData data1; - data1.iname = data.iname + "." + it.name().toLatin1(); + data1.iname = data.iname + '.' + it.name().toLatin1(); data1.exp = it.name().toLatin1(); data1.name = it.name(); data1.scriptValue = it.value(); - if (manager()->watchHandler()->isExpandedIName(data1.iname)) + if (manager()->watchHandler()->isExpandedIName(data1.iname)) { data1.setChildrenNeeded(); - else + } else { data1.setChildrenUnneeded(); - manager()->watchHandler()->insertData(data1); - ++numChild; + } + children.push_back(data1); } - //SDEBUG(" ... CHILDREN: " << numChild); - data.setHasChildren(numChild > 0); + data.setHasChildren(!children.isEmpty()); data.setChildrenUnneeded(); - manager()->watchHandler()->insertData(data); - return; } if (data.isHasChildrenNeeded()) { - int numChild = 0; QScriptValueIterator it(data.scriptValue); - while (it.hasNext()) { - it.next(); - ++numChild; - } - data.setHasChildren(numChild > 0); - //SDEBUG(" ... CHILDCOUNT: " << numChild); - manager()->watchHandler()->insertData(data); - return; + data.setHasChildren(it.hasNext()); } - QTC_ASSERT(false, return); + SDEBUG(msgDebugInsert(data, children)); + manager()->watchHandler()->insertData(data); + if (!children.isEmpty()) + manager()->watchHandler()->insertBulkData(children); } void ScriptEngine::showDebuggerOutput(int channel, const QString &m) diff --git a/src/plugins/debugger/script/scriptengine.h b/src/plugins/debugger/script/scriptengine.h index 8af60d54a7252350748b92054c477524cd2e5ed3..129b9be2996dbc773d7532a3a5f6a99a1f3c7735 100644 --- a/src/plugins/debugger/script/scriptengine.h +++ b/src/plugins/debugger/script/scriptengine.h @@ -30,33 +30,28 @@ #ifndef DEBUGGER_SCRIPTENGINE_H #define DEBUGGER_SCRIPTENGINE_H -#include <QtCore/QByteArray> -#include <QtCore/QHash> -#include <QtCore/QMap> -#include <QtCore/QObject> -#include <QtCore/QProcess> -#include <QtCore/QPoint> -#include <QtCore/QSet> -#include <QtCore/QVariant> +#include "idebuggerengine.h" + #include <QtCore/QSharedPointer> #include <QtCore/QScopedPointer> QT_BEGIN_NAMESPACE -class QAction; -class QAbstractItemModel; -class QSplitter; class QScriptEngine; class QScriptValue; QT_END_NAMESPACE -#include "idebuggerengine.h" - namespace Debugger { namespace Internal { class ScriptAgent; class WatchData; +/* A debugger engine for a QScriptEngine implemented using a QScriptEngineAgent. + * listening on script events. The engine has a special execution model: + * The script is executed in the foreground, while the debugger runs in + * processEvents() triggered by QScriptEngine::setProcessEventsInterval(). + * Stopping is emulated by manually calling processEvents() from the debugger engine. */ + class ScriptEngine : public IDebuggerEngine { Q_OBJECT diff --git a/src/plugins/help/centralwidget.cpp b/src/plugins/help/centralwidget.cpp index 0080f062b85faf752ebe8c21e37be6c060e1868c..67dbc09c6528f002e9ebd2328a021f8eeec59430 100644 --- a/src/plugins/help/centralwidget.cpp +++ b/src/plugins/help/centralwidget.cpp @@ -209,7 +209,9 @@ void CentralWidget::closeTab(int index) if (!viewer || tabWidget->count() == 1) return; + emit viewerAboutToBeRemoved(index); tabWidget->removeTab(index); + emit viewerRemoved(index); QTimer::singleShot(0, viewer, SLOT(deleteLater())); } @@ -484,6 +486,13 @@ HelpViewer *CentralWidget::helpViewerAtIndex(int index) const return qobject_cast<HelpViewer*>(tabWidget->widget(index)); } +int CentralWidget::indexOf(HelpViewer *viewer) const +{ + if (!viewer) + return -1; + return tabWidget->indexOf(viewer); +} + HelpViewer *CentralWidget::currentHelpViewer() const { return qobject_cast<HelpViewer*>(tabWidget->currentWidget()); @@ -529,7 +538,7 @@ void CentralWidget::currentPageChanged(int index) tabWidget->setTabsClosable(tabWidget->count() > 1); tabWidget->cornerWidget(Qt::TopLeftCorner)->setEnabled(true); - emit currentViewerChanged(); + emit currentViewerChanged(index); } void CentralWidget::showTabBarContextMenu(const QPoint &point) @@ -711,6 +720,11 @@ void CentralWidget::copy() viewer->copy(); } +void CentralWidget::activateTab(int index) +{ + tabWidget->setCurrentIndex(index); +} + QString CentralWidget::quoteTabTitle(const QString &title) const { QString s = title; diff --git a/src/plugins/help/centralwidget.h b/src/plugins/help/centralwidget.h index 001118abc814df62860e171094f3ca8508dca286..78f92318fee4e7f74bedb65d69494578fad53874 100644 --- a/src/plugins/help/centralwidget.h +++ b/src/plugins/help/centralwidget.h @@ -77,6 +77,7 @@ public: bool find(const QString &txt, QTextDocument::FindFlags findFlags, bool incremental); void setLastShownPages(); HelpViewer *helpViewerAtIndex(int index) const; + int indexOf(HelpViewer *viewer) const; static CentralWidget *instance(); @@ -99,12 +100,13 @@ public slots: void showTopicChooser(const QMap<QString, QUrl> &links, const QString &keyword); void copy(); + void activateTab(int index); protected: void focusInEvent(QFocusEvent *event); signals: - void currentViewerChanged(); + void currentViewerChanged(int index); void copyAvailable(bool yes); void sourceChanged(const QUrl &url); void highlighted(const QString &link); @@ -112,6 +114,9 @@ signals: void backwardAvailable(bool available); void addNewBookmark(const QString &title, const QString &url); + void viewerAboutToBeRemoved(int index); + void viewerRemoved(int index); + private slots: void newTab(); void closeTab(); diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index 367aead0f35e72a0e6510ad96ce5851ecbe36ce0..8960f2022844550466d624d96348e425a7ca518d 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -522,7 +522,7 @@ void HelpPlugin::createRightPaneSideBar() this)); connect(m_centralWidget, SIGNAL(sourceChanged(QUrl)), this, SLOT(updateSideBarSource(QUrl))); - connect(m_centralWidget, SIGNAL(currentViewerChanged()), this, + connect(m_centralWidget, SIGNAL(currentViewerChanged(int)), this, SLOT(updateSideBarSource())); QAction *copyActionSideBar = new QAction(this); @@ -693,6 +693,13 @@ void HelpPlugin::extensionsInitialized() "index.html").arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR)); } m_helpEngine->setCustomValue(QLatin1String("DefaultHomePage"), url.toString()); + + connect(m_centralWidget, SIGNAL(sourceChanged(QUrl)), this, + SLOT(rebuildViewerComboBox())); + connect(m_centralWidget, SIGNAL(currentViewerChanged(int)), this, + SLOT(updateViewerComboBoxIndex(int))); + connect(m_centralWidget, SIGNAL(viewerAboutToBeRemoved(int)), this, + SLOT(removeViewerFromComboBox(int))); } void HelpPlugin::shutdown() @@ -756,6 +763,31 @@ void HelpPlugin::fontChanged() #endif } +void HelpPlugin::rebuildViewerComboBox() +{ + m_documentsCombo->clear(); + + int i = 0; + while (HelpViewer *viewer = m_centralWidget->helpViewerAtIndex(i++)) + m_documentsCombo->addItem(viewer->documentTitle()); + + int index = m_centralWidget->indexOf(m_centralWidget->currentHelpViewer()); + if (index >= 0) + m_documentsCombo->setCurrentIndex(index); +} + +void HelpPlugin::removeViewerFromComboBox(int index) +{ + if (index >= 0) + m_documentsCombo->removeItem(index); +} + +void HelpPlugin::updateViewerComboBoxIndex(int index) +{ + if (index >= 0) + m_documentsCombo->setCurrentIndex(index); +} + HelpViewer* HelpPlugin::viewerForContextMode() { HelpViewer *viewer = 0; @@ -873,16 +905,25 @@ QToolBar *HelpPlugin::createToolBar() toolWidget->addSeparator(); QWidget *w = new QWidget; + toolWidget->addWidget(w); + QHBoxLayout *layout = new QHBoxLayout(w); layout->setMargin(0); layout->addSpacing(10); + m_documentsCombo = new QComboBox; + m_documentsCombo->setMinimumContentsLength(40); + layout->addWidget(m_documentsCombo); + + connect(m_documentsCombo, SIGNAL(activated(int)), m_centralWidget, + SLOT(activateTab(int))); + layout->addWidget(new QLabel(tr("Filtered by:"))); m_filterComboBox = new QComboBox; m_filterComboBox->setMinimumContentsLength(20); + layout->addWidget(m_filterComboBox); + connect(m_filterComboBox, SIGNAL(activated(QString)), this, SLOT(filterDocumentation(QString))); - layout->addWidget(m_filterComboBox); - toolWidget->addWidget(w); return toolWidget; } diff --git a/src/plugins/help/helpplugin.h b/src/plugins/help/helpplugin.h index 32a7d7428a164521fced112f7bd37eeab4e678b3..f679b483941a8af2a4a4a9c3a73e084d06a65aab 100644 --- a/src/plugins/help/helpplugin.h +++ b/src/plugins/help/helpplugin.h @@ -143,6 +143,10 @@ private slots: void fontChanged(); + void rebuildViewerComboBox(); + void removeViewerFromComboBox(int index); + void updateViewerComboBoxIndex(int index); + private: QToolBar *createToolBar(); void createRightPaneSideBar(); @@ -170,6 +174,7 @@ private: DocSettingsPage *m_docSettingsPage; FilterSettingsPage *m_filterSettingsPage; + QComboBox *m_documentsCombo; QComboBox *m_filterComboBox; Core::SideBar *m_sideBar; QWidget *m_rightPaneSideBar; diff --git a/src/plugins/projectexplorer/images/targetbuildselected.png b/src/plugins/projectexplorer/images/targetbuildselected.png new file mode 100644 index 0000000000000000000000000000000000000000..f1cf44c08b97cd29655a9af67f07e772a195060a Binary files /dev/null and b/src/plugins/projectexplorer/images/targetbuildselected.png differ diff --git a/src/plugins/projectexplorer/images/targetrunselected.png b/src/plugins/projectexplorer/images/targetrunselected.png new file mode 100644 index 0000000000000000000000000000000000000000..228287b3e102ade477734619d48d60bb15fe0427 Binary files /dev/null and b/src/plugins/projectexplorer/images/targetrunselected.png differ diff --git a/src/plugins/projectexplorer/images/targetseparatorbackground.png b/src/plugins/projectexplorer/images/targetseparatorbackground.png new file mode 100644 index 0000000000000000000000000000000000000000..ff14f0d6737a1e08d2ea6444a34d76aaf7a12511 Binary files /dev/null and b/src/plugins/projectexplorer/images/targetseparatorbackground.png differ diff --git a/src/plugins/projectexplorer/images/targetunselected.png b/src/plugins/projectexplorer/images/targetunselected.png new file mode 100644 index 0000000000000000000000000000000000000000..2df56444182b87e036c7c3343e73e183663d4bf7 Binary files /dev/null and b/src/plugins/projectexplorer/images/targetunselected.png differ diff --git a/src/plugins/projectexplorer/projectexplorer.pro b/src/plugins/projectexplorer/projectexplorer.pro index da492ea272d1d7284180020571ce1dffdb52c078..981a42da11a9d60f0e7c883fc8b83cc8fe982685 100644 --- a/src/plugins/projectexplorer/projectexplorer.pro +++ b/src/plugins/projectexplorer/projectexplorer.pro @@ -66,7 +66,9 @@ HEADERS += projectexplorer.h \ projectexplorersettingspage.h \ projectwelcomepage.h \ projectwelcomepagewidget.h \ - baseprojectwizarddialog.h + baseprojectwizarddialog.h \ + targetselector.h \ + targetsettingswidget.h SOURCES += projectexplorer.cpp \ projectwindow.cpp \ buildmanager.cpp \ @@ -120,7 +122,9 @@ SOURCES += projectexplorer.cpp \ projectwelcomepage.cpp \ projectwelcomepagewidget.cpp \ corelistenercheckingforrunningbuild.cpp \ - baseprojectwizarddialog.cpp + baseprojectwizarddialog.cpp \ + targetselector.cpp \ + targetsettingswidget.cpp FORMS += processstep.ui \ editorsettingspropertiespage.ui \ runsettingspropertiespage.ui \ @@ -128,7 +132,8 @@ FORMS += processstep.ui \ projectwizardpage.ui \ removefiledialog.ui \ projectexplorersettingspage.ui \ - projectwelcomepagewidget.ui + projectwelcomepagewidget.ui \ + targetsettingswidget.ui win32 { SOURCES += applicationlauncher_win.cpp \ diff --git a/src/plugins/projectexplorer/projectexplorer.qrc b/src/plugins/projectexplorer/projectexplorer.qrc index a9e1b3488ef87e86122d933edbe2af22cbf336ef..2c1f8f1683e701b02b882971fd9ed6366b78863e 100644 --- a/src/plugins/projectexplorer/projectexplorer.qrc +++ b/src/plugins/projectexplorer/projectexplorer.qrc @@ -1,5 +1,5 @@ <RCC> - <qresource prefix="/projectexplorer" > + <qresource prefix="/projectexplorer"> <file>images/build.png</file> <file>images/build_small.png</file> <file>images/clean.png</file> @@ -19,5 +19,9 @@ <file>images/run_small.png</file> <file>images/session.png</file> <file>images/stop.png</file> + <file>images/targetbuildselected.png</file> + <file>images/targetrunselected.png</file> + <file>images/targetseparatorbackground.png</file> + <file>images/targetunselected.png</file> </qresource> </RCC> diff --git a/src/plugins/projectexplorer/targetselector.cpp b/src/plugins/projectexplorer/targetselector.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1a14de2e3eeace062f8dd15fb5f75d991f12d6bb --- /dev/null +++ b/src/plugins/projectexplorer/targetselector.cpp @@ -0,0 +1,129 @@ +#include "targetselector.h" + +#include <QtGui/QPainter> +#include <QtGui/QMouseEvent> +#include <QtGui/QFontMetrics> + +static const int TARGET_WIDTH = 109; +static const int TARGET_HEIGHT = 43; +static const int ADDBUTTON_WIDTH = 27; + +using namespace ProjectExplorer::Internal; + +TargetSelector::TargetSelector(QWidget *parent) : + QWidget(parent), + m_currentTargetIndex(-1) +{ + QFont f = font(); + f.setPixelSize(10); + f.setBold(true); + setFont(f); +} + +void TargetSelector::addTarget(const QString &name) +{ + Target target; + target.name = name; + target.currentSubIndex = 0; + m_targets.append(target); + if (m_currentTargetIndex == -1) + m_currentTargetIndex = m_targets.size() - 1; + update(); +} + +void TargetSelector::removeTarget(int index) +{ + m_targets.removeAt(index); + update(); +} + +TargetSelector::Target TargetSelector::targetAt(int index) const +{ + return m_targets.at(index); +} + +QSize TargetSelector::minimumSizeHint() const +{ + return QSize((TARGET_WIDTH + 1) * m_targets.size() + ADDBUTTON_WIDTH + 2, TARGET_HEIGHT + 2); +} + +void TargetSelector::mousePressEvent(QMouseEvent *event) +{ + if (event->x() > (TARGET_WIDTH + 1) * m_targets.size()) { + // check for add button + event->accept(); + emit addButtonClicked(); + } else { + // find the clicked target button + int x = 1; + int index; + for (index = 0; index < m_targets.size(); ++index) { + if (event->x() <= x) { + break; + } + x += TARGET_WIDTH + 1; + } + --index; + if (index >= 0 && index < m_targets.size()) { + // handle clicked target + // check if user clicked on Build or Run + if (event->y() > TARGET_HEIGHT * 3/5) { + if ((event->x() - (TARGET_WIDTH + 1) * index) - 2 > TARGET_WIDTH / 2) { + m_targets[index].currentSubIndex = 1; + } else { + m_targets[index].currentSubIndex = 0; + } + } + m_currentTargetIndex = index; + //TODO don't emit if nothing changed! + update(); + emit currentIndexChanged(m_currentTargetIndex, m_targets.at(m_currentTargetIndex).currentSubIndex); + } else { + event->ignore(); + } + } +} + +void TargetSelector::paintEvent(QPaintEvent *event) +{ + static QPixmap unselected(":/projectexplorer/targetunselected.png"); + static QPixmap runselected(":/projectexplorer/targetrunselected.png"); + static QPixmap buildselected(":/projectexplorer/targetbuildselected.png"); + static QPixmap targetaddbutton(":/projectexplorer/targetaddbutton.png"); + Q_UNUSED(event) + + QPainter p(this); + p.setPen(QColor(89, 89, 89)); + QSize size = minimumSizeHint(); + //draw frame + p.drawLine(1, 0, size.width() - 2, 0); + p.drawLine(1, size.height() - 1, size.width() - 2, size.height() - 1); + p.drawLine(0, 1, 0, size.height() - 2); + p.drawLine(size.width() - 1, 1, size.width() - 1, size.height() - 2); + //draw targets + int x = 1; + int index = 0; + QFontMetrics fm(font()); + foreach (const Target &target, m_targets) { + QPixmap *pixmap = &unselected; + if (index == m_currentTargetIndex) { + p.setPen(QColor(255, 255, 255)); + if (target.currentSubIndex == 0) { + pixmap = &buildselected; + } else { + pixmap = &runselected; + } + } else { + p.setPen(QColor(0, 0, 0)); + } + p.drawPixmap(x, 1, *pixmap); + p.drawText(x + (TARGET_WIDTH - fm.width(target.name))/2 + 1, 7 + fm.ascent(), + target.name); + x += TARGET_WIDTH; + p.drawLine(x, 1, x, TARGET_HEIGHT); + ++x; + ++index; + } + // draw add button + p.drawPixmap(x, 1, targetaddbutton); +} diff --git a/src/plugins/projectexplorer/targetselector.h b/src/plugins/projectexplorer/targetselector.h new file mode 100644 index 0000000000000000000000000000000000000000..212f25949680cb0483b3424d023b92bdd41426b5 --- /dev/null +++ b/src/plugins/projectexplorer/targetselector.h @@ -0,0 +1,48 @@ +#ifndef TARGETSELECTOR_H +#define TARGETSELECTOR_H + +#include <QWidget> + +namespace ProjectExplorer { +namespace Internal { + +class TargetSelector : public QWidget +{ +Q_OBJECT +public: + struct Target { + QString name; + int currentSubIndex; + }; + + explicit TargetSelector(QWidget *parent = 0); + + QSize minimumSizeHint() const; + + Target targetAt(int index) const; + int targetCount() const { return m_targets.size(); } + int currentIndex() const { return m_currentTargetIndex; } + int currentSubIndex() const { return m_targets.at(m_currentTargetIndex).currentSubIndex; } + +public slots: + void addTarget(const QString &name); + void removeTarget(int index); + +signals: + void addButtonClicked(); + void currentIndexChanged(int targetIndex, int subIndex); + +protected: + void paintEvent(QPaintEvent *event); + void mousePressEvent(QMouseEvent *event); + +private: + QList<Target> m_targets; + + int m_currentTargetIndex; +}; + +} // namespace Internal +} // namespace ProjectExplorer + +#endif // TARGETSELECTOR_H diff --git a/src/plugins/projectexplorer/targetsettingswidget.cpp b/src/plugins/projectexplorer/targetsettingswidget.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6a45a4f9ed47cde9b8e144f8a7927b6608109edc --- /dev/null +++ b/src/plugins/projectexplorer/targetsettingswidget.cpp @@ -0,0 +1,83 @@ +#include "targetsettingswidget.h" +#include "ui_targetsettingswidget.h" + +static int WIDTH = 750; + +using namespace ProjectExplorer::Internal; + +TargetSettingsWidget::TargetSettingsWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::TargetSettingsWidget), + m_targetSelector(new TargetSelector(this)) +{ + ui->setupUi(this); + ui->separator->setStyleSheet(QLatin1String("* { " + "background-image: url(:/projectexplorer/images/targetseparatorbackground.png);" + "}")); + m_targetSelector->raise(); + connect(m_targetSelector, SIGNAL(addButtonClicked()), + this, SIGNAL(addButtonClicked())); + connect(m_targetSelector, SIGNAL(currentIndexChanged(int,int)), + this, SIGNAL(currentIndexChanged(int,int))); + updateTargetSelector(); +} + +TargetSettingsWidget::~TargetSettingsWidget() +{ + delete ui; +} + +void TargetSettingsWidget::addTarget(const QString &name) +{ + m_targetSelector->addTarget(name); + updateTargetSelector(); +} + +void TargetSettingsWidget::removeTarget(int index) +{ + m_targetSelector->removeTarget(index); +} + +QString TargetSettingsWidget::targetNameAt(int index) const +{ + return m_targetSelector->targetAt(index).name; +} + +void TargetSettingsWidget::setCentralWidget(QWidget *widget) +{ + ui->scrollArea->setWidget(widget); +} + +int TargetSettingsWidget::targetCount() const +{ + return m_targetSelector->targetCount(); +} + +int TargetSettingsWidget::currentIndex() const +{ + return m_targetSelector->currentIndex(); +} + +int TargetSettingsWidget::currentSubIndex() const +{ + return m_targetSelector->currentSubIndex(); +} + +void TargetSettingsWidget::updateTargetSelector() +{ + m_targetSelector->setGeometry((WIDTH-m_targetSelector->minimumSizeHint().width())/2, 12, + m_targetSelector->minimumSizeHint().width(), + m_targetSelector->minimumSizeHint().height()); +} + +void TargetSettingsWidget::changeEvent(QEvent *e) +{ + QWidget::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} diff --git a/src/plugins/projectexplorer/targetsettingswidget.h b/src/plugins/projectexplorer/targetsettingswidget.h new file mode 100644 index 0000000000000000000000000000000000000000..ca4d8b26eaaed898b8a22b7741268c659b6729c1 --- /dev/null +++ b/src/plugins/projectexplorer/targetsettingswidget.h @@ -0,0 +1,49 @@ +#ifndef TARGETSETTINGSWIDGET_H +#define TARGETSETTINGSWIDGET_H + +#include "targetselector.h" + +#include <QWidget> + +namespace ProjectExplorer { +namespace Internal { + +namespace Ui { + class TargetSettingsWidget; +} + +class TargetSettingsWidget : public QWidget { + Q_OBJECT +public: + explicit TargetSettingsWidget(QWidget *parent = 0); + ~TargetSettingsWidget(); + + void setCentralWidget(QWidget *widget); + + QString targetNameAt(int index) const; + int targetCount() const; + int currentIndex() const; + int currentSubIndex() const; + +public slots: + void addTarget(const QString &name); + void removeTarget(int index); + +signals: + void addButtonClicked(); + void currentIndexChanged(int targetIndex, int subIndex); + +protected: + void changeEvent(QEvent *e); + +private: + void updateTargetSelector(); + Ui::TargetSettingsWidget *ui; + + TargetSelector *m_targetSelector; +}; + +} // namespace Internal +} // namespace ProjectExplorer + +#endif // TARGETSETTINGSWIDGET_H diff --git a/src/plugins/projectexplorer/targetsettingswidget.ui b/src/plugins/projectexplorer/targetsettingswidget.ui new file mode 100644 index 0000000000000000000000000000000000000000..64f25f70a9655653271d7b801f6068161edbeb0d --- /dev/null +++ b/src/plugins/projectexplorer/targetsettingswidget.ui @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>ProjectExplorer::Internal::TargetSettingsWidget</class> + <widget class="QWidget" name="ProjectExplorer::Internal::TargetSettingsWidget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>618</width> + <height>454</height> + </rect> + </property> + <property name="windowTitle"> + <string>TargetSettingsWidget</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>0</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QWidget" name="separator" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>50</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>50</height> + </size> + </property> + </widget> + </item> + <item> + <widget class="QScrollArea" name="scrollArea"> + <property name="widgetResizable"> + <bool>true</bool> + </property> + <widget class="QWidget" name="scrollAreaWidgetContents"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>614</width> + <height>400</height> + </rect> + </property> + </widget> + </widget> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11"/> + <resources/> + <connections/> +</ui> diff --git a/src/plugins/qmldesigner/components/formeditor/boundingrect.png b/src/plugins/qmldesigner/components/formeditor/boundingrect.png new file mode 100644 index 0000000000000000000000000000000000000000..cba76cac6613704860f27167bb1eb5f0562fdc44 Binary files /dev/null and b/src/plugins/qmldesigner/components/formeditor/boundingrect.png differ diff --git a/src/plugins/qmldesigner/components/formeditor/formeditor.qrc b/src/plugins/qmldesigner/components/formeditor/formeditor.qrc index 14e0dbd0fbdfb6c455e1ed2e4ca110b4a8ebca8e..12ad311853b260e26e5f58723be95a15c08fb501 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditor.qrc +++ b/src/plugins/qmldesigner/components/formeditor/formeditor.qrc @@ -8,5 +8,6 @@ </qresource> <qresource prefix="/icon/layout"> <file>snapping.png</file> + <file>boundingrect.png</file> </qresource> </RCC> diff --git a/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp b/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp index a6d7db612c3777f928dc69a02d9156fc97c59473..9918b67ba9203466dbcc95d1837b1af6676ba502 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp @@ -231,7 +231,9 @@ void FormEditorItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, qmlItemNode().paintInstance(painter); painter->setRenderHint(QPainter::Antialiasing, false); - paintBoundingRect(painter); + + if (scene()->showBoundingRects()) + paintBoundingRect(painter); painter->restore(); } diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorscene.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorscene.cpp index 9c7c69d67a5cc73f5cfb8ac7c714afd02e7e1406..c521d1935cae3065bc7cac15c446f625b9469184 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorscene.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorscene.cpp @@ -58,8 +58,8 @@ FormEditorScene::FormEditorScene(FormEditorWidget *view, FormEditorView *editorV m_editorView(editorView), m_formLayerItem(new LayerItem(this)), m_manipulatorLayerItem(new LayerItem(this)), - m_paintMode(NormalMode) - + m_paintMode(NormalMode), + m_showBoundingRects(true) { setSceneRect(0, 0, 1, 1); // prevent automatic calculation (causing a recursion), right size will be set later @@ -360,5 +360,16 @@ void FormEditorScene::clearFormEditorItems() } } +void FormEditorScene::setShowBoundingRects(bool show) +{ + m_showBoundingRects = show; + updateAllFormEditorItems(); +} + +bool FormEditorScene::showBoundingRects() const +{ + return m_showBoundingRects; +} + } diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorscene.h b/src/plugins/qmldesigner/components/formeditor/formeditorscene.h index 89098ba7abc734f689857994538a64d200988aa7..bc521fb02eea860b1ef2ba10abb5f0280f80d45d 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorscene.h +++ b/src/plugins/qmldesigner/components/formeditor/formeditorscene.h @@ -93,6 +93,10 @@ public: void clearFormEditorItems(); +public slots: + void setShowBoundingRects(bool show); + bool showBoundingRects() const; + protected: void dropEvent(QGraphicsSceneDragDropEvent * event); void dragEnterEvent(QGraphicsSceneDragDropEvent * event); @@ -123,6 +127,7 @@ private: QWeakPointer<LayerItem> m_manipulatorLayerItem; ModelNode m_dragNode; PaintMode m_paintMode; + bool m_showBoundingRects; }; diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp index 3c0d540bd50d1b4695ca3e3a47f12a9041e3331e..c1a941e46f7984cc9496a6cfa29f79495b353c93 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp @@ -67,6 +67,7 @@ FormEditorView::FormEditorView(QObject *parent) m_currentTool(m_selectionTool) { connect(widget()->zoomAction(), SIGNAL(zoomLevelChanged(double)), SLOT(updateGraphicsIndicators())); + connect(widget()->showBoundingRectAction(), SIGNAL(toggled(bool)), scene(), SLOT(setShowBoundingRects(bool))); } FormEditorScene* FormEditorView::scene() const diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp index 5217711fa4d43cb46f20934ad37c686209ae38b9..6c5eddde2f232d5121d2022b42aa2077987af0ee 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp @@ -90,6 +90,14 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view) m_snappingToolAction->setIcon(QPixmap(":/icon/layout/snapping.png")); connect(m_snappingToolAction.data(), SIGNAL(triggered(bool)), SLOT(changeSnappingTool(bool))); + m_showBoundingRectAction = layoutActionGroup->addAction("Toogle Bounding Rectangles (Press Key R)"); + m_showBoundingRectAction->setShortcut(Qt::Key_R); + m_showBoundingRectAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); + m_showBoundingRectAction->setCheckable(true); + m_showBoundingRectAction->setChecked(true); + m_showBoundingRectAction->setIcon(QPixmap(":/icon/layout/boundingrect.png")); + + m_snappingMarginAction = new NumberSeriesAction(layoutActionGroup); m_snappingMarginAction->addEntry("no margins (0)", 0); m_snappingMarginAction->addEntry("small margin (2)", 2); @@ -179,6 +187,11 @@ QAction *FormEditorWidget::transformToolAction() const return m_transformToolAction.data(); } +QAction *FormEditorWidget::showBoundingRectAction() const +{ + return m_showBoundingRectAction.data(); +} + void FormEditorWidget::setZoomLevel(double zoomLevel) { m_graphicsView->resetTransform(); diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.h b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.h index 2a718507f8070c069771e070171ba51856853645..2f9089b8650366338f364381f5a54a63d7c9ed31 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.h +++ b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.h @@ -53,6 +53,7 @@ public: ZoomAction *zoomAction() const; QAction *anchorToolAction() const; QAction *transformToolAction() const; + QAction *showBoundingRectAction() const; void setScene(FormEditorScene *scene); ToolBox *toolBox() const; @@ -83,6 +84,7 @@ private: QWeakPointer<QAction> m_snappingToolAction; QWeakPointer<NumberSeriesAction> m_snappingMarginAction; QWeakPointer<NumberSeriesAction> m_snappingSpacingAction; + QWeakPointer<QAction> m_showBoundingRectAction; }; diff --git a/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp b/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp index b24792f5990c550d0016a4b0f37f2480cd0a0561..00ea9072db1094974c14a0b33b6cb40cf1f17873 100644 --- a/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp @@ -542,6 +542,8 @@ void DesignDocumentController::deleteSelected() void DesignDocumentController::copySelected() { QScopedPointer<Model> model(Model::create("Qt/Rectangle")); + model->setMetaInfo(m_d->model->metaInfo()); + Q_ASSERT(model); DesignDocumentControllerView view; @@ -603,6 +605,8 @@ void DesignDocumentController::cutSelected() void DesignDocumentController::paste() { QScopedPointer<Model> model(Model::create("empty")); + model->setMetaInfo(m_d->model->metaInfo()); + model->setFileUrl(m_d->model->fileUrl()); Q_ASSERT(model); if (!m_d->model) diff --git a/src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.cpp b/src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.cpp index fa3e42a2f2275a75bb7f7b8c3fe151fd3975388e..abe1c209b08e69ce7cefc80ebda125f41af47fdf 100644 --- a/src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.cpp @@ -30,6 +30,7 @@ #include "designdocumentcontrollerview.h" #include <rewriterview.h> #include <plaintexteditmodifier.h> +#include <metainfo.h> #include <QApplication> #include <QPlainTextEdit> @@ -97,14 +98,15 @@ void DesignDocumentControllerView::fromClipboard() QString DesignDocumentControllerView::toText() const { - QScopedPointer<Model> model(Model::create("Qt/Rectangle")); + QScopedPointer<Model> outputModel(Model::create("Qt/Rectangle")); + outputModel->setMetaInfo(model()->metaInfo()); QPlainTextEdit textEdit; textEdit.setPlainText("import Qt 4.6; Item {}"); PlainTextEditModifier modifier(&textEdit); QScopedPointer<RewriterView> rewriterView(new RewriterView(RewriterView::Amend, 0)); rewriterView->setTextModifier(&modifier); - model->attachView(rewriterView.data()); + outputModel->attachView(rewriterView.data()); ModelMerger merger(rewriterView.data()); @@ -118,7 +120,9 @@ QString DesignDocumentControllerView::toText() const void DesignDocumentControllerView::fromText(QString text) { - QScopedPointer<Model> model(Model::create("Qt/Rectangle")); + QScopedPointer<Model> inputModel(Model::create("Qt/Rectangle")); + inputModel->setMetaInfo(model()->metaInfo()); + inputModel->setFileUrl(model()->fileUrl()); QPlainTextEdit textEdit; QString imports("import Qt 4.6;\n"); textEdit.setPlainText(imports + text); @@ -126,7 +130,7 @@ void DesignDocumentControllerView::fromText(QString text) QScopedPointer<RewriterView> rewriterView(new RewriterView(RewriterView::Amend, 0)); rewriterView->setTextModifier(&modifier); - model->attachView(rewriterView.data()); + inputModel->attachView(rewriterView.data()); if (rewriterView->errors().isEmpty() && rewriterView->rootModelNode().isValid()) { ModelMerger merger(this); diff --git a/src/plugins/qmldesigner/core/filemanager/astobjecttextextractor.cpp b/src/plugins/qmldesigner/core/filemanager/astobjecttextextractor.cpp index 8b5d4ad9649dce81ab1dd6c253d4e12b243cb2ff..d9aca5fd8da742e56df507d61d153b2e34d0fa15 100644 --- a/src/plugins/qmldesigner/core/filemanager/astobjecttextextractor.cpp +++ b/src/plugins/qmldesigner/core/filemanager/astobjecttextextractor.cpp @@ -31,15 +31,15 @@ #include <qmljs/parser/qmljsast_p.h> -using namespace Qml; +using namespace QmlJS; using namespace QmlDesigner; using namespace QmlJS::AST; ASTObjectTextExtractor::ASTObjectTextExtractor(const QString &text): - m_document(QmlDocument::create("<ASTObjectTextExtractor>")) + m_document(Document::create("<ASTObjectTextExtractor>")) { m_document->setSource(text); - m_document->parse(); + m_document->parseQml(); } QString ASTObjectTextExtractor::operator ()(int location) @@ -49,7 +49,7 @@ QString ASTObjectTextExtractor::operator ()(int location) m_location = location; m_text.clear(); - Node::accept(m_document->program(), this); + Node::accept(m_document->qmlProgram(), this); return m_text; } diff --git a/src/plugins/qmldesigner/core/filemanager/astobjecttextextractor.h b/src/plugins/qmldesigner/core/filemanager/astobjecttextextractor.h index 47c48a3ec84518a9b8b2fe1b6847c6ed4c1b9a1e..0ace3ae0178e0d67b7294fe6548bb2be307a91f8 100644 --- a/src/plugins/qmldesigner/core/filemanager/astobjecttextextractor.h +++ b/src/plugins/qmldesigner/core/filemanager/astobjecttextextractor.h @@ -31,7 +31,7 @@ #define ASTOBJECTTEXTEXTRACTOR_H #include <qmljs/parser/qmljsastvisitor_p.h> -#include <qmljs/qmldocument.h> +#include <qmljs/qmljsdocument.h> #include <QtCore/QString> @@ -49,7 +49,7 @@ protected: virtual bool visit(QmlJS::AST::UiObjectDefinition *ast); private: - Qml::QmlDocument::Ptr m_document; + QmlJS::Document::Ptr m_document; quint32 m_location; QString m_text; }; diff --git a/src/plugins/qmldesigner/core/filemanager/firstdefinitionfinder.cpp b/src/plugins/qmldesigner/core/filemanager/firstdefinitionfinder.cpp index 3063d821cf5702b5da4e937375d764e07cdb2063..692de4127af08fdc007bb74c4be25d3fe57bae6d 100644 --- a/src/plugins/qmldesigner/core/filemanager/firstdefinitionfinder.cpp +++ b/src/plugins/qmldesigner/core/filemanager/firstdefinitionfinder.cpp @@ -31,15 +31,15 @@ #include <qmljs/parser/qmljsast_p.h> -using namespace Qml; +using namespace QmlJS; using namespace QmlDesigner; using namespace QmlJS::AST; FirstDefinitionFinder::FirstDefinitionFinder(const QString &text): - m_doc(QmlDocument::create("<internal>")) + m_doc(Document::create("<internal>")) { m_doc->setSource(text); - bool ok = m_doc->parse(); + bool ok = m_doc->parseQml(); Q_ASSERT(ok); } @@ -56,7 +56,7 @@ quint32 FirstDefinitionFinder::operator()(quint32 offset) m_offset = offset; m_firstObjectDefinition = 0; - Node::accept(m_doc->program(), this); + Node::accept(m_doc->qmlProgram(), this); return m_firstObjectDefinition->firstSourceLocation().offset; } diff --git a/src/plugins/qmldesigner/core/filemanager/firstdefinitionfinder.h b/src/plugins/qmldesigner/core/filemanager/firstdefinitionfinder.h index 869b9e173fd1e3c0f110a085389e2bdd79de3446..6f680b9a36c25ec322ceea333e607183fd28f699 100644 --- a/src/plugins/qmldesigner/core/filemanager/firstdefinitionfinder.h +++ b/src/plugins/qmldesigner/core/filemanager/firstdefinitionfinder.h @@ -31,7 +31,7 @@ #define FIRSTDEFINITIONFINDER_H #include <qmljs/parser/qmljsastvisitor_p.h> -#include <qmljs/qmldocument.h> +#include <qmljs/qmljsdocument.h> namespace QmlDesigner { @@ -51,7 +51,7 @@ protected: void extractFirstObjectDefinition(QmlJS::AST::UiObjectInitializer* ast); private: - Qml::QmlDocument::Ptr m_doc; + QmlJS::Document::Ptr m_doc; quint32 m_offset; QmlJS::AST::UiObjectDefinition *m_firstObjectDefinition; diff --git a/src/plugins/qmldesigner/core/filemanager/objectlengthcalculator.cpp b/src/plugins/qmldesigner/core/filemanager/objectlengthcalculator.cpp index 88dbe6d1db430527694bafa765608a9bd6822cac..6cf10915b9d191fc7d9fb3776d5c619471493d4b 100644 --- a/src/plugins/qmldesigner/core/filemanager/objectlengthcalculator.cpp +++ b/src/plugins/qmldesigner/core/filemanager/objectlengthcalculator.cpp @@ -31,15 +31,15 @@ #include <qmljs/parser/qmljsast_p.h> -using namespace Qml; +using namespace QmlJS; using namespace QmlDesigner; using namespace QmlJS::AST; ObjectLengthCalculator::ObjectLengthCalculator(const QString &text): - m_doc(QmlDocument::create("<internal>")) + m_doc(Document::create("<internal>")) { m_doc->setSource(text); - bool ok = m_doc->parse(); + bool ok = m_doc->parseQml(); Q_ASSERT(ok); } @@ -49,7 +49,7 @@ quint32 ObjectLengthCalculator::operator()(quint32 offset) m_offset = offset; m_length = 0; - Node::accept(m_doc->program(), this); + Node::accept(m_doc->qmlProgram(), this); return m_length; } diff --git a/src/plugins/qmldesigner/core/filemanager/objectlengthcalculator.h b/src/plugins/qmldesigner/core/filemanager/objectlengthcalculator.h index c796dfee0954ad805b09da724cde3b2c1e51cf26..64c5d90f2960f397dc20143956d6cfd7f132e35b 100644 --- a/src/plugins/qmldesigner/core/filemanager/objectlengthcalculator.h +++ b/src/plugins/qmldesigner/core/filemanager/objectlengthcalculator.h @@ -31,7 +31,7 @@ #define OBJECTLENGTHCALCULATOR_H #include <qmljs/parser/qmljsastvisitor_p.h> -#include <qmljs/qmldocument.h> +#include <qmljs/qmljsdocument.h> namespace QmlDesigner { @@ -49,7 +49,7 @@ protected: virtual bool visit(QmlJS::AST::UiObjectDefinition *ast); private: - Qml::QmlDocument::Ptr m_doc; + QmlJS::Document::Ptr m_doc; quint32 m_offset; quint32 m_length; }; diff --git a/src/plugins/qmldesigner/core/filemanager/qmlrefactoring.cpp b/src/plugins/qmldesigner/core/filemanager/qmlrefactoring.cpp index 9a97350cdf17b38e1d31d944c1c954db8d35cfd9..2d453f63dd72078275141a5d785af5e8949e11f7 100644 --- a/src/plugins/qmldesigner/core/filemanager/qmlrefactoring.cpp +++ b/src/plugins/qmldesigner/core/filemanager/qmlrefactoring.cpp @@ -40,11 +40,11 @@ #include "removepropertyvisitor.h" #include "removeuiobjectmembervisitor.h" -using namespace Qml; +using namespace QmlJS; using namespace QmlDesigner; using namespace QmlDesigner::Internal; -QmlRefactoring::QmlRefactoring(const QmlDocument::Ptr &doc, TextModifier &modifier, const QStringList &propertyOrder): +QmlRefactoring::QmlRefactoring(const Document::Ptr &doc, TextModifier &modifier, const QStringList &propertyOrder): qmlDocument(doc), textModifier(&modifier), m_propertyOrder(propertyOrder) @@ -57,10 +57,10 @@ bool QmlRefactoring::reparseDocument() // qDebug() << "QmlRefactoring::reparseDocument() new QML source:" << newSource; - QmlDocument::Ptr tmpDocument(QmlDocument::create("<ModelToTextMerger>")); + Document::Ptr tmpDocument(Document::create("<ModelToTextMerger>")); tmpDocument->setSource(newSource); - if (tmpDocument->parse()) { + if (tmpDocument->parseQml()) { qmlDocument = tmpDocument; return true; } else { @@ -83,7 +83,7 @@ bool QmlRefactoring::addToArrayMemberList(int parentLocation, const QString &pro AddArrayMemberVisitor visit(*textModifier, (quint32) parentLocation, propertyName, content); visit.setConvertObjectBindingIntoArrayBinding(true); - return visit(qmlDocument->program()); + return visit(qmlDocument->qmlProgram()); } bool QmlRefactoring::addToObjectMemberList(int parentLocation, const QString &content) @@ -91,7 +91,7 @@ bool QmlRefactoring::addToObjectMemberList(int parentLocation, const QString &co Q_ASSERT(parentLocation >= 0); AddObjectVisitor visit(*textModifier, (quint32) parentLocation, content, m_propertyOrder); - return visit(qmlDocument->program()); + return visit(qmlDocument->qmlProgram()); } bool QmlRefactoring::addProperty(int parentLocation, const QString &name, const QString &value, PropertyType propertyType) @@ -99,7 +99,7 @@ bool QmlRefactoring::addProperty(int parentLocation, const QString &name, const Q_ASSERT(parentLocation >= 0); AddPropertyVisitor visit(*textModifier, (quint32) parentLocation, name, value, propertyType, m_propertyOrder); - return visit(qmlDocument->program()); + return visit(qmlDocument->qmlProgram()); } bool QmlRefactoring::changeProperty(int parentLocation, const QString &name, const QString &value, PropertyType propertyType) @@ -107,7 +107,7 @@ bool QmlRefactoring::changeProperty(int parentLocation, const QString &name, con Q_ASSERT(parentLocation >= 0); ChangePropertyVisitor visit(*textModifier, (quint32) parentLocation, name, value, propertyType); - return visit(qmlDocument->program()); + return visit(qmlDocument->qmlProgram()); } bool QmlRefactoring::changeObjectType(int nodeLocation, const QString &newType) @@ -116,7 +116,7 @@ bool QmlRefactoring::changeObjectType(int nodeLocation, const QString &newType) Q_ASSERT(!newType.isEmpty()); ChangeObjectTypeVisitor visit(*textModifier, (quint32) nodeLocation, newType); - return visit(qmlDocument->program()); + return visit(qmlDocument->qmlProgram()); } bool QmlRefactoring::moveObject(int objectLocation, const QString &targetPropertyName, bool targetIsArrayBinding, int targetParentObjectLocation) @@ -125,7 +125,7 @@ bool QmlRefactoring::moveObject(int objectLocation, const QString &targetPropert Q_ASSERT(targetParentObjectLocation >= 0); MoveObjectVisitor visit(*textModifier, (quint32) objectLocation, targetPropertyName, targetIsArrayBinding, (quint32) targetParentObjectLocation, m_propertyOrder); - return visit(qmlDocument->program()); + return visit(qmlDocument->qmlProgram()); } bool QmlRefactoring::moveObjectBeforeObject(int movingObjectLocation, int beforeObjectLocation) @@ -135,10 +135,10 @@ bool QmlRefactoring::moveObjectBeforeObject(int movingObjectLocation, int before if (beforeObjectLocation == -1) { MoveObjectBeforeObjectVisitor visit(*textModifier, movingObjectLocation); - return visit(qmlDocument->program()); + return visit(qmlDocument->qmlProgram()); } else { MoveObjectBeforeObjectVisitor visit(*textModifier, movingObjectLocation, beforeObjectLocation); - return visit(qmlDocument->program()); + return visit(qmlDocument->qmlProgram()); } return false; } @@ -148,7 +148,7 @@ bool QmlRefactoring::removeObject(int nodeLocation) Q_ASSERT(nodeLocation >= 0); RemoveUIObjectMemberVisitor visit(*textModifier, (quint32) nodeLocation); - return visit(qmlDocument->program()); + return visit(qmlDocument->qmlProgram()); } bool QmlRefactoring::removeProperty(int parentLocation, const QString &name) @@ -157,5 +157,5 @@ bool QmlRefactoring::removeProperty(int parentLocation, const QString &name) Q_ASSERT(!name.isEmpty()); RemovePropertyVisitor visit(*textModifier, (quint32) parentLocation, name); - return visit(qmlDocument->program()); + return visit(qmlDocument->qmlProgram()); } diff --git a/src/plugins/qmldesigner/core/filemanager/qmlrefactoring.h b/src/plugins/qmldesigner/core/filemanager/qmlrefactoring.h index c149ef0b4048a020eeddfdd4ef7ab774f0e0549f..4a802f2245decfba11db4ff5b34bbe7fe14cf505 100644 --- a/src/plugins/qmldesigner/core/filemanager/qmlrefactoring.h +++ b/src/plugins/qmldesigner/core/filemanager/qmlrefactoring.h @@ -32,7 +32,7 @@ #include <import.h> #include <textmodifier.h> -#include <qmljs/qmldocument.h> +#include <qmljs/qmljsdocument.h> #include <QSet> #include <QString> @@ -51,7 +51,7 @@ public: }; public: - QmlRefactoring(const Qml::QmlDocument::Ptr &doc, QmlDesigner::TextModifier &modifier, const QStringList &propertyOrder); + QmlRefactoring(const QmlJS::Document::Ptr &doc, QmlDesigner::TextModifier &modifier, const QStringList &propertyOrder); bool reparseDocument(); @@ -70,7 +70,7 @@ public: bool removeProperty(int parentLocation, const QString &name); private: - Qml::QmlDocument::Ptr qmlDocument; + QmlJS::Document::Ptr qmlDocument; TextModifier *textModifier; QStringList m_propertyOrder; }; diff --git a/src/plugins/qmldesigner/core/include/model.h b/src/plugins/qmldesigner/core/include/model.h index ce6715433d8f102af3574f65b37c175ef65a73dd..e4ebc81954f8772275e6facbfaf23173bf31b91f 100644 --- a/src/plugins/qmldesigner/core/include/model.h +++ b/src/plugins/qmldesigner/core/include/model.h @@ -86,6 +86,7 @@ public: const MetaInfo metaInfo() const; MetaInfo metaInfo(); + void setMetaInfo(const MetaInfo &metaInfo); void attachView(AbstractView *view); void detachView(AbstractView *view, ViewNotification emitDetachNotify = NotifyView); diff --git a/src/plugins/qmldesigner/core/instances/nodeinstanceview.cpp b/src/plugins/qmldesigner/core/instances/nodeinstanceview.cpp index ef024af87cf9c460ea1945ce145cc96185743b28..febc1d5c04b22106f29a31b653eb3070227c6cb2 100644 --- a/src/plugins/qmldesigner/core/instances/nodeinstanceview.cpp +++ b/src/plugins/qmldesigner/core/instances/nodeinstanceview.cpp @@ -37,6 +37,7 @@ #include <QGraphicsView> #include <QGraphicsScene> #include <QGraphicsObject> +#include <private/qmlengine_p.h> #include <model.h> #include <modelnode.h> @@ -94,6 +95,12 @@ NodeInstanceView::NodeInstanceView(QObject *parent) m_graphicsView->setAttribute(Qt::WA_DontShowOnScreen, true); m_graphicsView->setViewportUpdateMode(QGraphicsView::NoViewportUpdate); m_graphicsView->setScene(new QGraphicsScene(m_graphicsView.data())); + + Q_ASSERT(!m_engine.isNull()); + + QmlEnginePrivate *privateQmlEngine = QmlEnginePrivate::get(m_engine.data()); + Q_ASSERT(privateQmlEngine); + privateQmlEngine->scriptEngine.setProcessEventsInterval(100); } diff --git a/src/plugins/qmldesigner/core/instances/qmlgraphicsitemnodeinstance.cpp b/src/plugins/qmldesigner/core/instances/qmlgraphicsitemnodeinstance.cpp index be28b1dd6186127dc09ba75596c6d37b76548b2a..ce297fd2ecc15cc7acedfa9e9fdcfb9c24b9b85b 100644 --- a/src/plugins/qmldesigner/core/instances/qmlgraphicsitemnodeinstance.cpp +++ b/src/plugins/qmldesigner/core/instances/qmlgraphicsitemnodeinstance.cpp @@ -96,23 +96,35 @@ QSizeF QmlGraphicsItemNodeInstance::size() const double implicitWidth = qmlGraphicsItem()->implicitWidth(); if (!m_hasWidth && implicitWidth // WORKAROUND - && implicitWidth != qmlGraphicsItem()->width()) + && implicitWidth != qmlGraphicsItem()->width()) { + qmlGraphicsItem()->blockSignals(true); qmlGraphicsItem()->setWidth(implicitWidth); + qmlGraphicsItem()->blockSignals(false); + } double implicitHeight = qmlGraphicsItem()->implicitHeight(); if (!m_hasHeight && implicitWidth // WORKAROUND - && implicitHeight != qmlGraphicsItem()->height()) + && implicitHeight != qmlGraphicsItem()->height()) { + qmlGraphicsItem()->blockSignals(true); qmlGraphicsItem()->setHeight(implicitHeight); + qmlGraphicsItem()->blockSignals(false); + } } if (modelNode().isRootNode()) { - if (!m_hasWidth) + if (!m_hasWidth) { + qmlGraphicsItem()->blockSignals(true); qmlGraphicsItem()->setWidth(100.); + qmlGraphicsItem()->blockSignals(false); + } - if (!m_hasHeight) + if (!m_hasHeight) { + qmlGraphicsItem()->blockSignals(true); qmlGraphicsItem()->setHeight(100.); + qmlGraphicsItem()->blockSignals(false); + } } return QSizeF(qmlGraphicsItem()->width(), qmlGraphicsItem()->height()); @@ -124,23 +136,35 @@ QRectF QmlGraphicsItemNodeInstance::boundingRect() const double implicitWidth = qmlGraphicsItem()->implicitWidth(); if (!m_hasWidth && implicitWidth // WORKAROUND - && implicitWidth != qmlGraphicsItem()->width()) + && implicitWidth != qmlGraphicsItem()->width()) { + qmlGraphicsItem()->blockSignals(true); qmlGraphicsItem()->setWidth(implicitWidth); + qmlGraphicsItem()->blockSignals(false); + } double implicitHeight = qmlGraphicsItem()->implicitHeight(); if (!m_hasHeight && implicitWidth // WORKAROUND - && implicitHeight != qmlGraphicsItem()->height()) + && implicitHeight != qmlGraphicsItem()->height()) { + qmlGraphicsItem()->blockSignals(true); qmlGraphicsItem()->setHeight(implicitHeight); + qmlGraphicsItem()->blockSignals(false); + } } if (modelNode().isRootNode()) { - if (!m_hasWidth) + if (!m_hasWidth) { + qmlGraphicsItem()->blockSignals(true); qmlGraphicsItem()->setWidth(100.); + qmlGraphicsItem()->blockSignals(false); + } - if (!m_hasHeight) + if (!m_hasHeight) { + qmlGraphicsItem()->blockSignals(true); qmlGraphicsItem()->setHeight(100.); + qmlGraphicsItem()->blockSignals(false); + } } return qmlGraphicsItem()->boundingRect(); diff --git a/src/plugins/qmldesigner/core/model/model.cpp b/src/plugins/qmldesigner/core/model/model.cpp index 946289eea4822db26b9aaa75e80e1055569af236..9bbc8609ca31b28ad99f6eabca4f4c7a7cb8b298 100644 --- a/src/plugins/qmldesigner/core/model/model.cpp +++ b/src/plugins/qmldesigner/core/model/model.cpp @@ -251,6 +251,11 @@ MetaInfo ModelPrivate::metaInfo() const return m_metaInfo; } +void ModelPrivate::setMetaInfo(const MetaInfo &metaInfo) +{ + m_metaInfo = metaInfo; +} + void ModelPrivate::changeNodeId(const InternalNode::Pointer& internalNodePointer, const QString &id) { const QString oldId = internalNodePointer->id(); @@ -872,6 +877,14 @@ const MetaInfo Model::metaInfo() const return m_d->metaInfo(); } +/*! + \brief Sets a specific Metainfo on this Model + */ +void Model::setMetaInfo(const MetaInfo &metaInfo) +{ + m_d->setMetaInfo(metaInfo); +} + /*! \brief Returns list of Qml types available within the model. */ diff --git a/src/plugins/qmldesigner/core/model/model_p.h b/src/plugins/qmldesigner/core/model/model_p.h index 558628b643fc0714698954995554361519831c84..4784f6867efdd6352239c660a8f18e7753367d93 100644 --- a/src/plugins/qmldesigner/core/model/model_p.h +++ b/src/plugins/qmldesigner/core/model/model_p.h @@ -98,6 +98,7 @@ public: InternalNodePointer findNode(const QString &id) const; MetaInfo metaInfo() const; + void setMetaInfo(const MetaInfo &metaInfo); void attachView(AbstractView *view); void detachView(AbstractView *view, bool notifyView); diff --git a/src/plugins/qmldesigner/core/model/modelmerger.cpp b/src/plugins/qmldesigner/core/model/modelmerger.cpp index 133fb417e744c6a3d8125494c43f082c502f1cdb..b680c37d16e681b50a4585ca9c144bbd79fddfb8 100644 --- a/src/plugins/qmldesigner/core/model/modelmerger.cpp +++ b/src/plugins/qmldesigner/core/model/modelmerger.cpp @@ -147,6 +147,7 @@ void ModelMerger::replaceModel(const ModelNode &modelNode) foreach (const Import &import, modelNode.model()->imports()) view()->model()->addImport(import); + view()->model()->setFileUrl(modelNode.model()->fileUrl()); ModelNode rootNode(view()->rootModelNode()); diff --git a/src/plugins/qmldesigner/core/model/modeltotextmerger.cpp b/src/plugins/qmldesigner/core/model/modeltotextmerger.cpp index 16947a495acf3084dc927665147c284829ca8bd0..98fe8f415193311139c0182fb52cfad55daf4477 100644 --- a/src/plugins/qmldesigner/core/model/modeltotextmerger.cpp +++ b/src/plugins/qmldesigner/core/model/modeltotextmerger.cpp @@ -33,7 +33,7 @@ #include "rewriteactioncompressor.h" #include "rewriterview.h" -#include <qmljs/qmldocument.h> +#include <qmljs/qmljsdocument.h> #include <variantproperty.h> #include <nodelistproperty.h> #include <nodeproperty.h> @@ -44,7 +44,7 @@ #define INDENT_DEPTH 4 #undef DUMP_REWRITE_ACTIONS -using namespace Qml; +using namespace QmlJS; using namespace QmlDesigner; using namespace QmlDesigner::Internal; @@ -188,6 +188,9 @@ RewriterView *ModelToTextMerger::view() void ModelToTextMerger::applyChanges() { + if (m_rewriteActions.isEmpty()) + return; + dumpRewriteActions(QLatin1String("Before compression")); RewriteActionCompressor compress(getPropertyOrder()); compress(m_rewriteActions); @@ -196,9 +199,9 @@ void ModelToTextMerger::applyChanges() if (m_rewriteActions.isEmpty()) return; - QmlDocument::Ptr tmpDocument(QmlDocument::create(QLatin1String("<ModelToTextMerger>"))); + Document::Ptr tmpDocument(Document::create(QLatin1String("<ModelToTextMerger>"))); tmpDocument->setSource(m_rewriterView->textModifier()->text()); - if (!tmpDocument->parse()) { + if (!tmpDocument->parseQml()) { qDebug() << "*** Possible problem: QML file wasn't parsed correctly."; qDebug() << "*** QML text:" << m_rewriterView->textModifier()->text(); return; @@ -223,7 +226,7 @@ void ModelToTextMerger::applyChanges() RewriteAction* action = m_rewriteActions.at(i); #ifdef DUMP_REWRITE_ACTIONS - action->dump("Next rewrite action:"); + qDebug() << "Next rewrite action:" << qPrintable(action->info()); #endif // DUMP_REWRITE_ACTIONS ModelNodePositionStorage *positionStore = m_rewriterView->positionStorage(); const bool success = action->execute(refactoring, *positionStore); @@ -312,7 +315,7 @@ void ModelToTextMerger::dumpRewriteActions(const QString &msg) qDebug() << "---->" << qPrintable(msg); foreach (RewriteAction *action, m_rewriteActions) { - action->dump("-----"); + qDebug() << "-----" << qPrintable(action->info()); } qDebug() << "<----" << qPrintable(msg); diff --git a/src/plugins/qmldesigner/core/model/rewriteaction.cpp b/src/plugins/qmldesigner/core/model/rewriteaction.cpp index 2a1a8652d93d063c58dbf651624cd54b8ac4c302..8cbc8c4ff221878e7848071bb5cf7d1a0d0c5605 100644 --- a/src/plugins/qmldesigner/core/model/rewriteaction.cpp +++ b/src/plugins/qmldesigner/core/model/rewriteaction.cpp @@ -53,20 +53,25 @@ bool AddPropertyRewriteAction::execute(QmlRefactoring &refactoring, ModelNodePos if (m_property.isDefaultProperty()) result = refactoring.addToObjectMemberList(nodeLocation, m_valueText); - else + else { result = refactoring.addProperty(nodeLocation, m_property.name(), m_valueText, m_propertyType); + if (!result) { + qDebug() << "*** AddPropertyRewriteAction::execute failed in addProperty(" + << nodeLocation << "," + << m_property.name() << "," + << m_valueText << ", ScriptBinding)" + << info(); + } + } + Q_ASSERT(result); return result; } -void AddPropertyRewriteAction::dump(const QString &prefix) const +QString AddPropertyRewriteAction::info() const { - qDebug() << qPrintable(prefix) - << "AddPropertyRewriteAction for property" - << m_property.name() - << "(" << qPrintable(toString(m_propertyType)) << ")" - ; + return QString("AddPropertyRewriteAction for property \"%1\" (type: %2)").arg(m_property.name(), toString(m_propertyType)); } bool ChangeIdRewriteAction::execute(QmlDesigner::QmlRefactoring &refactoring, ModelNodePositionStorage &positionStore) @@ -75,9 +80,17 @@ bool ChangeIdRewriteAction::execute(QmlDesigner::QmlRefactoring &refactoring, Mo static const QLatin1String idPropertyName("id"); bool result = false; - if (m_oldId.isEmpty()) + if (m_oldId.isEmpty()) { result = refactoring.addProperty(nodeLocation, idPropertyName, m_newId, QmlRefactoring::ScriptBinding); - else if (m_newId.isEmpty()) + + if (!result) { + qDebug() << "*** ChangeIdRewriteAction::execute failed in addProperty(" + << nodeLocation << "," + << idPropertyName << "," + << m_newId << ", ScriptBinding)" + << info(); + } + } else if (m_newId.isEmpty()) result = refactoring.removeProperty(nodeLocation, idPropertyName); else result = refactoring.changeProperty(nodeLocation, idPropertyName, m_newId, QmlRefactoring::ScriptBinding); @@ -86,11 +99,9 @@ bool ChangeIdRewriteAction::execute(QmlDesigner::QmlRefactoring &refactoring, Mo return result; } -void ChangeIdRewriteAction::dump(const QString &prefix) const +QString ChangeIdRewriteAction::info() const { - qDebug() << qPrintable(prefix) - << "ChangeIdRewriteAction" - ; + return QString("ChangeIdRewriteAction from \"%1\" to \"%2\"").arg(m_oldId, m_newId); } bool ChangePropertyRewriteAction::execute(QmlDesigner::QmlRefactoring &refactoring, ModelNodePositionStorage &positionStore) @@ -109,19 +120,14 @@ bool ChangePropertyRewriteAction::execute(QmlDesigner::QmlRefactoring &refactori return result; } -void ChangePropertyRewriteAction::dump(const QString &prefix) const +QString ChangePropertyRewriteAction::info() const { - qDebug() << qPrintable(prefix) - << "ChangePropertyRewriteAction for property" - << m_property.name() - << "(" << qPrintable(toString(m_propertyType)) << ")" - << "of node" - << (m_property.parentModelNode().isValid() ? m_property.parentModelNode().id() : "(invalid)") - << "with new value" - << QString(m_valueText).replace('\n', "\\n") - << "and contained object" - << (m_containedModelNode.isValid() ? m_containedModelNode.id() : "(none)") - ; + return QString("ChangePropertyRewriteAction for property \"%1\" (type: %2) of node \"%3\" with value >>%4<< and contained object \"%5\"") + .arg(m_property.name(), + toString(m_propertyType), + (m_property.parentModelNode().isValid() ? m_property.parentModelNode().id() : "(invalid)"), + QString(m_valueText).replace('\n', "\\n"), + (m_containedModelNode.isValid() ? m_containedModelNode.id() : "(none)")); } bool ChangeTypeRewriteAction::execute(QmlDesigner::QmlRefactoring &refactoring, ModelNodePositionStorage &positionStore) @@ -140,11 +146,9 @@ bool ChangeTypeRewriteAction::execute(QmlDesigner::QmlRefactoring &refactoring, return result; } -void ChangeTypeRewriteAction::dump(const QString &prefix) const +QString ChangeTypeRewriteAction::info() const { - qDebug() << qPrintable(prefix) - << "ChangeTypeRewriteAction" - ; + return QString("ChangeTypeRewriteAction"); } bool RemoveNodeRewriteAction::execute(QmlDesigner::QmlRefactoring &refactoring, ModelNodePositionStorage &positionStore) @@ -158,11 +162,9 @@ bool RemoveNodeRewriteAction::execute(QmlDesigner::QmlRefactoring &refactoring, return result; } -void RemoveNodeRewriteAction::dump(const QString &prefix) const +QString RemoveNodeRewriteAction::info() const { - qDebug() << qPrintable(prefix) - << "RemoveNodeRewriteAction" - ; + return QString("RemoveNodeRewriteAction"); } bool RemovePropertyRewriteAction::execute(QmlDesigner::QmlRefactoring &refactoring, ModelNodePositionStorage &positionStore) @@ -176,12 +178,9 @@ bool RemovePropertyRewriteAction::execute(QmlDesigner::QmlRefactoring &refactori return result; } -void RemovePropertyRewriteAction::dump(const QString &prefix) const +QString RemovePropertyRewriteAction::info() const { - qDebug() << qPrintable(prefix) - << "RemovePropertyRewriteAction for property" - << m_property.name() - ; + return QString("RemovePropertyRewriteAction for property \"%1\"").arg(m_property.name()); } bool ReparentNodeRewriteAction::execute(QmlDesigner::QmlRefactoring &refactoring, ModelNodePositionStorage &positionStore) @@ -201,22 +200,15 @@ bool ReparentNodeRewriteAction::execute(QmlDesigner::QmlRefactoring &refactoring return result; } -void ReparentNodeRewriteAction::dump(const QString &prefix) const +QString ReparentNodeRewriteAction::info() const { - if (m_node.isValid()) { - qDebug() << qPrintable(prefix) - << "ReparentNodeRewriteAction for node" - << m_node.id() - << "into property" - << m_targetProperty.name() - << "of node" - << m_targetProperty.parentModelNode().id() - ; - } else { - qDebug() << qPrintable(prefix) - << "reparentNodeRewriteAction for an invalid node" - ; - } + if (m_node.isValid()) + return QString("ReparentNodeRewriteAction for node \"%1\" into property \"%2\" of node \"%3\"") + .arg(m_node.id(), + m_targetProperty.name(), + m_targetProperty.parentModelNode().id()); + else + return QString("ReparentNodeRewriteAction for an invalid node"); } bool MoveNodeRewriteAction::execute(QmlRefactoring &refactoring, @@ -232,25 +224,14 @@ bool MoveNodeRewriteAction::execute(QmlRefactoring &refactoring, return result; } -void MoveNodeRewriteAction::dump(const QString &prefix) const +QString MoveNodeRewriteAction::info() const { if (m_movingNode.isValid()) { if (m_newTrailingNode.isValid()) - qDebug() << qPrintable(prefix) - << "MoveNodeRewriteAction for node" - << m_movingNode.id() - << "before node" - << m_newTrailingNode.id() - ; + return QString("MoveNodeRewriteAction for node \"%1\" before node \"%2\"").arg(m_movingNode.id(), m_newTrailingNode.id()); else - qDebug() << qPrintable(prefix) - << "MoveNodeRewriteAction for node" - << m_movingNode.id() - << "to the end of its containing property" - ; + return QString("MoveNodeRewriteAction for node \"%1\" to the end of its containing property").arg(m_movingNode.id()); } else { - qDebug() << qPrintable(prefix) - << "MoveNodeRewriteAction for an invalid node" - ; + return QString("MoveNodeRewriteAction for an invalid node"); } } diff --git a/src/plugins/qmldesigner/core/model/rewriteaction.h b/src/plugins/qmldesigner/core/model/rewriteaction.h index 6afaf222923866c25976cb273d224b73d3b9c105..84deabd68bb0526e1a6073aec79d8d34fe1fd645 100644 --- a/src/plugins/qmldesigner/core/model/rewriteaction.h +++ b/src/plugins/qmldesigner/core/model/rewriteaction.h @@ -51,7 +51,7 @@ class RewriteAction { public: virtual bool execute(QmlDesigner::QmlRefactoring &refactoring, ModelNodePositionStorage &positionStore) = 0; - virtual void dump(const QString &prefix) const = 0; + virtual QString info() const = 0; virtual AddPropertyRewriteAction const *asAddPropertyRewriteAction() const { return 0; } virtual ChangeIdRewriteAction const *asChangeIdRewriteAction() const { return 0; } @@ -79,7 +79,7 @@ public: {} virtual bool execute(QmlDesigner::QmlRefactoring &refactoring, ModelNodePositionStorage &positionStore); - virtual void dump(const QString &prefix) const; + virtual QString info() const; virtual AddPropertyRewriteAction const *asAddPropertyRewriteAction() const { return this; } @@ -110,7 +110,7 @@ public: {} virtual bool execute(QmlDesigner::QmlRefactoring &refactoring, ModelNodePositionStorage &positionStore); - virtual void dump(const QString &prefix) const; + virtual QString info() const; virtual ChangeIdRewriteAction const *asChangeIdRewriteAction() const { return this; } @@ -131,7 +131,7 @@ public: {} virtual bool execute(QmlDesigner::QmlRefactoring &refactoring, ModelNodePositionStorage &positionStore); - virtual void dump(const QString &prefix) const; + virtual QString info() const; virtual ChangePropertyRewriteAction const *asChangePropertyRewriteAction() const { return this; } @@ -162,7 +162,7 @@ public: {} virtual bool execute(QmlDesigner::QmlRefactoring &refactoring, ModelNodePositionStorage &positionStore); - virtual void dump(const QString &prefix) const; + virtual QString info() const; virtual ChangeTypeRewriteAction const *asChangeTypeRewriteAction() const { return this; } @@ -181,7 +181,7 @@ public: {} virtual bool execute(QmlDesigner::QmlRefactoring &refactoring, ModelNodePositionStorage &positionStore); - virtual void dump(const QString &prefix) const; + virtual QString info() const; virtual RemoveNodeRewriteAction const *asRemoveNodeRewriteAction() const { return this; } @@ -200,7 +200,7 @@ public: {} virtual bool execute(QmlDesigner::QmlRefactoring &refactoring, ModelNodePositionStorage &positionStore); - virtual void dump(const QString &prefix) const; + virtual QString info() const; virtual RemovePropertyRewriteAction const *asRemovePropertyRewriteAction() const { return this; } @@ -219,7 +219,7 @@ public: {} virtual bool execute(QmlDesigner::QmlRefactoring &refactoring, ModelNodePositionStorage &positionStore); - virtual void dump(const QString &prefix) const; + virtual QString info() const; virtual ReparentNodeRewriteAction const *asReparentNodeRewriteAction() const { return this; } @@ -246,7 +246,7 @@ public: {} virtual bool execute(QmlDesigner::QmlRefactoring &refactoring, ModelNodePositionStorage &positionStore); - virtual void dump(const QString &prefix) const; + virtual QString info() const; virtual MoveNodeRewriteAction const *asMoveNodeRewriteAction() const { return this; } diff --git a/src/plugins/qmldesigner/core/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/core/model/texttomodelmerger.cpp index 7646865cb8d4029ceefd61c02d3df104aae15694..8c8d2140b04f86709ff1b2d124931fc211d441de 100644 --- a/src/plugins/qmldesigner/core/model/texttomodelmerger.cpp +++ b/src/plugins/qmldesigner/core/model/texttomodelmerger.cpp @@ -129,11 +129,19 @@ void TextToModelMerger::syncNode(ModelNode &modelNode, const QmlDomObject &domOb domObjectId = domIdProperty.value().toLiteral().literal(); if (domObjectId.isEmpty()) { - if (!modelNode.id().isEmpty()) + if (!modelNode.id().isEmpty()) { + ModelNode existingNodeWithId = m_rewriterView->modelNodeForId(domObjectId); + if (existingNodeWithId.isValid()) + existingNodeWithId.setId(QString()); differenceHandler.idsDiffer(modelNode, domObjectId); + } } else { - if (modelNode.id() != domObjectId) + if (modelNode.id() != domObjectId) { + ModelNode existingNodeWithId = m_rewriterView->modelNodeForId(domObjectId); + if (existingNodeWithId.isValid()) + existingNodeWithId.setId(QString()); differenceHandler.idsDiffer(modelNode, domObjectId); + } } } diff --git a/src/plugins/qmldesigner/designmode.cpp b/src/plugins/qmldesigner/designmode.cpp index d8aecc292c9a2b4925f0ff8b9cd7290923bbe82d..89722b48aff0f7d168369e51ae55e9f9dea291c0 100644 --- a/src/plugins/qmldesigner/designmode.cpp +++ b/src/plugins/qmldesigner/designmode.cpp @@ -212,7 +212,7 @@ void DesignMode::modeChanged(Core::IMode *mode) } else { if (m_isActive) { m_isActive = false; -// m_mainWidget->showEditor(0); + m_mainWidget->showEditor(0); } } } diff --git a/src/plugins/qmldesigner/designmodewidget.cpp b/src/plugins/qmldesigner/designmodewidget.cpp index 71ec441507c892a531df191acced0364e158f6d3..ab8e3f58c253eb1eb28eea6d33cd3888ad16daf3 100644 --- a/src/plugins/qmldesigner/designmodewidget.cpp +++ b/src/plugins/qmldesigner/designmodewidget.cpp @@ -282,13 +282,11 @@ void DocumentWidget::setAutoSynchronization(bool sync) if (sync) { // text editor -> visual editor if (!document()->model()) { - // first initialization - QList<RewriterView::Error> errors = document()->loadMaster(m_textBuffer.data()); - if (!errors.isEmpty()) { - disable(errors); - } + document()->loadMaster(m_textBuffer.data()); } - if (document()->model() && document()->qmlErrors().isEmpty()) { + + QList<RewriterView::Error> errors = document()->qmlErrors(); + if (errors.isEmpty()) { // set selection to text cursor RewriterView *rewriter = document()->rewriterView(); const int cursorPos = m_textBuffer->textCursor().position(); @@ -297,6 +295,8 @@ void DocumentWidget::setAutoSynchronization(bool sync) rewriter->setSelectedModelNodes(QList<ModelNode>() << node); } enable(); + } else { + disable(errors); } connect(document(), SIGNAL(qmlErrorsChanged(QList<RewriterView::Error>)), diff --git a/src/plugins/qmldesigner/fxplugin/plugindestdir.pri b/src/plugins/qmldesigner/fxplugin/plugindestdir.pri index 9dff900cbdae717c20873a6bce3704a89c290223..24f0c19b72b42e31ad229db03956a15da2cc42f4 100644 --- a/src/plugins/qmldesigner/fxplugin/plugindestdir.pri +++ b/src/plugins/qmldesigner/fxplugin/plugindestdir.pri @@ -1,5 +1,5 @@ macx { DESTDIR = $$IDE_LIBRARY_PATH/QmlDesigner } else { - DESTDIR = $$PWD/../../../../lib/qmldesigner + DESTDIR = $$IDE_BUILD_TREE/lib/qmldesigner } diff --git a/src/plugins/qmljseditor/qmlcodecompletion.cpp b/src/plugins/qmljseditor/qmlcodecompletion.cpp index bc4888e4b1923d5760ace0d7f3e3fcf4c8b6822c..59d6e5c38f972c5b60c0b739f334c7ffcd4d3f07 100644 --- a/src/plugins/qmljseditor/qmlcodecompletion.cpp +++ b/src/plugins/qmljseditor/qmlcodecompletion.cpp @@ -34,7 +34,7 @@ #include "qmllookupcontext.h" #include "qmlresolveexpression.h" -#include <qmljs/qmlsymbol.h> +#include <qmljs/qmljssymbol.h> #include <texteditor/basetexteditor.h> #include <QtDebug> @@ -42,7 +42,7 @@ using namespace QmlJSEditor; using namespace QmlJSEditor::Internal; -QmlCodeCompletion::QmlCodeCompletion(QmlModelManagerInterface *modelManager, Qml::QmlTypeSystem *typeSystem, QObject *parent) +QmlCodeCompletion::QmlCodeCompletion(QmlModelManagerInterface *modelManager, QmlJS::TypeSystem *typeSystem, QObject *parent) : TextEditor::ICompletionCollector(parent), m_modelManager(modelManager), m_editor(0), @@ -90,17 +90,17 @@ int QmlCodeCompletion::startCompletion(TextEditor::ITextEditable *editor) m_startPosition = pos; m_completions.clear(); - Qml::QmlDocument::Ptr qmlDocument = edit->qmlDocument(); + QmlJS::Document::Ptr qmlDocument = edit->qmlDocument(); // qDebug() << "*** document:" << qmlDocument; if (qmlDocument.isNull()) return pos; - if (!qmlDocument->program()) + if (!qmlDocument->qmlProgram()) qmlDocument = m_modelManager->snapshot().value(qmlDocument->fileName()); // FIXME: this completion strategy is not going to work when the document was never parsed correctly. - if (qmlDocument && qmlDocument->program()) { - QmlJS::AST::UiProgram *program = qmlDocument->program(); + if (qmlDocument && qmlDocument->qmlProgram()) { + QmlJS::AST::UiProgram *program = qmlDocument->qmlProgram(); // qDebug() << "*** program:" << program; if (program) { @@ -112,10 +112,10 @@ int QmlCodeCompletion::startCompletion(TextEditor::ITextEditable *editor) QmlLookupContext context(expressionUnderCursor.expressionScopes(), qmlDocument, m_modelManager->snapshot(), m_typeSystem); QmlResolveExpression resolver(context); // qDebug()<<"*** expression under cursor:"<<expressionUnderCursor.expressionNode(); - QList<Qml::QmlSymbol*> symbols = resolver.visibleSymbols(expressionUnderCursor.expressionNode()); + QList<QmlJS::Symbol*> symbols = resolver.visibleSymbols(expressionUnderCursor.expressionNode()); // qDebug()<<"***"<<symbols.size()<<"visible symbols"; - foreach (Qml::QmlSymbol *symbol, symbols) { + foreach (QmlJS::Symbol *symbol, symbols) { QString word; if (symbol->isIdSymbol()) { diff --git a/src/plugins/qmljseditor/qmlcodecompletion.h b/src/plugins/qmljseditor/qmlcodecompletion.h index d8510d200a760c29b75ca99faf9fb58b9f850deb..cb8687cde667230beb789c31b77241cc58335a28 100644 --- a/src/plugins/qmljseditor/qmlcodecompletion.h +++ b/src/plugins/qmljseditor/qmlcodecompletion.h @@ -30,7 +30,7 @@ #ifndef QMLCODECOMPLETION_H #define QMLCODECOMPLETION_H -#include <qmljs/qmltypesystem.h> +#include <qmljs/qmljstypesystem.h> #include <texteditor/icompletioncollector.h> namespace TextEditor { @@ -48,7 +48,7 @@ class QmlCodeCompletion: public TextEditor::ICompletionCollector Q_OBJECT public: - QmlCodeCompletion(QmlModelManagerInterface *modelManager, Qml::QmlTypeSystem *typeSystem, QObject *parent = 0); + QmlCodeCompletion(QmlModelManagerInterface *modelManager, QmlJS::TypeSystem *typeSystem, QObject *parent = 0); virtual ~QmlCodeCompletion(); Qt::CaseSensitivity caseSensitivity() const; @@ -68,7 +68,7 @@ private: int m_startPosition; QList<TextEditor::CompletionItem> m_completions; Qt::CaseSensitivity m_caseSensitivity; - Qml::QmlTypeSystem *m_typeSystem; + QmlJS::TypeSystem *m_typeSystem; }; diff --git a/src/plugins/qmljseditor/qmlexpressionundercursor.cpp b/src/plugins/qmljseditor/qmlexpressionundercursor.cpp index 70c019795ddb26e9c516a37644414d9afb402cf6..ec56f3d3e16691d51a0f919d75930044880ec9e3 100644 --- a/src/plugins/qmljseditor/qmlexpressionundercursor.cpp +++ b/src/plugins/qmljseditor/qmlexpressionundercursor.cpp @@ -38,7 +38,6 @@ #include <QDebug> -using namespace Qml; using namespace QmlJS; using namespace QmlJS::AST; @@ -124,13 +123,13 @@ namespace QmlJSEditor { class ScopeCalculator: protected Visitor { public: - QStack<QmlSymbol*> operator()(const QmlDocument::Ptr &doc, int pos) + QStack<Symbol*> operator()(const Document::Ptr &doc, int pos) { _doc = doc; _pos = pos; _scopes.clear(); _currentSymbol = 0; - Node::accept(doc->program(), this); + Node::accept(doc->qmlProgram(), this); return _scopes; } @@ -179,7 +178,7 @@ namespace QmlJSEditor { private: void push(Node *node) { - QmlSymbolFromFile* symbol; + SymbolFromFile* symbol; if (_currentSymbol) { symbol = _currentSymbol->findMember(node); @@ -196,10 +195,10 @@ namespace QmlJSEditor { } private: - QmlDocument::Ptr _doc; + Document::Ptr _doc; quint32 _pos; - QStack<QmlSymbol*> _scopes; - QmlSymbolFromFile* _currentSymbol; + QStack<Symbol*> _scopes; + SymbolFromFile* _currentSymbol; }; } } @@ -220,7 +219,7 @@ QmlExpressionUnderCursor::~QmlExpressionUnderCursor() } void QmlExpressionUnderCursor::operator()(const QTextCursor &cursor, - const QmlDocument::Ptr &doc) + const Document::Ptr &doc) { if (_engine) { delete _engine; _engine = 0; } if (_nodePool) { delete _nodePool; _nodePool = 0; } diff --git a/src/plugins/qmljseditor/qmlexpressionundercursor.h b/src/plugins/qmljseditor/qmlexpressionundercursor.h index c458caaaf7a26a779d2cea7ca13e477346845699..83e814e5c0f56be0fab58acf5301b5302fc160c9 100644 --- a/src/plugins/qmljseditor/qmlexpressionundercursor.h +++ b/src/plugins/qmljseditor/qmlexpressionundercursor.h @@ -31,8 +31,8 @@ #define QMLEXPRESSIONUNDERCURSOR_H #include <qmljs/parser/qmljsastfwd_p.h> -#include <qmljs/qmldocument.h> -#include <qmljs/qmlsymbol.h> +#include <qmljs/qmljsdocument.h> +#include <qmljs/qmljssymbol.h> #include <QStack> #include <QTextBlock> @@ -52,9 +52,9 @@ public: QmlExpressionUnderCursor(); virtual ~QmlExpressionUnderCursor(); - void operator()(const QTextCursor &cursor, const Qml::QmlDocument::Ptr &doc); + void operator()(const QTextCursor &cursor, const QmlJS::Document::Ptr &doc); - QStack<Qml::QmlSymbol *> expressionScopes() const + QStack<QmlJS::Symbol *> expressionScopes() const { return _expressionScopes; } QmlJS::AST::Node *expressionNode() const @@ -73,7 +73,7 @@ private: QmlJS::AST::UiObjectMember *tryBinding(const QString &text); private: - QStack<Qml::QmlSymbol *> _expressionScopes; + QStack<QmlJS::Symbol *> _expressionScopes; QmlJS::AST::Node *_expressionNode; int _expressionOffset; int _expressionLength; diff --git a/src/plugins/qmljseditor/qmlhighlighter.cpp b/src/plugins/qmljseditor/qmlhighlighter.cpp index b074ca2b17c868e06e3566bfc2d84a5b3e2e7be9..e13d7b68ae089138763ed896d3a12599c68e8ed6 100644 --- a/src/plugins/qmljseditor/qmlhighlighter.cpp +++ b/src/plugins/qmljseditor/qmlhighlighter.cpp @@ -35,7 +35,7 @@ using namespace QmlJSEditor; using namespace QmlJSEditor::Internal; QmlHighlighter::QmlHighlighter(QTextDocument *parent) : - SharedTools::QScriptHighlighter(true, parent) + QmlJS::QScriptHighlighter(true, parent) { m_currentBlockParentheses.reserve(20); m_braceDepth = 0; diff --git a/src/plugins/qmljseditor/qmlhighlighter.h b/src/plugins/qmljseditor/qmlhighlighter.h index 0ffad660c3cbe937baa1761dc267bbb7f88f6b3e..4b8c10c4d4caf9cf5810838fe5a23b5366124d64 100644 --- a/src/plugins/qmljseditor/qmlhighlighter.h +++ b/src/plugins/qmljseditor/qmlhighlighter.h @@ -30,7 +30,7 @@ #ifndef QMLSYNTAXHIGHLIGHTER_H #define QMLSYNTAXHIGHLIGHTER_H -#include <qscripthighlighter/qscripthighlighter.h> +#include <qmljs/qmljshighlighter.h> #include <texteditor/basetexteditor.h> namespace QmlJSEditor { @@ -40,7 +40,7 @@ namespace Internal { // the parentheses encountered in the block data // for parentheses matching to work. -class QmlHighlighter : public SharedTools::QScriptHighlighter +class QmlHighlighter : public QmlJS::QScriptHighlighter { Q_OBJECT public: diff --git a/src/plugins/qmljseditor/qmlhoverhandler.cpp b/src/plugins/qmljseditor/qmlhoverhandler.cpp index 6f33b6dd490cccd25499138004b061d316da1649..e26f97058458c698ce58100d1448baf32fbd0485 100644 --- a/src/plugins/qmljseditor/qmlhoverhandler.cpp +++ b/src/plugins/qmljseditor/qmlhoverhandler.cpp @@ -38,7 +38,7 @@ #include <coreplugin/editormanager/editormanager.h> #include <debugger/debuggerconstants.h> #include <extensionsystem/pluginmanager.h> -#include <qmljs/qmlsymbol.h> +#include <qmljs/qmljssymbol.h> #include <texteditor/itexteditor.h> #include <texteditor/basetexteditor.h> @@ -52,7 +52,7 @@ #include <QtHelp/QHelpEngineCore> using namespace Core; -using namespace Qml; +using namespace QmlJS; using namespace QmlJSEditor; using namespace QmlJSEditor::Internal; @@ -128,7 +128,7 @@ void QmlHoverHandler::updateContextHelpId(TextEditor::ITextEditor *editor, int p updateHelpIdAndTooltip(editor, pos); } -static QString buildHelpId(QmlSymbol *symbol) +static QString buildHelpId(Symbol *symbol) { if (!symbol) return QString(); @@ -152,7 +152,7 @@ void QmlHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in const Snapshot documents = m_modelManager->snapshot(); const QString fileName = editor->file()->fileName(); - QmlDocument::Ptr doc = documents.value(fileName); + Document::Ptr doc = documents.value(fileName); if (!doc) return; // nothing to do @@ -188,18 +188,18 @@ void QmlHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in QmlExpressionUnderCursor expressionUnderCursor; expressionUnderCursor(tc, doc); - Qml::QmlTypeSystem *typeSystem = ExtensionSystem::PluginManager::instance()->getObject<Qml::QmlTypeSystem>(); + QmlJS::TypeSystem *typeSystem = ExtensionSystem::PluginManager::instance()->getObject<QmlJS::TypeSystem>(); QmlLookupContext context(expressionUnderCursor.expressionScopes(), doc, m_modelManager->snapshot(), typeSystem); QmlResolveExpression resolver(context); - QmlSymbol *resolvedSymbol = resolver.typeOf(expressionUnderCursor.expressionNode()); + Symbol *resolvedSymbol = resolver.typeOf(expressionUnderCursor.expressionNode()); if (resolvedSymbol) { symbolName = resolvedSymbol->name(); if (resolvedSymbol->isBuildInSymbol()) m_helpId = buildHelpId(resolvedSymbol); - else if (QmlSymbolFromFile *symbolFromFile = resolvedSymbol->asSymbolFromFile()) + else if (SymbolFromFile *symbolFromFile = resolvedSymbol->asSymbolFromFile()) m_toolTip = symbolFromFile->fileName(); } } diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index c627d342083f413ba90a0c4a89e34ca50a60b1c1..76ca9372ecb460b842782555948b18c16302ce78 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -37,14 +37,14 @@ #include "qmllookupcontext.h" #include "qmlresolveexpression.h" -#include <qscripthighlighter/qscriptindenter.h> +#include <qmljs/qmljsindenter.h> -#include <qmljs/qmltypesystem.h> +#include <qmljs/qmljstypesystem.h> #include <qmljs/parser/qmljsastvisitor_p.h> #include <qmljs/parser/qmljsast_p.h> #include <qmljs/parser/qmljsengine_p.h> -#include <qmljs/qmldocument.h> -#include <qmljs/qmlidcollector.h> +#include <qmljs/qmljsdocument.h> +#include <qmljs/qmljsidcollector.h> #include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/icore.h> @@ -74,10 +74,8 @@ enum { UPDATE_USES_DEFAULT_INTERVAL = 150 }; -using namespace Qml; using namespace QmlJS; using namespace QmlJS::AST; -using namespace SharedTools; namespace { int blockBraceDepth(const QTextBlock &block) @@ -360,11 +358,11 @@ QmlJSTextEditor::QmlJSTextEditor(QWidget *parent) : baseTextDocument()->setSyntaxHighlighter(new QmlHighlighter); m_modelManager = ExtensionSystem::PluginManager::instance()->getObject<QmlModelManagerInterface>(); - m_typeSystem = ExtensionSystem::PluginManager::instance()->getObject<Qml::QmlTypeSystem>(); + m_typeSystem = ExtensionSystem::PluginManager::instance()->getObject<QmlJS::TypeSystem>(); if (m_modelManager) { - connect(m_modelManager, SIGNAL(documentUpdated(Qml::QmlDocument::Ptr)), - this, SLOT(onDocumentUpdated(Qml::QmlDocument::Ptr))); + connect(m_modelManager, SIGNAL(documentUpdated(QmlJS::Document::Ptr)), + this, SLOT(onDocumentUpdated(QmlJS::Document::Ptr))); } } @@ -416,7 +414,7 @@ void QmlJSTextEditor::updateDocumentNow() m_modelManager->updateSourceFiles(QStringList() << fileName); } -void QmlJSTextEditor::onDocumentUpdated(Qml::QmlDocument::Ptr doc) +void QmlJSTextEditor::onDocumentUpdated(QmlJS::Document::Ptr doc) { if (file()->fileName() != doc->fileName()) return; @@ -425,11 +423,11 @@ void QmlJSTextEditor::onDocumentUpdated(Qml::QmlDocument::Ptr doc) FindIdDeclarations updateIds; m_idsRevision = document()->revision(); - m_ids = updateIds(doc->program()); + m_ids = updateIds(doc->qmlProgram()); if (doc->isParsedCorrectly()) { FindDeclarations findDeclarations; - m_declarations = findDeclarations(doc->program()); + m_declarations = findDeclarations(doc->qmlProgram()); QStringList items; items.append(tr("<Select Symbol>")); @@ -618,13 +616,13 @@ bool QmlJSTextEditor::isElectricCharacter(const QChar &ch) const return false; } -bool QmlJSTextEditor::isClosingBrace(const QList<QScriptIncrementalScanner::Token> &tokens) const +bool QmlJSTextEditor::isClosingBrace(const QList<QmlJSScanner::Token> &tokens) const { if (tokens.size() == 1) { - const QScriptIncrementalScanner::Token firstToken = tokens.first(); + const QmlJSScanner::Token firstToken = tokens.first(); - return firstToken.is(QScriptIncrementalScanner::Token::RightBrace) || firstToken.is(QScriptIncrementalScanner::Token::RightBracket); + return firstToken.is(QmlJSScanner::Token::RightBrace) || firstToken.is(QmlJSScanner::Token::RightBracket); } return false; @@ -633,7 +631,7 @@ bool QmlJSTextEditor::isClosingBrace(const QList<QScriptIncrementalScanner::Toke void QmlJSTextEditor::indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar) { TextEditor::TabSettings ts = tabSettings(); - SharedTools::QScriptIndenter indenter; + QmlJSIndenter indenter; indenter.setTabSize(ts.m_tabSize); indenter.setIndentSize(ts.m_indentSize); @@ -679,7 +677,7 @@ TextEditor::BaseTextEditor::Link QmlJSTextEditor::findLinkAt(const QTextCursor & return link; const Snapshot snapshot = m_modelManager->snapshot(); - QmlDocument::Ptr doc = snapshot.document(file()->fileName()); + Document::Ptr doc = snapshot.document(file()->fileName()); if (!doc) return link; @@ -703,12 +701,12 @@ TextEditor::BaseTextEditor::Link QmlJSTextEditor::findLinkAt(const QTextCursor & QmlLookupContext context(expressionUnderCursor.expressionScopes(), doc, snapshot, m_typeSystem); QmlResolveExpression resolver(context); - QmlSymbol *symbol = resolver.typeOf(expressionUnderCursor.expressionNode()); + Symbol *symbol = resolver.typeOf(expressionUnderCursor.expressionNode()); if (!symbol) return link; - if (const QmlSymbolFromFile *target = symbol->asSymbolFromFile()) { + if (const SymbolFromFile *target = symbol->asSymbolFromFile()) { link.pos = expressionUnderCursor.expressionOffset(); link.length = expressionUnderCursor.expressionLength(); link.fileName = target->fileName(); @@ -795,32 +793,32 @@ bool QmlJSTextEditor::contextAllowsAutoParentheses(const QTextCursor &cursor, co const QString blockText = cursor.block().text(); const int blockState = blockStartState(cursor.block()); - QScriptIncrementalScanner tokenize; - const QList<QScriptIncrementalScanner::Token> tokens = tokenize(blockText, blockState); + QmlJSScanner tokenize; + const QList<QmlJSScanner::Token> tokens = tokenize(blockText, blockState); const int pos = cursor.columnNumber(); int tokenIndex = 0; for (; tokenIndex < tokens.size(); ++tokenIndex) { - const QScriptIncrementalScanner::Token &token = tokens.at(tokenIndex); + const QmlJSScanner::Token &token = tokens.at(tokenIndex); if (pos >= token.begin()) { if (pos < token.end()) break; - else if (pos == token.end() && (token.is(QScriptIncrementalScanner::Token::Comment) || - token.is(QScriptIncrementalScanner::Token::String))) + else if (pos == token.end() && (token.is(QmlJSScanner::Token::Comment) || + token.is(QmlJSScanner::Token::String))) break; } } if (tokenIndex != tokens.size()) { - const QScriptIncrementalScanner::Token &token = tokens.at(tokenIndex); + const QmlJSScanner::Token &token = tokens.at(tokenIndex); switch (token.kind) { - case QScriptIncrementalScanner::Token::Comment: + case QmlJSScanner::Token::Comment: return false; - case QScriptIncrementalScanner::Token::String: { + case QmlJSScanner::Token::String: { const QStringRef tokenText = blockText.midRef(token.offset, token.length); const QChar quote = tokenText.at(0); diff --git a/src/plugins/qmljseditor/qmljseditor.h b/src/plugins/qmljseditor/qmljseditor.h index a99826834ce3377b29141a481887c7f4e4b26dfb..2a08ef8d704b1933a4b119ab272d265fd8d590c3 100644 --- a/src/plugins/qmljseditor/qmljseditor.h +++ b/src/plugins/qmljseditor/qmljseditor.h @@ -30,8 +30,8 @@ #ifndef QMLJSEDITOR_H #define QMLJSEDITOR_H -#include <qmljs/qmldocument.h> -#include <qscripthighlighter/qscriptincrementalscanner.h> +#include <qmljs/qmljsdocument.h> +#include <qmljs/qmljsscanner.h> #include <texteditor/basetexteditor.h> QT_BEGIN_NAMESPACE @@ -43,8 +43,8 @@ namespace Core { class ICore; } -namespace Qml { - class QmlTypeSystem; +namespace QmlJS { + class TypeSystem; } namespace QmlJSEditor { @@ -109,13 +109,13 @@ public: virtual void unCommentSelection(); - Qml::QmlDocument::Ptr qmlDocument() const { return m_document; } + QmlJS::Document::Ptr qmlDocument() const { return m_document; } public slots: virtual void setFontSettings(const TextEditor::FontSettings &); private slots: - void onDocumentUpdated(Qml::QmlDocument::Ptr doc); + void onDocumentUpdated(QmlJS::Document::Ptr doc); void updateDocument(); void updateDocumentNow(); @@ -145,7 +145,7 @@ protected: private: virtual bool isElectricCharacter(const QChar &ch) const; virtual void indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar); - bool isClosingBrace(const QList<SharedTools::QScriptIncrementalScanner::Token> &tokens) const; + bool isClosingBrace(const QList<QmlJS::QmlJSScanner::Token> &tokens) const; QString wordUnderCursor() const; @@ -158,9 +158,9 @@ private: QMap<QString, QList<QmlJS::AST::SourceLocation> > m_ids; // ### use QMultiMap int m_idsRevision; QList<QmlJS::DiagnosticMessage> m_diagnosticMessages; - Qml::QmlDocument::Ptr m_document; + QmlJS::Document::Ptr m_document; QmlModelManagerInterface *m_modelManager; - Qml::QmlTypeSystem *m_typeSystem; + QmlJS::TypeSystem *m_typeSystem; QTextCharFormat m_occurrencesFormat; }; diff --git a/src/plugins/qmljseditor/qmljseditor.pro b/src/plugins/qmljseditor/qmljseditor.pro index 01ebebda2b875fa9f2fc47706462802c51c22ba3..350a284581e8db8c0d370ff73e9d7abf3346a3ec 100644 --- a/src/plugins/qmljseditor/qmljseditor.pro +++ b/src/plugins/qmljseditor/qmljseditor.pro @@ -3,10 +3,6 @@ TARGET = QmlJSEditor include(../../qtcreatorplugin.pri) include(qmljseditor_dependencies.pri) -include(../../shared/qscripthighlighter/qscripthighlighter.pri) -DEPENDPATH += ../../shared/qscripthighlighter - - CONFIG += help DEFINES += \ QMLJSEDITOR_LIBRARY \ diff --git a/src/plugins/qmljseditor/qmljseditorplugin.cpp b/src/plugins/qmljseditor/qmljseditorplugin.cpp index aee7f43c5b574ca49240744317d5b8457f647bfc..403d699ab8af5ab92576a08707f29d0cb17ba608 100644 --- a/src/plugins/qmljseditor/qmljseditorplugin.cpp +++ b/src/plugins/qmljseditor/qmljseditorplugin.cpp @@ -92,7 +92,7 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e m_modelManager = new QmlModelManager(this); addAutoReleasedObject(m_modelManager); - Qml::QmlTypeSystem *typeSystem = new Qml::QmlTypeSystem; + QmlJS::TypeSystem *typeSystem = new QmlJS::TypeSystem; addAutoReleasedObject(typeSystem); QList<int> context; diff --git a/src/plugins/qmljseditor/qmllookupcontext.cpp b/src/plugins/qmljseditor/qmllookupcontext.cpp index d22133fc127ce404689c405bb211a93e7ba2ba7a..007afb6651a2a276b2675a589f376117769445ee 100644 --- a/src/plugins/qmljseditor/qmllookupcontext.cpp +++ b/src/plugins/qmljseditor/qmllookupcontext.cpp @@ -33,20 +33,19 @@ #include <qmljs/parser/qmljsast_p.h> #include <qmljs/parser/qmljsengine_p.h> -#include <qmljs/qmltypesystem.h> +#include <qmljs/qmljstypesystem.h> #include <QDebug> -using namespace Qml; +using namespace QmlJS; using namespace QmlJSEditor; using namespace QmlJSEditor::Internal; -using namespace QmlJS; using namespace QmlJS::AST; -QmlLookupContext::QmlLookupContext(const QStack<QmlSymbol *> &scopes, - const QmlDocument::Ptr &doc, +QmlLookupContext::QmlLookupContext(const QStack<Symbol *> &scopes, + const Document::Ptr &doc, const Snapshot &snapshot, - QmlTypeSystem *typeSystem): + TypeSystem *typeSystem): _scopes(scopes), _doc(doc), _snapshot(snapshot), @@ -55,13 +54,13 @@ QmlLookupContext::QmlLookupContext(const QStack<QmlSymbol *> &scopes, Q_ASSERT(typeSystem != 0); } -static inline int findFirstQmlObjectScope(const QStack<QmlSymbol*> &scopes, int startIdx) +static inline int findFirstQmlObjectScope(const QStack<Symbol*> &scopes, int startIdx) { if (startIdx < 0 || startIdx >= scopes.size()) return -1; for (int i = startIdx; i >= 0; --i) { - QmlSymbol *current = scopes.at(i); + Symbol *current = scopes.at(i); if (current->isSymbolFromFile()) { Node *node = current->asSymbolFromFile()->node(); @@ -75,7 +74,7 @@ static inline int findFirstQmlObjectScope(const QStack<QmlSymbol*> &scopes, int return -1; } -static inline QmlSymbol *resolveParent(const QStack<QmlSymbol*> &scopes) +static inline Symbol *resolveParent(const QStack<Symbol*> &scopes) { int idx = findFirstQmlObjectScope(scopes, scopes.size() - 1); if (idx < 1) @@ -89,14 +88,14 @@ static inline QmlSymbol *resolveParent(const QStack<QmlSymbol*> &scopes) return scopes.at(idx); } -QmlSymbol *QmlLookupContext::resolve(const QString &name) +Symbol *QmlLookupContext::resolve(const QString &name) { // find element type names - if (QmlSymbol *type = resolveType(name)) + if (Symbol *type = resolveType(name)) return type; // find ids - const QmlDocument::IdTable ids = _doc->ids(); + const Document::IdTable ids = _doc->ids(); if (ids.contains(name)) return ids[name]; @@ -110,12 +109,12 @@ QmlSymbol *QmlLookupContext::resolve(const QString &name) // find properties of the scope object int scopeObjectIndex = findFirstQmlObjectScope(_scopes, _scopes.size() - 1); if (scopeObjectIndex != -1) - if (QmlSymbol *propertySymbol = resolveProperty(name, _scopes.at(scopeObjectIndex), _doc->fileName())) + if (Symbol *propertySymbol = resolveProperty(name, _scopes.at(scopeObjectIndex), _doc->fileName())) return propertySymbol; // find properties of the component's root object if (!_doc->symbols().isEmpty()) - if (QmlSymbol *propertySymbol = resolveProperty(name, _doc->symbols()[0], _doc->fileName())) + if (Symbol *propertySymbol = resolveProperty(name, _doc->symbols()[0], _doc->fileName())) return propertySymbol; // component chain @@ -130,14 +129,14 @@ QmlSymbol *QmlLookupContext::resolve(const QString &name) return 0; } -QmlSymbol *QmlLookupContext::resolveType(const QString &name, const QString &fileName) +Symbol *QmlLookupContext::resolveType(const QString &name, const QString &fileName) { // TODO: handle import-as. - QmlDocument::Ptr document = _snapshot[fileName]; + Document::Ptr document = _snapshot[fileName]; if (document.isNull()) return 0; - UiProgram *prog = document->program(); + UiProgram *prog = document->qmlProgram(); if (!prog) return 0; @@ -157,9 +156,9 @@ QmlSymbol *QmlLookupContext::resolveType(const QString &name, const QString &fil const QString path = import->fileName->asString(); - const QMap<QString, QmlDocument::Ptr> importedTypes = _snapshot.componentsDefinedByImportedDocuments(document, path); + const QMap<QString, Document::Ptr> importedTypes = _snapshot.componentsDefinedByImportedDocuments(document, path); if (importedTypes.contains(name)) { - QmlDocument::Ptr importedDoc = importedTypes.value(name); + Document::Ptr importedDoc = importedTypes.value(name); return importedDoc->symbols().at(0); } @@ -169,17 +168,17 @@ QmlSymbol *QmlLookupContext::resolveType(const QString &name, const QString &fil return resolveBuildinType(name); } -QmlSymbol *QmlLookupContext::resolveBuildinType(const QString &name) +Symbol *QmlLookupContext::resolveBuildinType(const QString &name) { - QList<Qml::PackageInfo> packages; + QList<QmlJS::PackageInfo> packages; // FIXME: packages.append(PackageInfo("Qt", 4, 6)); return m_typeSystem->resolve(name, packages); } -QmlSymbol *QmlLookupContext::resolveProperty(const QString &name, QmlSymbol *scope, const QString &fileName) +Symbol *QmlLookupContext::resolveProperty(const QString &name, Symbol *scope, const QString &fileName) { - foreach (QmlSymbol *symbol, scope->members()) + foreach (Symbol *symbol, scope->members()) if (symbol->isProperty() && symbol->name() == name) return symbol; @@ -198,14 +197,14 @@ QmlSymbol *QmlLookupContext::resolveProperty(const QString &name, QmlSymbol *sco if (typeName == 0) return 0; - QmlSymbol *typeSymbol = resolveType(toString(typeName), fileName); + Symbol *typeSymbol = resolveType(toString(typeName), fileName); if (!typeSymbol) return 0; if (typeSymbol->isSymbolFromFile()) { return resolveProperty(name, typeSymbol->asSymbolFromFile(), typeSymbol->asSymbolFromFile()->fileName()); - } else if (QmlBuildInSymbol *builtinSymbol = typeSymbol->asBuildInSymbol()) { - foreach (QmlSymbol *member, builtinSymbol->members(true)) { + } else if (PrimitiveSymbol *builtinSymbol = typeSymbol->asPrimitiveSymbol()) { + foreach (Symbol *member, builtinSymbol->members(true)) { if (member->isProperty() && member->name() == name) return member; } @@ -231,12 +230,12 @@ QString QmlLookupContext::toString(UiQualifiedId *id) return str; } -QList<QmlSymbol*> QmlLookupContext::visibleSymbolsInScope() +QList<Symbol*> QmlLookupContext::visibleSymbolsInScope() { - QList<QmlSymbol*> result; + QList<Symbol*> result; if (!_scopes.isEmpty()) { - QmlSymbol *scope = _scopes.top(); + Symbol *scope = _scopes.top(); // add members defined in this symbol: result.append(scope->members()); @@ -248,11 +247,11 @@ QList<QmlSymbol*> QmlLookupContext::visibleSymbolsInScope() return result; } -QList<QmlSymbol*> QmlLookupContext::visibleTypes() +QList<Symbol*> QmlLookupContext::visibleTypes() { - QList<QmlSymbol*> result; + QList<Symbol*> result; - UiProgram *program = _doc->program(); + UiProgram *program = _doc->qmlProgram(); if (!program) return result; @@ -267,8 +266,8 @@ QList<QmlSymbol*> QmlLookupContext::visibleTypes() // TODO: handle "import as". - const QMap<QString, QmlDocument::Ptr> types = _snapshot.componentsDefinedByImportedDocuments(_doc, path); - foreach (const QmlDocument::Ptr typeDoc, types) { + const QMap<QString, Document::Ptr> types = _snapshot.componentsDefinedByImportedDocuments(_doc, path); + foreach (const Document::Ptr typeDoc, types) { result.append(typeDoc->symbols().at(0)); } } @@ -278,22 +277,22 @@ QList<QmlSymbol*> QmlLookupContext::visibleTypes() return result; } -QList<QmlSymbol*> QmlLookupContext::expandType(Qml::QmlSymbol *symbol) +QList<Symbol*> QmlLookupContext::expandType(QmlJS::Symbol *symbol) { if (symbol == 0) { - return QList<QmlSymbol*>(); - } else if (QmlBuildInSymbol *buildInSymbol = symbol->asBuildInSymbol()) { + return QList<Symbol*>(); + } else if (PrimitiveSymbol *buildInSymbol = symbol->asPrimitiveSymbol()) { return buildInSymbol->members(true); - } else if (QmlSymbolFromFile *symbolFromFile = symbol->asSymbolFromFile()){ - QList<QmlSymbol*> result; + } else if (SymbolFromFile *symbolFromFile = symbol->asSymbolFromFile()){ + QList<Symbol*> result; - if (QmlSymbol *superTypeSymbol = resolveType(symbolFromFile->name(), symbolFromFile->fileName())) { + if (Symbol *superTypeSymbol = resolveType(symbolFromFile->name(), symbolFromFile->fileName())) { result.append(superTypeSymbol->members()); result.append(expandType(superTypeSymbol)); } return result; } else { - return QList<QmlSymbol*>(); + return QList<Symbol*>(); } } diff --git a/src/plugins/qmljseditor/qmllookupcontext.h b/src/plugins/qmljseditor/qmllookupcontext.h index 4817aa6a1c6f37cfa890eacbb0653f794c1cf538..973276b2e2f6a23a10b401c6eac6f6cf92387f57 100644 --- a/src/plugins/qmljseditor/qmllookupcontext.h +++ b/src/plugins/qmljseditor/qmllookupcontext.h @@ -30,10 +30,10 @@ #ifndef QMLLOOKUPCONTEXT_H #define QMLLOOKUPCONTEXT_H -#include <qmljs/qmltypesystem.h> +#include <qmljs/qmljstypesystem.h> #include <qmljs/parser/qmljsastvisitor_p.h> -#include <qmljs/qmldocument.h> -#include <qmljs/qmlsymbol.h> +#include <qmljs/qmljsdocument.h> +#include <qmljs/qmljssymbol.h> #include <QStack> @@ -43,37 +43,37 @@ namespace Internal { class QmlLookupContext { public: - QmlLookupContext(const QStack<Qml::QmlSymbol *> &scopes, - const Qml::QmlDocument::Ptr &doc, - const Qml::Snapshot &snapshot, - Qml::QmlTypeSystem *typeSystem); + QmlLookupContext(const QStack<QmlJS::Symbol *> &scopes, + const QmlJS::Document::Ptr &doc, + const QmlJS::Snapshot &snapshot, + QmlJS::TypeSystem *typeSystem); - Qml::QmlSymbol *resolve(const QString &name); - Qml::QmlSymbol *resolveType(const QString &name) + QmlJS::Symbol *resolve(const QString &name); + QmlJS::Symbol *resolveType(const QString &name) { return resolveType(name, _doc->fileName()); } - Qml::QmlSymbol *resolveType(QmlJS::AST::UiQualifiedId *name) + QmlJS::Symbol *resolveType(QmlJS::AST::UiQualifiedId *name) { return resolveType(toString(name), _doc->fileName()); } - Qml::QmlDocument::Ptr document() const + QmlJS::Document::Ptr document() const { return _doc; } - QList<Qml::QmlSymbol*> visibleSymbolsInScope(); - QList<Qml::QmlSymbol*> visibleTypes(); + QList<QmlJS::Symbol*> visibleSymbolsInScope(); + QList<QmlJS::Symbol*> visibleTypes(); - QList<Qml::QmlSymbol*> expandType(Qml::QmlSymbol *symbol); + QList<QmlJS::Symbol*> expandType(QmlJS::Symbol *symbol); private: - Qml::QmlSymbol *resolveType(const QString &name, const QString &fileName); - Qml::QmlSymbol *resolveProperty(const QString &name, Qml::QmlSymbol *scope, const QString &fileName); - Qml::QmlSymbol *resolveBuildinType(const QString &name); + QmlJS::Symbol *resolveType(const QString &name, const QString &fileName); + QmlJS::Symbol *resolveProperty(const QString &name, QmlJS::Symbol *scope, const QString &fileName); + QmlJS::Symbol *resolveBuildinType(const QString &name); static QString toString(QmlJS::AST::UiQualifiedId *id); private: - QStack<Qml::QmlSymbol *> _scopes; - Qml::QmlDocument::Ptr _doc; - Qml::Snapshot _snapshot; - Qml::QmlTypeSystem *m_typeSystem; + QStack<QmlJS::Symbol *> _scopes; + QmlJS::Document::Ptr _doc; + QmlJS::Snapshot _snapshot; + QmlJS::TypeSystem *m_typeSystem; }; } // namespace Internal diff --git a/src/plugins/qmljseditor/qmlmodelmanager.cpp b/src/plugins/qmljseditor/qmlmodelmanager.cpp index 495dcd0114aa4be0b06c82047fbdda8b849d2146..3c4f7033836e3bb5c14f94078537a700973660bb 100644 --- a/src/plugins/qmljseditor/qmlmodelmanager.cpp +++ b/src/plugins/qmljseditor/qmlmodelmanager.cpp @@ -27,21 +27,20 @@ ** **************************************************************************/ -#include <QFile> -#include <QtConcurrentRun> -#include <qtconcurrent/runextensions.h> -#include <QTextStream> +#include "qmljseditorconstants.h" +#include "qmlmodelmanager.h" #include <coreplugin/icore.h> #include <coreplugin/editormanager/editormanager.h> #include <coreplugin/progressmanager/progressmanager.h> - +#include <coreplugin/mimedatabase.h> #include <texteditor/itexteditor.h> -#include "qmljseditorconstants.h" -#include "qmlmodelmanager.h" - -#include <QtCore/QMetaType> +#include <QFile> +#include <QFileInfo> +#include <QtConcurrentRun> +#include <qtconcurrent/runextensions.h> +#include <QTextStream> using namespace QmlJSEditor; using namespace QmlJSEditor::Internal; @@ -52,13 +51,13 @@ QmlModelManager::QmlModelManager(QObject *parent): { m_synchronizer.setCancelOnWait(true); - qRegisterMetaType<Qml::QmlDocument::Ptr>("Qml::QmlDocument::Ptr"); + qRegisterMetaType<QmlJS::Document::Ptr>("QmlJS::Document::Ptr"); - connect(this, SIGNAL(documentUpdated(Qml::QmlDocument::Ptr)), - this, SLOT(onDocumentUpdated(Qml::QmlDocument::Ptr))); + connect(this, SIGNAL(documentUpdated(QmlJS::Document::Ptr)), + this, SLOT(onDocumentUpdated(QmlJS::Document::Ptr))); } -Qml::Snapshot QmlModelManager::snapshot() const +QmlJS::Snapshot QmlModelManager::snapshot() const { QMutexLocker locker(&m_mutex); @@ -119,10 +118,10 @@ QMap<QString, QString> QmlModelManager::buildWorkingCopyList() return workingCopy; } -void QmlModelManager::emitDocumentUpdated(Qml::QmlDocument::Ptr doc) +void QmlModelManager::emitDocumentUpdated(QmlJS::Document::Ptr doc) { emit documentUpdated(doc); } -void QmlModelManager::onDocumentUpdated(Qml::QmlDocument::Ptr doc) +void QmlModelManager::onDocumentUpdated(QmlJS::Document::Ptr doc) { QMutexLocker locker(&m_mutex); @@ -154,9 +153,23 @@ void QmlModelManager::parse(QFutureInterface<void> &future, } } - Qml::QmlDocument::Ptr doc = Qml::QmlDocument::create(fileName); + QmlJS::Document::Ptr doc = QmlJS::Document::create(fileName); doc->setSource(contents); - doc->parse(); + + { + Core::MimeDatabase *db = Core::ICore::instance()->mimeDatabase(); + Core::MimeType jsSourceTy = db->findByType(QLatin1String("application/javascript")); + Core::MimeType qmlSourceTy = db->findByType(QLatin1String("application/x-qml")); + + const QFileInfo fileInfo(fileName); + + if (jsSourceTy.matchesFile(fileInfo)) + doc->parseJavaScript(); + else if (qmlSourceTy.matchesFile(fileInfo)) + doc->parseQml(); + else + qWarning() << "Don't know how to treat" << fileName; + } modelManager->emitDocumentUpdated(doc); } diff --git a/src/plugins/qmljseditor/qmlmodelmanager.h b/src/plugins/qmljseditor/qmlmodelmanager.h index e4617947f241c78b598189722a035e40548ff40c..a015b8ea393b970153ad8f9db68951f6534e4aae 100644 --- a/src/plugins/qmljseditor/qmlmodelmanager.h +++ b/src/plugins/qmljseditor/qmlmodelmanager.h @@ -32,7 +32,7 @@ #include "qmlmodelmanagerinterface.h" -#include <qmljs/qmldocument.h> +#include <qmljs/qmljsdocument.h> #include <QFuture> #include <QFutureSynchronizer> @@ -52,10 +52,10 @@ class QmlModelManager: public QmlModelManagerInterface public: QmlModelManager(QObject *parent = 0); - virtual Qml::Snapshot snapshot() const; + virtual QmlJS::Snapshot snapshot() const; virtual void updateSourceFiles(const QStringList &files); - void emitDocumentUpdated(Qml::QmlDocument::Ptr doc); + void emitDocumentUpdated(QmlJS::Document::Ptr doc); Q_SIGNALS: void projectPathChanged(const QString &projectPath); @@ -63,7 +63,7 @@ Q_SIGNALS: private Q_SLOTS: // this should be executed in the GUI thread. - void onDocumentUpdated(Qml::QmlDocument::Ptr doc); + void onDocumentUpdated(QmlJS::Document::Ptr doc); protected: QFuture<void> refreshSourceFiles(const QStringList &sourceFiles); @@ -77,7 +77,7 @@ protected: private: mutable QMutex m_mutex; Core::ICore *m_core; - Qml::Snapshot _snapshot; + QmlJS::Snapshot _snapshot; QFutureSynchronizer<void> m_synchronizer; }; diff --git a/src/plugins/qmljseditor/qmlmodelmanagerinterface.h b/src/plugins/qmljseditor/qmlmodelmanagerinterface.h index c23e4248ab129f08e321a4552fdd567898ff4358..49d358ccf25517972cb7a42a4786db326ccb8c6d 100644 --- a/src/plugins/qmljseditor/qmlmodelmanagerinterface.h +++ b/src/plugins/qmljseditor/qmlmodelmanagerinterface.h @@ -32,14 +32,14 @@ #include "qmljseditor_global.h" -#include <qmljs/qmldocument.h> -#include <qmljs/qmltypesystem.h> +#include <qmljs/qmljsdocument.h> +#include <qmljs/qmljstypesystem.h> #include <QObject> #include <QStringList> #include <QSharedPointer> -namespace Qml { +namespace QmlJS { class Snapshot; } @@ -53,11 +53,11 @@ public: QmlModelManagerInterface(QObject *parent = 0); virtual ~QmlModelManagerInterface(); - virtual Qml::Snapshot snapshot() const = 0; + virtual QmlJS::Snapshot snapshot() const = 0; virtual void updateSourceFiles(const QStringList &files) = 0; signals: - void documentUpdated(Qml::QmlDocument::Ptr doc); + void documentUpdated(QmlJS::Document::Ptr doc); }; } // namespace QmlJSEditor diff --git a/src/plugins/qmljseditor/qmlresolveexpression.cpp b/src/plugins/qmljseditor/qmlresolveexpression.cpp index 80a54ee8d27538e0b61931d3d0bba2b902f44165..b651aa5bb02fac539b499d1087c2d2b9922f5689 100644 --- a/src/plugins/qmljseditor/qmlresolveexpression.cpp +++ b/src/plugins/qmljseditor/qmlresolveexpression.cpp @@ -32,7 +32,6 @@ #include <qmljs/parser/qmljsast_p.h> #include <qmljs/parser/qmljsengine_p.h> -using namespace Qml; using namespace QmlJSEditor; using namespace QmlJSEditor::Internal; using namespace QmlJS; @@ -43,18 +42,18 @@ QmlResolveExpression::QmlResolveExpression(const QmlLookupContext &context) { } -QmlSymbol *QmlResolveExpression::typeOf(Node *node) +Symbol *QmlResolveExpression::typeOf(Node *node) { - QmlSymbol *previousValue = switchValue(0); + Symbol *previousValue = switchValue(0); Node::accept(node, this); return switchValue(previousValue); } -QList<QmlSymbol*> QmlResolveExpression::visibleSymbols(Node *node) +QList<Symbol*> QmlResolveExpression::visibleSymbols(Node *node) { - QList<QmlSymbol*> result; + QList<Symbol*> result; - QmlSymbol *symbol = typeOf(node); + Symbol *symbol = typeOf(node); if (symbol) { if (symbol->isIdSymbol()) symbol = symbol->asIdSymbol()->parentNode(); @@ -66,7 +65,7 @@ QList<QmlSymbol*> QmlResolveExpression::visibleSymbols(Node *node) } if (node) { - foreach (QmlIdSymbol *idSymbol, _context.document()->ids().values()) + foreach (IdSymbol *idSymbol, _context.document()->ids().values()) result.append(idSymbol); } @@ -75,9 +74,9 @@ QList<QmlSymbol*> QmlResolveExpression::visibleSymbols(Node *node) return result; } -QmlSymbol *QmlResolveExpression::switchValue(QmlSymbol *value) +Symbol *QmlResolveExpression::switchValue(Symbol *value) { - QmlSymbol *previousValue = _value; + Symbol *previousValue = _value; _value = value; return previousValue; } @@ -107,7 +106,7 @@ bool QmlResolveExpression::visit(FieldMemberExpression *ast) { const QString memberName = ast->name->asString(); - QmlSymbol *base = typeOf(ast->base); + Symbol *base = typeOf(ast->base); if (!base) return false; @@ -117,7 +116,7 @@ bool QmlResolveExpression::visit(FieldMemberExpression *ast) if (!base) return false; - foreach (QmlSymbol *memberSymbol, base->members()) + foreach (Symbol *memberSymbol, base->members()) if (memberSymbol->name() == memberName) _value = memberSymbol; diff --git a/src/plugins/qmljseditor/qmlresolveexpression.h b/src/plugins/qmljseditor/qmlresolveexpression.h index 6bdfd2dedf388343c76a308bc35800fb5ddd4631..afb2e529ba8dc980ae085b389375fc048ea88678 100644 --- a/src/plugins/qmljseditor/qmlresolveexpression.h +++ b/src/plugins/qmljseditor/qmlresolveexpression.h @@ -33,7 +33,7 @@ #include "qmllookupcontext.h" #include <qmljs/parser/qmljsastvisitor_p.h> -#include <qmljs/qmlsymbol.h> +#include <qmljs/qmljssymbol.h> namespace QmlJSEditor { namespace Internal { @@ -43,13 +43,13 @@ class QmlResolveExpression: protected QmlJS::AST::Visitor public: QmlResolveExpression(const QmlLookupContext &context); - Qml::QmlSymbol *typeOf(QmlJS::AST::Node *node); - QList<Qml::QmlSymbol*> visibleSymbols(QmlJS::AST::Node *node); + QmlJS::Symbol *typeOf(QmlJS::AST::Node *node); + QList<QmlJS::Symbol*> visibleSymbols(QmlJS::AST::Node *node); protected: using QmlJS::AST::Visitor::visit; - Qml::QmlSymbol *switchValue(Qml::QmlSymbol *symbol); + QmlJS::Symbol *switchValue(QmlJS::Symbol *symbol); virtual bool visit(QmlJS::AST::FieldMemberExpression *ast); virtual bool visit(QmlJS::AST::IdentifierExpression *ast); @@ -57,7 +57,7 @@ protected: private: QmlLookupContext _context; - Qml::QmlSymbol *_value; + QmlJS::Symbol *_value; }; } // namespace Internal diff --git a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp index 4a06e4740f8550e2bc4779a9cc1c5e60479d70f5..56e058c2c8ac56529cf187880ba503b1322890a4 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp @@ -100,8 +100,8 @@ void QmlProjectPlugin::extensionsInitialized() QmlJSEditor::QmlModelManagerInterface *modelManager = pluginManager->getObject<QmlJSEditor::QmlModelManagerInterface>(); Q_ASSERT(modelManager); - connect(modelManager, SIGNAL(documentUpdated(Qml::QmlDocument::Ptr)), - m_qmlTaskManager, SLOT(documentUpdated(Qml::QmlDocument::Ptr))); + connect(modelManager, SIGNAL(documentUpdated(QmlJS::Document::Ptr)), + m_qmlTaskManager, SLOT(documentUpdated(QmlJS::Document::Ptr))); } Q_EXPORT_PLUGIN(QmlProjectPlugin) diff --git a/src/plugins/qmlprojectmanager/qmltaskmanager.cpp b/src/plugins/qmlprojectmanager/qmltaskmanager.cpp index ad34a1a227be1f8691c757f9500572585b6315ea..b5f7daa5d5ea27488e475a20f43cdac3df2ea0b7 100644 --- a/src/plugins/qmlprojectmanager/qmltaskmanager.cpp +++ b/src/plugins/qmlprojectmanager/qmltaskmanager.cpp @@ -48,7 +48,7 @@ void QmlTaskManager::setTaskWindow(ProjectExplorer::TaskWindow *taskWindow) m_taskWindow->addCategory(Constants::TASK_CATEGORY_QML, "Qml"); } -void QmlTaskManager::documentUpdated(Qml::QmlDocument::Ptr doc) +void QmlTaskManager::documentUpdated(QmlJS::Document::Ptr doc) { #if 0 // This will give way too many flickering errors in the build-results pane *when you're typing* m_taskWindow->clearTasks(Constants::TASK_CATEGORY_QML); diff --git a/src/plugins/qmlprojectmanager/qmltaskmanager.h b/src/plugins/qmlprojectmanager/qmltaskmanager.h index dd7561f2d88f107ebe03a39ad7ed2afca8a69b35..f4be72a9a87b9b927acb59ff6bacf98359664e43 100644 --- a/src/plugins/qmlprojectmanager/qmltaskmanager.h +++ b/src/plugins/qmlprojectmanager/qmltaskmanager.h @@ -31,7 +31,7 @@ #define QMLTASKMANAGER_H #include <projectexplorer/taskwindow.h> -#include <qmljs/qmldocument.h> +#include <qmljs/qmljsdocument.h> #include <QtCore/QObject> @@ -46,7 +46,7 @@ public: void setTaskWindow(ProjectExplorer::TaskWindow *taskWindow); public slots: - void documentUpdated(Qml::QmlDocument::Ptr doc); + void documentUpdated(QmlJS::Document::Ptr doc); private: ProjectExplorer::TaskWindow *m_taskWindow; diff --git a/src/shared/cplusplus/AST.cpp b/src/shared/cplusplus/AST.cpp index 084334a9ab4ca396cb3fd1b07daf67d8e8b4f7bc..d394fa369410efd52373224a25cb38708f917c1d 100644 --- a/src/shared/cplusplus/AST.cpp +++ b/src/shared/cplusplus/AST.cpp @@ -144,6 +144,47 @@ unsigned AccessDeclarationAST::lastToken() const return access_specifier_token + 1; } +#ifdef ICHECK_BUILD +unsigned QPropertyDeclarationAST::firstToken() const +{ + return property_specifier_token; +} + +unsigned QPropertyDeclarationAST::lastToken() const +{ + return rparen_token; +} + +unsigned QEnumDeclarationAST::firstToken() const +{ + return enum_specifier_token; +} + +unsigned QEnumDeclarationAST::lastToken() const +{ + return rparen_token; +} + +unsigned QFlagsDeclarationAST::firstToken() const +{ + return this->flags_specifier_token; +} + +unsigned QFlagsDeclarationAST::lastToken() const +{ + return rparen_token; +} + +unsigned QDeclareFlagsDeclarationAST::firstToken() const +{ + return declareflags_specifier_token; +} + +unsigned QDeclareFlagsDeclarationAST::lastToken() const +{ + return rparen_token; +} +#endif unsigned ArrayAccessAST::firstToken() const { @@ -1600,7 +1641,9 @@ unsigned ThrowExpressionAST::lastToken() const unsigned TranslationUnitAST::firstToken() const { - return declaration_list->firstToken(); + if(declaration_list) + return declaration_list->firstToken(); + return 0; } unsigned TranslationUnitAST::lastToken() const diff --git a/src/shared/cplusplus/AST.h b/src/shared/cplusplus/AST.h index a26384b74fd8074aa66416944e511ad3a1745ddc..8bbd9fe9891a5b5195775b28cea18ff4c16b5170 100644 --- a/src/shared/cplusplus/AST.h +++ b/src/shared/cplusplus/AST.h @@ -146,6 +146,12 @@ public: virtual AccessDeclarationAST *asAccessDeclaration() { return 0; } virtual ArrayAccessAST *asArrayAccess() { return 0; } virtual ArrayDeclaratorAST *asArrayDeclarator() { return 0; } +#ifdef ICHECK_BUILD + virtual QPropertyDeclarationAST *asQPropertyDeclarationAST() { return 0; } + virtual QEnumDeclarationAST *asQEnumDeclarationAST() { return 0; } + virtual QFlagsDeclarationAST *asQFlagsDeclarationAST() { return 0; } + virtual QDeclareFlagsDeclarationAST *asQDeclareFlagsDeclarationAST() { return 0; } +#endif virtual ArrayInitializerAST *asArrayInitializer() { return 0; } virtual AsmDefinitionAST *asAsmDefinition() { return 0; } virtual AttributeAST *asAttribute() { return 0; } @@ -298,6 +304,9 @@ class CPLUSPLUS_EXPORT DeclarationAST: public AST { public: virtual DeclarationAST *asDeclaration() { return this; } +#ifdef ICHECK_BUILD + unsigned invoke_token; +#endif }; class CPLUSPLUS_EXPORT NameAST: public ExpressionAST @@ -502,6 +511,109 @@ protected: virtual bool match0(AST *, ASTMatcher *); }; +#ifdef ICHECK_BUILD +class CPLUSPLUS_EXPORT QPropertyDeclarationAST: public DeclarationAST +{ + /* + Q_PROPERTY(type name + READ getFunction + [WRITE setFunction] + [RESET resetFunction] + [NOTIFY notifySignal] + [DESIGNABLE bool] + [SCRIPTABLE bool] + [STORED bool] + [USER bool] + [CONSTANT] + [FINAL])*/ +public: + unsigned property_specifier_token; + unsigned lparen_token; + unsigned type_token; + unsigned type_name_token; + unsigned read_token; + unsigned read_function_token; + unsigned write_token; + unsigned write_function_token; + unsigned reset_token; + unsigned reset_function_token; + unsigned notify_token; + unsigned notify_function_token; + unsigned rparen_token; + +public: + virtual QPropertyDeclarationAST *asQPropertyDeclarationAST() { return this; } + + virtual unsigned firstToken() const; + virtual unsigned lastToken() const; + +protected: + virtual void accept0(ASTVisitor *visitor); + virtual bool match0(AST *, ASTMatcher *); +}; + +class CPLUSPLUS_EXPORT QEnumDeclarationAST: public DeclarationAST +{ + /*Q_ENUMS(enum1, enum2)*/ +public: + unsigned enum_specifier_token; + unsigned lparen_token; + unsigned rparen_token; + EnumeratorListAST *enumerator_list; + +public: + virtual QEnumDeclarationAST *asQEnumDeclarationAST() { return this; } + + virtual unsigned firstToken() const; + virtual unsigned lastToken() const; + +protected: + virtual void accept0(ASTVisitor *visitor); + virtual bool match0(AST *, ASTMatcher *); +}; + +class CPLUSPLUS_EXPORT QFlagsDeclarationAST: public DeclarationAST +{ + /*Q_FLAGS(enum1 enum2 flags1 ...)*/ +public: + unsigned flags_specifier_token; + unsigned lparen_token; + unsigned rparen_token; + EnumeratorListAST *enumerator_list; + +public: + virtual QFlagsDeclarationAST *asQFlagsDeclarationAST() { return this; } + + virtual unsigned firstToken() const; + virtual unsigned lastToken() const; + +protected: + virtual void accept0(ASTVisitor *visitor); + virtual bool match0(AST *, ASTMatcher *); +}; + +class CPLUSPLUS_EXPORT QDeclareFlagsDeclarationAST: public DeclarationAST +{ + /*Q_DECLARE_FLAGS(flag enum)*/ +public: + unsigned declareflags_specifier_token; + unsigned lparen_token; + unsigned flag_token; + unsigned enum_token; + unsigned rparen_token; + +public: + virtual QDeclareFlagsDeclarationAST *asQDeclareFlagsDeclarationAST() { return this; } + + virtual unsigned firstToken() const; + virtual unsigned lastToken() const; + +protected: + virtual void accept0(ASTVisitor *visitor); + virtual bool match0(AST *, ASTMatcher *); +}; +#endif + class CPLUSPLUS_EXPORT AsmDefinitionAST: public DeclarationAST { public: diff --git a/src/shared/cplusplus/ASTMatch0.cpp b/src/shared/cplusplus/ASTMatch0.cpp index e16c0788080f0b8e08d6b74d580365545358fb7b..1d329a856afc33691098d8613ea7779f68293ed4 100644 --- a/src/shared/cplusplus/ASTMatch0.cpp +++ b/src/shared/cplusplus/ASTMatch0.cpp @@ -96,6 +96,40 @@ bool AccessDeclarationAST::match0(AST *pattern, ASTMatcher *matcher) return false; } +#ifdef ICHECK_BUILD +bool QPropertyDeclarationAST::match0(AST *pattern, ASTMatcher *matcher) +{ + if (QPropertyDeclarationAST *_other = pattern->asQPropertyDeclarationAST()) + return matcher->match(this, _other); + + return false; +} + +bool QEnumDeclarationAST::match0(AST *pattern, ASTMatcher *matcher) +{ + if (QEnumDeclarationAST *_other = pattern->asQEnumDeclarationAST()) + return matcher->match(this, _other); + + return false; +} + +bool QFlagsDeclarationAST::match0(AST *pattern, ASTMatcher *matcher) +{ + if (QFlagsDeclarationAST *_other = pattern->asQFlagsDeclarationAST()) + return matcher->match(this, _other); + + return false; +} + +bool QDeclareFlagsDeclarationAST::match0(AST *pattern, ASTMatcher *matcher) +{ + if (QDeclareFlagsDeclarationAST *_other = pattern->asQDeclareFlagsDeclarationAST()) + return matcher->match(this, _other); + + return false; +} +#endif + bool AsmDefinitionAST::match0(AST *pattern, ASTMatcher *matcher) { if (AsmDefinitionAST *_other = pattern->asAsmDefinition()) diff --git a/src/shared/cplusplus/ASTMatcher.cpp b/src/shared/cplusplus/ASTMatcher.cpp index 138950c2309307b761cf1c61ddd794db4e678f63..73decce35076d8b76367149b08d94a77e2763a25 100644 --- a/src/shared/cplusplus/ASTMatcher.cpp +++ b/src/shared/cplusplus/ASTMatcher.cpp @@ -195,8 +195,74 @@ bool ASTMatcher::match(AccessDeclarationAST *node, AccessDeclarationAST *pattern pattern->colon_token = node->colon_token; +#ifdef ICHECK_BUILD + pattern->invoke_token = node->invoke_token; +#endif + + return true; +} + +#ifdef ICHECK_BUILD +bool ASTMatcher::match(QPropertyDeclarationAST *node, QPropertyDeclarationAST *pattern) +{ + (void) node; + (void) pattern; + + pattern->property_specifier_token = node->property_specifier_token; + + pattern->type_name_token = node->type_name_token; + + pattern->read_function_token = node->read_function_token; + + pattern->write_function_token = node->write_function_token; + + pattern->notify_function_token = node->notify_function_token; + + return true; +} + +bool ASTMatcher::match(QEnumDeclarationAST *node, QEnumDeclarationAST *pattern) +{ + (void) node; + (void) pattern; + + pattern->enum_specifier_token = node->enum_specifier_token; + + if (! pattern->enumerator_list) + pattern->enumerator_list = node->enumerator_list; + else if (! AST::match(node->enumerator_list, pattern->enumerator_list, this)) + return false; + + return true; +} + +bool ASTMatcher::match(QFlagsDeclarationAST *node, QFlagsDeclarationAST *pattern) +{ + (void) node; + (void) pattern; + + pattern->flags_specifier_token = node->flags_specifier_token; + + if (! pattern->enumerator_list) + pattern->enumerator_list = node->enumerator_list; + else if (! AST::match(node->enumerator_list, pattern->enumerator_list, this)) + return false; + + return true; +} + +bool ASTMatcher::match(QDeclareFlagsDeclarationAST *node, QDeclareFlagsDeclarationAST *pattern) +{ + (void) node; + (void) pattern; + + pattern->declareflags_specifier_token = node->declareflags_specifier_token; + pattern->flag_token = node->flag_token; + pattern->enum_token = node->enum_token; + return true; } +#endif bool ASTMatcher::match(AsmDefinitionAST *node, AsmDefinitionAST *pattern) { diff --git a/src/shared/cplusplus/ASTMatcher.h b/src/shared/cplusplus/ASTMatcher.h index c3490ac69be4f60ff8f1aa1dd102d76991ada103..065ee663599fc9492a80768850ed7dc3b7ac161b 100644 --- a/src/shared/cplusplus/ASTMatcher.h +++ b/src/shared/cplusplus/ASTMatcher.h @@ -40,6 +40,12 @@ public: virtual ~ASTMatcher(); virtual bool match(AccessDeclarationAST *node, AccessDeclarationAST *pattern); +#ifdef ICHECK_BUILD + virtual bool match(QPropertyDeclarationAST *node, QPropertyDeclarationAST *pattern); + virtual bool match(QEnumDeclarationAST *node, QEnumDeclarationAST *pattern); + virtual bool match(QFlagsDeclarationAST *node, QFlagsDeclarationAST *pattern); + virtual bool match(QDeclareFlagsDeclarationAST *node, QDeclareFlagsDeclarationAST *pattern); +#endif virtual bool match(ArrayAccessAST *node, ArrayAccessAST *pattern); virtual bool match(ArrayDeclaratorAST *node, ArrayDeclaratorAST *pattern); virtual bool match(ArrayInitializerAST *node, ArrayInitializerAST *pattern); diff --git a/src/shared/cplusplus/ASTVisit.cpp b/src/shared/cplusplus/ASTVisit.cpp index 070cf7fd8569854c44067d89d3dd71b970a76002..4b08ea6375d2c2195edff530f752c6a5622fd5fe 100644 --- a/src/shared/cplusplus/ASTVisit.cpp +++ b/src/shared/cplusplus/ASTVisit.cpp @@ -99,6 +99,36 @@ void AccessDeclarationAST::accept0(ASTVisitor *visitor) visitor->endVisit(this); } +#ifdef ICHECK_BUILD +void QPropertyDeclarationAST::accept0(ASTVisitor *visitor) +{ + if (visitor->visit(this)) { + } + visitor->endVisit(this); +} + +void QEnumDeclarationAST::accept0(ASTVisitor *visitor) +{ + if (visitor->visit(this)) { + } + visitor->endVisit(this); +} + +void QFlagsDeclarationAST::accept0(ASTVisitor *visitor) +{ + if (visitor->visit(this)) { + } + visitor->endVisit(this); +} + +void QDeclareFlagsDeclarationAST::accept0(ASTVisitor *visitor) +{ + if (visitor->visit(this)) { + } + visitor->endVisit(this); +} +#endif + void AsmDefinitionAST::accept0(ASTVisitor *visitor) { if (visitor->visit(this)) { diff --git a/src/shared/cplusplus/ASTVisitor.h b/src/shared/cplusplus/ASTVisitor.h index d4ebdcc81abfaedae65c15b45b39e9dc3cc71021..701abd80c8fff6c5dcff102804e77e73ecbafe8a 100644 --- a/src/shared/cplusplus/ASTVisitor.h +++ b/src/shared/cplusplus/ASTVisitor.h @@ -103,6 +103,12 @@ public: virtual void postVisit(AST *) {} virtual bool visit(AccessDeclarationAST *) { return true; } +#ifdef ICHECK_BUILD + virtual bool visit(QPropertyDeclarationAST *) { return true; } + virtual bool visit(QEnumDeclarationAST *) { return true; } + virtual bool visit(QFlagsDeclarationAST *) { return true; } + virtual bool visit(QDeclareFlagsDeclarationAST *) { return true; } +#endif virtual bool visit(ArrayAccessAST *) { return true; } virtual bool visit(ArrayDeclaratorAST *) { return true; } virtual bool visit(ArrayInitializerAST *) { return true; } @@ -229,6 +235,12 @@ public: virtual bool visit(ObjCSynchronizedStatementAST *) { return true; } virtual void endVisit(AccessDeclarationAST *) { } +#ifdef ICHECK_BUILD + virtual void endVisit(QPropertyDeclarationAST *) { } + virtual void endVisit(QEnumDeclarationAST *) { } + virtual void endVisit(QFlagsDeclarationAST *) { } + virtual void endVisit(QDeclareFlagsDeclarationAST *) { } +#endif virtual void endVisit(ArrayAccessAST *) { } virtual void endVisit(ArrayDeclaratorAST *) { } virtual void endVisit(ArrayInitializerAST *) { } diff --git a/src/shared/cplusplus/ASTfwd.h b/src/shared/cplusplus/ASTfwd.h index cefdfdc3815c9e719c2f3920c6059a42a54f28d9..e38739c01edd2368482a8340a6cdbdbee81b4051 100644 --- a/src/shared/cplusplus/ASTfwd.h +++ b/src/shared/cplusplus/ASTfwd.h @@ -60,6 +60,12 @@ class ASTVisitor; class ASTMatcher; class AccessDeclarationAST; +#ifdef ICHECK_BUILD + class QPropertyDeclarationAST; + class QEnumDeclarationAST; + class QFlagsDeclarationAST; + class QDeclareFlagsDeclarationAST; +#endif class ArrayAccessAST; class ArrayDeclaratorAST; class ArrayInitializerAST; diff --git a/src/shared/cplusplus/CPlusPlusForwardDeclarations.h b/src/shared/cplusplus/CPlusPlusForwardDeclarations.h index 836257e04f00f46a068f7032b2c0112c7eca5c38..caa90a552349a0e81e48910a30fdc70791dace5b 100644 --- a/src/shared/cplusplus/CPlusPlusForwardDeclarations.h +++ b/src/shared/cplusplus/CPlusPlusForwardDeclarations.h @@ -60,7 +60,11 @@ # elif defined(CPLUSPLUS_BUILD_STATIC_LIB) # define CPLUSPLUS_EXPORT # else -# define CPLUSPLUS_EXPORT Q_DECL_IMPORT +# ifdef ICHECK_BUILD +# define CPLUSPLUS_EXPORT +# else +# define CPLUSPLUS_EXPORT Q_DECL_IMPORT +# endif # endif #else # define CPLUSPLUS_EXPORT diff --git a/src/shared/cplusplus/CheckDeclaration.cpp b/src/shared/cplusplus/CheckDeclaration.cpp index 9758f306a2214dd80ccc135dfd7d7d7589e28ac1..c6f747d3ddb8a2298efaa7f83e6bcc053fe80ce0 100644 --- a/src/shared/cplusplus/CheckDeclaration.cpp +++ b/src/shared/cplusplus/CheckDeclaration.cpp @@ -170,6 +170,9 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast) const bool isQ_SLOT = ast->qt_invokable_token && tokenKind(ast->qt_invokable_token) == T_Q_SLOT; const bool isQ_SIGNAL = ast->qt_invokable_token && tokenKind(ast->qt_invokable_token) == T_Q_SIGNAL; +#ifdef ICHECK_BUILD + const bool isQ_INVOKABLE = (ast->invoke_token > 0); +#endif List<Declaration *> **decl_it = &ast->symbols; for (DeclaratorListAST *it = ast->declarator_list; it; it = it->next) { @@ -196,6 +199,10 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast) fun->setMethodKey(Function::SignalMethod); else if (isQ_SLOT) fun->setMethodKey(Function::SlotMethod); +#ifdef ICHECK_BUILD + else if (isQ_INVOKABLE) + fun->setInvokable(true); +#endif fun->setVisibility(semantic()->currentVisibility()); } else if (semantic()->currentMethodKey() != Function::NormalMethod) { translationUnit()->warning(ast->firstToken(), @@ -259,6 +266,28 @@ bool CheckDeclaration::visit(AccessDeclarationAST *ast) return false; } +#ifdef ICHECK_BUILD +bool CheckDeclaration::visit(QPropertyDeclarationAST *) +{ + return false; +} + +bool CheckDeclaration::visit(QEnumDeclarationAST *) +{ + return false; +} + +bool CheckDeclaration::visit(QFlagsDeclarationAST *) +{ + return false; +} + +bool CheckDeclaration::visit(QDeclareFlagsDeclarationAST *) +{ + return false; +} +#endif + bool CheckDeclaration::visit(AsmDefinitionAST *) { return false; @@ -316,11 +345,18 @@ bool CheckDeclaration::visit(FunctionDefinitionAST *ast) const bool isQ_SLOT = ast->qt_invokable_token && tokenKind(ast->qt_invokable_token) == T_Q_SLOT; const bool isQ_SIGNAL = ast->qt_invokable_token && tokenKind(ast->qt_invokable_token) == T_Q_SIGNAL; +#ifdef ICHECK_BUILD + const bool isQ_INVOKABLE = (ast->invoke_token > 0); +#endif if (isQ_SIGNAL) fun->setMethodKey(Function::SignalMethod); else if (isQ_SLOT) fun->setMethodKey(Function::SlotMethod); +#ifdef ICHECK_BUILD + else if (isQ_INVOKABLE) + fun->setInvokable(true); +#endif checkFunctionArguments(fun); diff --git a/src/shared/cplusplus/CheckDeclaration.h b/src/shared/cplusplus/CheckDeclaration.h index 0e11a5398b44cb8d1cc519f92134306b0a246aae..0090a1d6708f608fd25b432a9af09e59d307995f 100644 --- a/src/shared/cplusplus/CheckDeclaration.h +++ b/src/shared/cplusplus/CheckDeclaration.h @@ -77,6 +77,12 @@ protected: virtual bool visit(SimpleDeclarationAST *ast); virtual bool visit(EmptyDeclarationAST *ast); virtual bool visit(AccessDeclarationAST *ast); +#ifdef ICHECK_BUILD + virtual bool visit(QPropertyDeclarationAST *ast); + virtual bool visit(QEnumDeclarationAST *ast); + virtual bool visit(QFlagsDeclarationAST *ast); + virtual bool visit(QDeclareFlagsDeclarationAST *ast); +#endif virtual bool visit(AsmDefinitionAST *ast); virtual bool visit(ExceptionDeclarationAST *ast); virtual bool visit(FunctionDefinitionAST *ast); diff --git a/src/shared/cplusplus/Keywords.cpp b/src/shared/cplusplus/Keywords.cpp index 6da25125f7b6e0c8657fc8b0b55518c3077fc4b4..51757eb8c86dcecba0cd7db2fce0e64e89f8cdf9 100644 --- a/src/shared/cplusplus/Keywords.cpp +++ b/src/shared/cplusplus/Keywords.cpp @@ -718,6 +718,30 @@ static inline int classify7(const char *s, bool q) { } } } +#ifdef ICHECK_BUILD + else if (s[2] == 'E') { + if (s[3] == 'N') { + if (s[4] == 'U') { + if (s[5] == 'M') { + if (s[6] == 'S') { + return T_Q_ENUMS; + } + } + } + } + } + else if (s[2] == 'F') { + if (s[3] == 'L') { + if (s[4] == 'A') { + if (s[5] == 'G') { + if (s[6] == 'S') { + return T_Q_FLAGS; + } + } + } + } + } +#endif } } return T_IDENTIFIER; @@ -1079,6 +1103,29 @@ static inline int classify10(const char *s, bool) { } } } +#ifdef ICHECK_BUILD + else if (s[0] == 'Q') { + if (s[1] == '_') { + if (s[2] == 'P') { + if (s[3] == 'R') { + if (s[4] == 'O') { + if (s[5] == 'P') { + if (s[6] == 'E') { + if (s[7] == 'R') { + if (s[8] == 'T') { + if (s[9] == 'Y') { + return T_Q_PROPERTY; + } + } + } + } + } + } + } + } + } + } +#endif return T_IDENTIFIER; } @@ -1129,6 +1176,31 @@ static inline int classify11(const char *s, bool) { } } } +#ifdef ICHECK_BUILD + else if (s[0] == 'Q') { + if (s[1] == '_') { + if (s[2] == 'I') { + if (s[3] == 'N') { + if (s[4] == 'V') { + if (s[5] == 'O') { + if (s[6] == 'K') { + if (s[7] == 'A') { + if (s[8] == 'B') { + if (s[9] == 'L') { + if (s[10] == 'E') { + return T_Q_INVOKABLE; + } + } + } + } + } + } + } + } + } + } + } +#endif return T_IDENTIFIER; } @@ -1217,6 +1289,43 @@ static inline int classify13(const char *s, bool) { return T_IDENTIFIER; } +#ifdef ICHECK_BUILD +static inline int classify15(const char *s, bool) { + if (s[0] == 'Q') { + if (s[1] == '_') { + if (s[2] == 'D') { + if (s[3] == 'E') { + if (s[4] == 'C') { + if (s[5] == 'L') { + if (s[6] == 'A') { + if (s[7] == 'R') { + if (s[8] == 'E') { + if (s[9] == '_') { + if (s[10] == 'F') { + if (s[11] == 'L') { + if (s[12] == 'A') { + if (s[13] == 'G') { + if (s[14] == 'S') { + return T_Q_DECLARE_FLAGS; + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + return T_IDENTIFIER; +} +#endif + static inline int classify16(const char *s, bool) { if (s[0] == 'r') { if (s[1] == 'e') { @@ -1268,6 +1377,9 @@ int Lexer::classify(const char *s, int n, bool q) { case 11: return classify11(s, q); case 12: return classify12(s, q); case 13: return classify13(s, q); +#ifdef ICHECK_BUILD + case 15: return classify15(s, q); +#endif case 16: return classify16(s, q); default: return T_IDENTIFIER; } // switch diff --git a/src/shared/cplusplus/Parser.cpp b/src/shared/cplusplus/Parser.cpp index b40c59c4b7db8ed9bff472669b4bccce986a80d2..ae22e72745eaff895eb66fbc51b5e108764f2019 100644 --- a/src/shared/cplusplus/Parser.cpp +++ b/src/shared/cplusplus/Parser.cpp @@ -54,6 +54,9 @@ #include "Literals.h" #include "ObjectiveCTypeQualifiers.h" #include <cstdio> // for putchar +#ifdef ICHECK_BUILD +# include <QString> +#endif #define CPLUSPLUS_NO_DEBUG_RULE @@ -1651,6 +1654,158 @@ bool Parser::parseAccessDeclaration(DeclarationAST *&node) return false; } +#ifdef ICHECK_BUILD +bool Parser::parseQPropertyDeclaration(DeclarationAST *&node) +{ + /* + Q_PROPERTY(type name + READ getFunction + [WRITE setFunction] + [RESET resetFunction] + [NOTIFY notifySignal] + [DESIGNABLE bool] + [SCRIPTABLE bool] + [STORED bool] + [USER bool] + [CONSTANT] + [FINAL])*/ + DEBUG_THIS_RULE(); + if (LA() == T_Q_PROPERTY) { + QPropertyDeclarationAST *ast = new (_pool)QPropertyDeclarationAST; + ast->property_specifier_token = consumeToken(); + if(LA() == T_LPAREN){ + ast->lparen_token = consumeToken(); + QString tokenstr; + tokenstr = tok().spell(); + //read the type and the name of the type + if(tokenstr != "READ" ){ + ast->type_token = consumeToken(); + tokenstr = tok().spell(); + } + if(tokenstr != "READ" ){ + ast->type_name_token = consumeToken(); + tokenstr = tok().spell(); + } + unsigned fctdefinition = 0; + unsigned fctname = 0; + for(int i = 0; i < 18; i++){ + if(cursor() < _translationUnit->tokenCount() - 1){ + if(LA() == T_RPAREN){ + ast->rparen_token = consumeToken(); + break; + } + tokenstr = tok().spell(); + fctdefinition = consumeToken(); + fctname = consumeToken(); + if(tokenstr == "READ"){ + ast->read_token = fctdefinition; + ast->read_function_token = fctname; + } + else if(tokenstr == "WRITE"){ + ast->write_token = fctdefinition; + ast->write_function_token = fctname; + } + else if(tokenstr == "RESET"){ + ast->reset_token = fctdefinition; + ast->reset_function_token = fctname; + } + else if(tokenstr == "NOTIFY"){ + ast->notify_token = fctdefinition; + ast->notify_function_token = fctname; + } + } + } + } + node = ast; + return true; + } + return false; +} + +bool Parser::parseQEnumDeclaration(DeclarationAST *&node) +{ + /*Q_ENUMS(ConnectionState)*/ + DEBUG_THIS_RULE(); + if (LA() == T_Q_ENUMS) { + QEnumDeclarationAST *ast = new (_pool)QEnumDeclarationAST; + ast->enum_specifier_token = consumeToken(); + EnumeratorListAST** enumerator_list_ptr; + enumerator_list_ptr = &ast->enumerator_list; + + if(LA() == T_LPAREN){ + ast->lparen_token = consumeToken(); + while(LA() != T_EOF_SYMBOL && LA() != T_RPAREN){ + *enumerator_list_ptr = new (_pool) EnumeratorListAST; + EnumeratorAST *pdecl = new (_pool) EnumeratorAST; + pdecl->identifier_token = consumeToken(); + (*enumerator_list_ptr)->value = pdecl; + enumerator_list_ptr = &(*enumerator_list_ptr)->next; + if (LA() == T_COMMA) + consumeToken(); + } + if(LA() == T_RPAREN) + ast->rparen_token = consumeToken(); + } + node = ast; + return true; + } + return false; +} + +bool Parser::parseQFlags(DeclarationAST *&node) +{ + /*Q_FLAGS(enum1 enum2 flags1)*/ + DEBUG_THIS_RULE(); + if (LA() == T_Q_FLAGS) { + QFlagsDeclarationAST *ast = new (_pool)QFlagsDeclarationAST; + ast->flags_specifier_token = consumeToken(); + EnumeratorListAST** enumerator_list_ptr; + enumerator_list_ptr = &ast->enumerator_list; + if(LA() == T_LPAREN){ + ast->lparen_token = consumeToken(); + while(LA() != T_EOF_SYMBOL && LA() != T_RPAREN){ + *enumerator_list_ptr = new (_pool) EnumeratorListAST; + EnumeratorAST *pdecl = new (_pool) EnumeratorAST; + pdecl->identifier_token = consumeToken(); + (*enumerator_list_ptr)->value = pdecl; + enumerator_list_ptr = &(*enumerator_list_ptr)->next; + if (LA() == T_COMMA) + consumeToken(); + } + if(LA() == T_RPAREN) + ast->rparen_token = consumeToken(); + } + node = ast; + return true; + } + return false; +} + +bool Parser::parseQDeclareFlags(DeclarationAST *&node) +{ + /*Q_DECLARE_FLAGS(flag enum)*/ + DEBUG_THIS_RULE(); + if (LA() == T_Q_DECLARE_FLAGS) { + QDeclareFlagsDeclarationAST *ast = new (_pool)QDeclareFlagsDeclarationAST; + ast->declareflags_specifier_token = consumeToken(); + if(LA() == T_LPAREN){ + ast->lparen_token = consumeToken(); + if(LA() != T_EOF_SYMBOL) + ast->flag_token = consumeToken(); + if(LA() == T_COMMA && LA() != T_EOF_SYMBOL) + consumeToken(); + if(LA() != T_EOF_SYMBOL) + ast->enum_token = consumeToken(); + if(LA() != T_EOF_SYMBOL && LA() == T_RPAREN) + ast->rparen_token = consumeToken(); + } + node = ast; + return true; + } + return false; +} +#endif + bool Parser::parseMemberSpecification(DeclarationAST *&node) { DEBUG_THIS_RULE(); @@ -1670,6 +1825,20 @@ bool Parser::parseMemberSpecification(DeclarationAST *&node) case T_PRIVATE: return parseAccessDeclaration(node); +#ifdef ICHECK_BUILD + case T_Q_PROPERTY: + return parseQPropertyDeclaration(node); + + case T_Q_ENUMS: + return parseQEnumDeclaration(node); + + case T_Q_FLAGS: + return parseQFlags(node); + + case T_Q_DECLARE_FLAGS: + return parseQDeclareFlags(node); +#endif + default: return parseSimpleDeclaration(node, /*acceptStructDeclarator=*/true); } // switch @@ -2780,6 +2949,11 @@ bool Parser::parseSimpleDeclaration(DeclarationAST *&node, unsigned qt_invokable_token = 0; if (acceptStructDeclarator && (LA() == T_Q_SIGNAL || LA() == T_Q_SLOT)) qt_invokable_token = consumeToken(); +#ifdef ICHECK_BUILD + unsigned invoke_token = 0; + if (LA() == T_Q_INVOKABLE) + invoke_token = consumeToken(); +#endif // parse a simple declaration, a function definition, // or a contructor declaration. @@ -2907,6 +3081,9 @@ bool Parser::parseSimpleDeclaration(DeclarationAST *&node, } SimpleDeclarationAST *ast = new (_pool) SimpleDeclarationAST; ast->qt_invokable_token = qt_invokable_token; +#ifdef ICHECK_BUILD + ast->invoke_token = invoke_token; +#endif ast->decl_specifier_list = decl_specifier_seq; ast->declarator_list = declarator_list; match(T_SEMICOLON, &ast->semicolon_token); @@ -2936,6 +3113,9 @@ bool Parser::parseSimpleDeclaration(DeclarationAST *&node, if (LA() == T_LBRACE || hasCtorInitializer) { FunctionDefinitionAST *ast = new (_pool) FunctionDefinitionAST; ast->qt_invokable_token = qt_invokable_token; +#ifdef ICHECK_BUILD + ast->invoke_token = invoke_token; +#endif ast->decl_specifier_list = decl_specifier_seq; ast->declarator = firstDeclarator; ast->ctor_initializer = ctor_initializer; @@ -2945,6 +3125,9 @@ bool Parser::parseSimpleDeclaration(DeclarationAST *&node, } else if (LA() == T_TRY) { FunctionDefinitionAST *ast = new (_pool) FunctionDefinitionAST; ast->qt_invokable_token = qt_invokable_token; +#ifdef ICHECK_BUILD + ast->invoke_token = invoke_token; +#endif ast->decl_specifier_list = decl_specifier_seq; ast->declarator = firstDeclarator; ast->ctor_initializer = ctor_initializer; diff --git a/src/shared/cplusplus/Parser.h b/src/shared/cplusplus/Parser.h index 9fa6abb166583813881338b7c0a2de7e49e906bc..62e1a6941857ee1d8a45ede8c93faa48e8ad77f3 100644 --- a/src/shared/cplusplus/Parser.h +++ b/src/shared/cplusplus/Parser.h @@ -78,6 +78,12 @@ public: bool parseAbstractDeclarator(DeclaratorAST *&node); bool parseEmptyDeclaration(DeclarationAST *&node); bool parseAccessDeclaration(DeclarationAST *&node); +#ifdef ICHECK_BUILD + bool parseQPropertyDeclaration(DeclarationAST *&node); + bool parseQEnumDeclaration(DeclarationAST *&node); + bool parseQFlags(DeclarationAST *&node); + bool parseQDeclareFlags(DeclarationAST *&node); +#endif bool parseAdditiveExpression(ExpressionAST *&node); bool parseAndExpression(ExpressionAST *&node); bool parseAsmDefinition(DeclarationAST *&node); diff --git a/src/shared/cplusplus/Symbols.cpp b/src/shared/cplusplus/Symbols.cpp index e19e2d123bf9747fd591e908269722288260f29c..8b1a15e79dba43613c6a86ff0b87d0c750d382b8 100644 --- a/src/shared/cplusplus/Symbols.cpp +++ b/src/shared/cplusplus/Symbols.cpp @@ -221,6 +221,10 @@ bool Function::isEqualTo(const Type *other) const return false; else if (isVolatile() != o->isVolatile()) return false; +#ifdef ICHECK_BUILD + else if (isInvokable() != o->isInvokable()) + return false; +#endif const Name *l = identity(); const Name *r = o->identity(); @@ -240,6 +244,35 @@ bool Function::isEqualTo(const Type *other) const return false; } +#ifdef ICHECK_BUILD +bool Function::isEqualTo(const Function* fct, bool ignoreName/* = false*/) const +{ + if(!ignoreName) + return isEqualTo((Type*)fct); + + if (! fct) + return false; + else if (isConst() != fct->isConst()) + return false; + else if (isVolatile() != fct->isVolatile()) + return false; + else if (isInvokable() != fct->isInvokable()) + return false; + + if (_arguments->symbolCount() != fct->_arguments->symbolCount()) + return false; + else if (! _returnType.isEqualTo(fct->_returnType)) + return false; + for (unsigned i = 0; i < _arguments->symbolCount(); ++i) { + Symbol *l = _arguments->symbolAt(i); + Symbol *r = fct->_arguments->symbolAt(i); + if (! l->type().isEqualTo(r->type())) + return false; + } + return true; +} +#endif + void Function::accept0(TypeVisitor *visitor) { visitor->visit(this); } @@ -316,6 +349,16 @@ bool Function::isPureVirtual() const void Function::setPureVirtual(bool isPureVirtual) { f._isPureVirtual = isPureVirtual; } +#ifdef ICHECK_BUILD + +bool Function::isInvokable() const +{ return f._isInvokable == 1; } + +void Function::setInvokable(bool isInvokable) +{ f._isInvokable = isInvokable; } + +#endif + bool Function::isAmbiguous() const { return f._isAmbiguous; } diff --git a/src/shared/cplusplus/Symbols.h b/src/shared/cplusplus/Symbols.h index 4d8d87f360ece192c5cb18cd15430fd128a5c96b..c1a1f37926454c4813481f76b2cf29763b7bea50 100644 --- a/src/shared/cplusplus/Symbols.h +++ b/src/shared/cplusplus/Symbols.h @@ -350,6 +350,14 @@ public: bool isPureVirtual() const; void setPureVirtual(bool isPureVirtual); +#ifdef ICHECK_BUILD + + bool isInvokable() const; + void setInvokable(bool isInvokable); + bool isEqualTo(const Function* fct, bool ignoreName = false) const; + +#endif + // Symbol's interface virtual FullySpecifiedType type() const; @@ -387,6 +395,9 @@ private: unsigned _isVolatile: 1; unsigned _isAmbiguous: 1; unsigned _methodKey: 3; +#ifdef ICHECK_BUILD + unsigned _isInvokable: 1; +#endif }; union { unsigned _flags; diff --git a/src/shared/cplusplus/Token.cpp b/src/shared/cplusplus/Token.cpp index ce661e43b0589acceee16473bba35bd2ad5f4b01..61c22b7cb257499d6ffa3533daa125dfa8189119 100644 --- a/src/shared/cplusplus/Token.cpp +++ b/src/shared/cplusplus/Token.cpp @@ -91,7 +91,11 @@ static const char *token_names[] = { ("@protected"), ("@protocol"), ("@public"), ("@required"), ("@selector"), ("@synchronized"), ("@synthesize"), ("@throw"), ("@try"), - ("SIGNAL"), ("SLOT"), ("Q_SIGNAL"), ("Q_SLOT"), ("signals"), ("slots"), ("Q_FOREACH"), ("Q_D"), ("Q_Q") + ("SIGNAL"), ("SLOT"), ("Q_SIGNAL"), ("Q_SLOT"), ("signals"), ("slots"), + ("Q_FOREACH"), ("Q_D"), ("Q_Q"), +#ifdef ICHECK_BUILD + ("Q_INVOKABLE"), ("Q_PROPERTY"), ("Q_ENUMS"), ("Q_FLAGS"), ("Q_DECLARE_FLAGS") +#endif }; Token::Token() : diff --git a/src/shared/cplusplus/Token.h b/src/shared/cplusplus/Token.h index cd1cf577c6d59bdb92411db93b49464ae0708768..1a24eb52b6c281303aac249c3e10da0b094b678a 100644 --- a/src/shared/cplusplus/Token.h +++ b/src/shared/cplusplus/Token.h @@ -238,9 +238,16 @@ enum Kind { T_Q_FOREACH, T_Q_D, T_Q_Q, - +#ifndef ICHECK_BUILD T_LAST_KEYWORD = T_Q_Q, - +#else + T_Q_INVOKABLE, + T_Q_PROPERTY, + T_Q_ENUMS, + T_Q_FLAGS, + T_Q_DECLARE_FLAGS, + T_LAST_KEYWORD = T_Q_DECLARE_FLAGS, +#endif // aliases T_OR = T_PIPE_PIPE, T_AND = T_AMPER_AMPER, diff --git a/src/shared/qmljs/parser/qmljsgrammar.cpp b/src/shared/qmljs/parser/qmljsgrammar.cpp deleted file mode 100644 index c0209fc391239164e534c917e620d56ce341e310..0000000000000000000000000000000000000000 --- a/src/shared/qmljs/parser/qmljsgrammar.cpp +++ /dev/null @@ -1,985 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Technology Preview License Agreement accompanying -** this package. -** -** 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.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// This file was generated by qlalr - DO NOT EDIT! -#include "qmljsgrammar_p.h" - -QT_BEGIN_NAMESPACE - -const char *const QmlJSGrammar::spell [] = { - "end of file", "&", "&&", "&=", "break", "case", "catch", ":", ";", "continue", - "default", "delete", "/", "/=", "do", ".", "else", "=", "==", "===", - "finally", "for", "function", ">=", ">", ">>", ">>=", ">>>", ">>>=", "identifier", - "if", "in", "instanceof", "{", "[", "<=", "(", "<", "<<", "<<=", - "-", "-=", "--", "new", "!", "!=", "!==", "numeric literal", "|", "|=", - "||", "+", "+=", "++", "?", "}", "]", "%", "%=", "return", - ")", ";", 0, "*", "*=", "string literal", "property", "signal", "readonly", "switch", - "this", "throw", "~", "try", "typeof", "var", "void", "while", "with", "^", - "^=", "null", "true", "false", "const", "debugger", "reserved word", "multiline string literal", "comment", "public", - "import", "as", 0, 0, 0, 0, 0, 0, 0}; - -const short QmlJSGrammar::lhs [] = { - 99, 99, 99, 99, 99, 100, 105, 105, 108, 108, - 110, 109, 109, 109, 109, 109, 109, 109, 109, 112, - 107, 106, 115, 115, 116, 116, 117, 117, 114, 104, - 104, 104, 104, 104, 104, 104, 123, 123, 123, 124, - 124, 125, 125, 104, 104, 104, 104, 104, 104, 104, - 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, - 104, 113, 113, 113, 113, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 118, 130, 130, 130, 130, 129, 129, - 132, 132, 134, 134, 134, 134, 134, 134, 135, 135, - 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, - 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, - 135, 135, 135, 135, 135, 135, 135, 135, 135, 136, - 136, 111, 111, 111, 111, 111, 139, 139, 140, 140, - 140, 140, 138, 138, 141, 141, 142, 142, 143, 143, - 143, 144, 144, 144, 144, 144, 144, 144, 144, 144, - 144, 145, 145, 145, 145, 146, 146, 146, 147, 147, - 147, 147, 148, 148, 148, 148, 148, 148, 148, 149, - 149, 149, 149, 149, 149, 150, 150, 150, 150, 150, - 151, 151, 151, 151, 151, 152, 152, 153, 153, 154, - 154, 155, 155, 156, 156, 157, 157, 158, 158, 159, - 159, 160, 160, 161, 161, 162, 162, 163, 163, 133, - 133, 164, 164, 165, 165, 165, 165, 165, 165, 165, - 165, 165, 165, 165, 165, 102, 102, 166, 166, 167, - 167, 168, 168, 101, 101, 101, 101, 101, 101, 101, - 101, 101, 101, 101, 101, 101, 101, 101, 119, 180, - 180, 179, 179, 127, 127, 181, 181, 182, 182, 184, - 184, 183, 185, 188, 186, 186, 189, 187, 187, 120, - 121, 121, 122, 122, 169, 169, 169, 169, 169, 169, - 169, 170, 170, 170, 170, 171, 171, 171, 171, 172, - 172, 173, 175, 190, 190, 193, 193, 191, 191, 194, - 192, 174, 174, 174, 176, 176, 177, 177, 177, 195, - 196, 178, 178, 126, 137, 200, 200, 197, 197, 198, - 198, 201, 202, 202, 103, 103, 199, 199, 131, 131, - 203}; - -const short QmlJSGrammar::rhs [] = { - 2, 2, 2, 2, 2, 2, 1, 1, 1, 2, - 1, 2, 2, 3, 3, 5, 5, 4, 4, 2, - 0, 1, 1, 2, 1, 3, 2, 3, 2, 1, - 5, 4, 3, 3, 3, 3, 1, 1, 1, 0, - 1, 2, 4, 6, 6, 3, 3, 7, 7, 4, - 4, 5, 5, 6, 6, 7, 7, 7, 7, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 2, 3, 3, 4, 5, - 3, 4, 3, 1, 1, 2, 3, 4, 1, 2, - 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, 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, 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, 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 short QmlJSGrammar::action_default [] = { - 0, 0, 0, 0, 0, 21, 0, 169, 236, 200, - 208, 204, 148, 220, 196, 3, 133, 67, 149, 212, - 216, 137, 166, 147, 152, 132, 186, 173, 0, 74, - 75, 70, 337, 62, 339, 0, 0, 0, 0, 72, - 0, 0, 68, 71, 0, 0, 63, 65, 64, 73, - 66, 0, 69, 0, 0, 162, 0, 0, 149, 168, - 151, 150, 0, 0, 0, 164, 165, 163, 167, 0, - 197, 0, 0, 0, 0, 187, 0, 0, 0, 0, - 0, 0, 177, 0, 0, 0, 171, 172, 170, 175, - 179, 178, 176, 174, 189, 188, 190, 0, 205, 0, - 201, 0, 0, 143, 130, 142, 131, 99, 100, 101, - 126, 102, 127, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 128, 116, 117, 118, - 119, 120, 121, 122, 123, 124, 125, 129, 0, 0, - 141, 237, 144, 0, 145, 0, 146, 140, 0, 233, - 226, 224, 231, 232, 230, 229, 235, 228, 227, 225, - 234, 221, 0, 209, 0, 0, 213, 0, 0, 217, - 0, 0, 143, 135, 0, 134, 0, 139, 153, 0, - 338, 328, 329, 0, 326, 0, 327, 0, 330, 244, - 251, 250, 258, 246, 0, 247, 331, 0, 336, 248, - 249, 254, 252, 333, 332, 335, 255, 0, 266, 0, - 0, 0, 0, 337, 62, 0, 339, 63, 238, 280, - 64, 0, 0, 0, 267, 0, 0, 256, 257, 0, - 245, 253, 281, 282, 325, 334, 0, 296, 297, 298, - 299, 0, 292, 293, 294, 295, 322, 323, 0, 0, - 0, 0, 0, 285, 286, 242, 240, 202, 210, 206, - 222, 198, 243, 0, 149, 214, 218, 191, 180, 0, - 0, 199, 0, 0, 0, 0, 192, 0, 0, 0, - 0, 0, 184, 182, 185, 183, 181, 194, 193, 195, - 0, 207, 0, 203, 0, 241, 149, 0, 223, 238, - 239, 0, 238, 0, 0, 288, 0, 0, 0, 290, - 0, 211, 0, 0, 215, 0, 0, 219, 278, 0, - 270, 279, 273, 0, 277, 0, 238, 271, 0, 238, - 0, 0, 289, 0, 0, 0, 291, 338, 328, 0, - 0, 330, 0, 324, 0, 314, 0, 0, 0, 284, - 0, 283, 0, 340, 0, 98, 260, 263, 0, 99, - 266, 102, 127, 104, 105, 70, 109, 110, 62, 111, - 114, 68, 71, 63, 238, 64, 73, 117, 66, 119, - 69, 121, 122, 267, 124, 125, 129, 0, 91, 0, - 0, 93, 97, 95, 82, 94, 96, 0, 92, 81, - 261, 259, 137, 138, 143, 0, 136, 0, 313, 0, - 300, 301, 0, 312, 0, 0, 0, 303, 308, 306, - 309, 0, 0, 307, 308, 0, 304, 0, 305, 262, - 311, 0, 262, 310, 0, 315, 316, 0, 262, 317, - 318, 0, 0, 319, 0, 0, 0, 320, 321, 155, - 154, 0, 0, 0, 287, 0, 0, 0, 302, 275, - 268, 0, 276, 272, 0, 274, 264, 0, 265, 269, - 85, 0, 0, 89, 76, 0, 78, 87, 0, 79, - 88, 90, 80, 86, 77, 0, 83, 159, 157, 161, - 158, 156, 160, 4, 2, 60, 84, 0, 0, 63, - 65, 64, 30, 5, 0, 61, 0, 39, 38, 37, - 0, 0, 52, 0, 53, 0, 58, 59, 0, 39, - 0, 0, 0, 0, 0, 48, 49, 0, 50, 0, - 51, 0, 54, 55, 0, 0, 0, 0, 0, 56, - 57, 0, 46, 40, 47, 41, 0, 0, 0, 0, - 43, 0, 44, 45, 42, 0, 0, 29, 33, 34, - 35, 36, 137, 262, 0, 0, 99, 266, 102, 127, - 104, 105, 70, 109, 110, 62, 111, 114, 68, 71, - 63, 238, 64, 73, 117, 66, 119, 69, 121, 122, - 267, 124, 125, 129, 137, 0, 25, 0, 0, 31, - 26, 32, 27, 23, 0, 28, 24, 7, 0, 9, - 0, 8, 0, 1, 20, 11, 0, 12, 0, 13, - 0, 18, 19, 0, 14, 15, 0, 16, 17, 10, - 22, 6, 341}; - -const short QmlJSGrammar::goto_default [] = { - 6, 613, 356, 194, 203, 503, 612, 631, 607, 611, - 609, 614, 21, 610, 17, 502, 604, 595, 557, 504, - 189, 193, 195, 199, 520, 546, 545, 198, 230, 25, - 472, 471, 354, 353, 8, 352, 355, 105, 16, 143, - 23, 12, 142, 18, 24, 55, 22, 7, 27, 26, - 267, 14, 261, 9, 257, 11, 259, 10, 258, 19, - 265, 20, 266, 13, 260, 256, 297, 409, 262, 263, - 200, 191, 190, 202, 231, 201, 206, 227, 228, 192, - 358, 357, 229, 461, 460, 319, 320, 463, 322, 462, - 321, 417, 421, 424, 420, 419, 439, 440, 183, 197, - 179, 182, 196, 204, 0}; - -const short QmlJSGrammar::action_index [] = { - 336, 1295, 2402, 2307, 1029, -1, 68, 106, -99, 62, - 24, -9, 266, -99, 315, 69, -99, -99, 582, 92, - 95, 176, 142, -99, -99, -99, 583, 186, 1295, -99, - -99, -99, 341, -99, 2117, 1566, 1295, 1295, 1295, -99, - 932, 1295, -99, -99, 1295, 1295, -99, -99, -99, -99, - -99, 1295, -99, 1295, 1295, -99, 1295, 1295, 105, 217, - -99, -99, 1295, 1295, 1295, -99, -99, -99, 235, 1295, - 431, 1295, 1295, 1295, 1295, 435, 1295, 1295, 1295, 1295, - 1295, 1295, 213, 1295, 1295, 1295, 128, 102, 93, 241, - 240, 219, 218, 237, 482, 450, 492, 1295, 16, 1295, - 182, 2022, 1295, 1295, -99, -99, -99, -99, -99, -99, - -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, - -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, - -99, -99, -99, -99, -99, -99, -99, -99, 114, 1295, - -99, -99, 46, -10, -99, 1295, -99, -99, 1295, -99, - -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, - -99, -99, 1295, 44, 1295, 1295, 76, 66, 1295, -99, - 2022, 1295, 1295, -99, 100, -99, -12, -99, -99, 7, - -99, 314, 29, -26, -99, 296, -99, 3, 2402, -99, - -99, -99, -99, -99, 245, -99, -99, -2, -99, -99, - -99, -99, -99, -99, 2402, -99, -99, 505, -99, 479, - 134, 2307, -35, 291, 84, -30, 2592, 35, 1295, -99, - 34, 4, 1295, -25, -99, 65, 61, -99, -99, 337, - -99, -99, -99, -99, -99, -99, 101, -99, -99, -99, - -99, 141, -99, -99, -99, -99, -99, -99, -51, -11, - 1295, 111, 64, -99, -99, 1475, -99, 82, 38, 14, - -99, 290, 73, 15, 619, 83, 57, 420, 246, 264, - 1295, 299, 1295, 1295, 1295, 1295, 507, 1295, 1295, 1295, - 1295, 1295, 195, 198, 192, 189, 225, 507, 410, 416, - 1295, 1, 1295, 74, 1295, -99, 679, 1295, -99, 1295, - 63, 5, 1295, 52, 2307, -99, 1295, 144, 2307, -99, - 1295, 54, 1295, 1295, 94, 96, 1295, -99, 88, 98, - 86, -99, -99, 1295, -99, 358, 1295, -99, -43, 1295, - -44, 2307, -99, 1295, 107, 2307, -99, -15, 354, -36, - -5, 2402, -28, -99, 2307, -99, 1295, 130, 2307, -4, - 2307, -99, 8, -8, -53, -99, -99, 2307, -52, 433, - 2, 436, 123, 1295, 2307, 0, -31, 425, 13, -3, - 845, 22, 42, -99, 1387, -99, 37, 11, 45, 1295, - 49, 27, 1295, 51, 1295, 26, 23, 1295, -99, 2212, - 48, -99, -99, -99, -99, -99, -99, 1295, -99, -99, - -99, -99, 350, -99, 1295, -29, -99, 2307, -99, 103, - -99, -99, 2307, -99, 1295, 113, 6, -99, 33, -99, - 17, 119, 1295, -99, 25, 28, -99, -23, -99, 2307, - -99, 124, 2307, -99, 173, -99, -99, 121, 2307, 41, - -99, -22, 18, -99, 344, 50, 85, -99, -99, -99, - -99, 1295, 140, 2307, -99, 1295, 129, 2307, -99, 47, - -99, 147, -99, -99, 1295, -99, -99, 274, -99, -99, - -99, 122, 1657, -99, -99, 1839, -99, -99, 1748, -99, - -99, -99, -99, -99, -99, 120, -99, -99, -99, -99, - -99, -99, -99, -99, -99, -99, 160, -62, 657, 153, - -56, -18, -99, -99, 133, -99, 229, -99, -99, -99, - -16, 199, -99, 1295, -99, 180, -99, -99, 261, 72, - 71, 197, 89, 70, 115, -99, -99, 208, -99, 1295, - -99, 193, -99, -99, 202, 40, 60, 1295, 224, -99, - -99, 251, -99, 230, -99, 79, 30, 281, 253, 348, - -99, 125, -99, -99, -99, 1927, 1118, -99, -99, -99, - -99, -99, 335, 2497, 1566, 90, 497, 58, 489, 136, - 1295, 2307, 81, 9, 370, 39, -13, 766, 10, 75, - -99, 1387, -99, 77, 43, 67, 1295, 91, 87, 1295, - 97, 1295, 80, 78, 361, 116, -99, -14, 853, -99, - -99, -99, -99, -99, 1207, -99, -99, -99, 940, -99, - 276, -33, 738, -99, -99, 135, 325, -99, 228, -99, - 99, -99, -99, 285, -99, -99, 131, -99, -99, -99, - -99, -99, -99, - - -105, 6, 90, 3, 224, -105, -105, -105, -105, -105, - -105, -105, -105, -105, -105, -105, -105, -105, -40, -105, - -105, -105, -105, -105, -105, -105, -105, -105, 58, -105, - -105, -105, 1, -105, -105, -24, 13, 80, 87, -105, - 151, 175, -105, -105, 172, 169, -105, -105, -105, -105, - -105, 140, -105, 133, 159, -105, 131, 108, -105, -105, - -105, -105, 153, 143, 147, -105, -105, -105, -105, 136, - -105, 146, 154, 157, 150, -105, 124, 132, 123, 176, - 173, 162, -105, 103, 84, 73, -105, -105, -105, -105, - -105, -105, -105, -105, -105, -105, -105, 104, -105, 96, - -105, 270, 9, 56, -105, -105, -105, -105, -105, -105, - -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, - -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, - -105, -105, -105, -105, -105, -105, -105, -105, -105, 17, - -105, -105, -105, -105, -105, 22, -105, -105, 19, -105, - -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, - -105, -105, 61, -105, 65, 50, -105, -105, 35, -105, - 226, 52, 106, -105, -105, -105, -105, -105, -105, -105, - -105, -10, -105, -105, -105, 46, -105, -105, 57, -105, - -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, - -105, -105, -105, -105, 91, -105, -105, 34, -105, 33, - -105, 31, -105, 66, -105, -105, -105, -105, 179, -105, - -105, -105, 71, 53, -105, -105, -105, -105, -105, -6, - -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, - -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, - 28, -105, -105, -105, -105, 112, -105, -105, -105, -105, - -105, -105, -105, -105, -105, -105, -105, -105, -105, -8, - 187, -105, 218, 240, 237, 228, -105, 110, 109, 86, - 100, 93, -105, -105, -105, -105, -105, -105, -105, -105, - 185, -105, 195, -105, 199, -105, -105, 202, -105, 114, - -105, -105, 141, -105, 30, -105, 26, -105, 25, -105, - 212, -105, 186, 183, -105, -105, 210, -105, -105, -105, - -105, -105, -105, 189, -105, 82, 94, -105, -105, 102, - -105, 76, -105, 78, -105, 74, -105, -105, 75, -105, - -105, 85, -105, -105, 69, -105, 79, -105, 81, -105, - 42, -105, -105, -105, -105, -105, -105, 47, -105, 29, - -105, 63, -105, 164, 37, -105, -105, 36, -105, -105, - 130, -105, -105, -105, 60, -105, -105, -105, -105, 67, - -105, 48, 119, -105, 92, -105, -105, 38, -105, 40, - -105, -105, -105, -105, -105, -105, -105, 45, -105, -105, - -105, -105, -105, -105, 99, -105, -105, 55, -105, -105, - -105, -105, 59, -105, 64, -105, -105, -105, -105, -105, - -29, -105, 62, -105, -30, -105, -105, -105, -105, -16, - -105, -105, -26, -105, -105, -105, -105, -105, -105, -56, - -105, -105, 20, -105, 23, -105, 18, -105, -105, -105, - -105, 39, -105, 44, -105, 49, -105, 43, -105, -105, - -105, -105, -105, -105, 24, -105, -105, 72, -105, -105, - -105, -105, 51, -105, -105, 193, -105, -105, 54, -105, - -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, - -105, -105, -105, -105, -105, -105, -105, -105, -1, -105, - -105, -105, -105, -105, -105, -105, -17, -105, -105, -105, - -105, -105, -105, 32, -105, -105, -105, -105, -105, -105, - -105, -22, -105, -105, -105, -105, -105, -105, -105, -2, - -105, -105, -105, -105, -11, -105, -105, 21, -105, -105, - -105, -105, -105, 12, -105, -105, -105, 14, 10, 8, - -105, -105, -105, -105, -105, 295, 284, -105, -105, -105, - -105, -105, -105, -105, 267, 2, 0, -105, 4, -105, - 168, 15, -105, -105, 7, -105, -105, 182, -105, -105, - -105, 16, -105, -105, -105, -105, 27, -105, 5, 68, - -105, 83, -105, -105, -105, -105, -105, -105, 262, -105, - -105, -105, -105, -105, 370, -105, -105, -105, 11, -105, - -105, -7, 95, -105, -105, -105, -14, -105, -105, -105, - -105, -105, -105, 77, -105, -105, -105, -105, -105, -105, - -105, -105, -105}; - -const short QmlJSGrammar::action_info [] = { - 389, 255, 399, 401, 506, 255, 346, -107, 438, -126, - 534, 541, 350, 511, 444, 387, 331, -115, 329, 556, - -93, 338, 422, 346, 340, 250, 249, 343, 341, -115, - 422, 406, 428, 346, 187, 429, 188, 185, 422, 418, - 414, 412, 407, 181, -96, 255, -93, 414, 177, -97, - 147, 438, -118, 234, 145, 397, -120, 608, -123, 455, - 438, 442, 451, 69, 464, -126, 302, 537, 632, 536, - 99, 139, 97, 168, -118, 270, 299, 139, 162, 414, - 292, 294, -97, 270, -96, 310, 290, 548, -107, 608, - 551, 344, 97, 292, 162, 99, 310, 455, -120, 524, - 527, 451, 290, 316, -123, 323, 325, 312, 139, 521, - 446, 313, 304, 523, 455, 139, 451, 333, 438, 139, - 438, 139, 139, 556, 598, 254, 253, 441, 139, 425, - 475, 432, 139, 56, 0, 0, 0, 139, 139, 0, - 555, 442, 56, 0, 57, 164, 56, 60, 139, 165, - 170, 0, 139, 57, 62, 467, 175, 57, 61, 326, - 622, 621, 240, 239, 411, 410, 556, 335, 56, 171, - 140, 252, 599, 416, 426, 170, 526, 525, 476, 57, - 486, 139, 519, 69, 247, 246, 553, 552, 139, 457, - 348, 170, 628, 627, 171, 247, 246, 247, 246, 63, - 453, 139, 245, 244, 308, 64, 513, 0, 468, 466, - 171, 83, 172, 84, 83, 529, 84, 83, 0, 84, - 83, 0, 84, 83, 85, 84, 507, 85, 509, 62, - 85, 507, 139, 85, 436, 435, 85, 0, 83, 508, - 84, 517, 516, 83, 83, 84, 84, 62, 0, 0, - 83, 85, 84, 139, 533, 532, 85, 85, 507, 507, - 514, 512, 83, 85, 84, 83, 83, 84, 84, 530, - 528, 83, 509, 84, 63, 85, 170, 509, 85, 85, - 64, 101, 507, 508, 85, 540, 539, 543, 508, 625, - 624, 0, 63, 33, 0, 171, 0, 404, 64, 0, - 102, 0, 103, 33, 509, 509, 233, 232, 272, 273, - 33, 0, 544, 542, 33, 508, 508, 272, 273, 623, - 33, 0, 0, 618, 0, 33, 0, 0, 509, 0, - 46, 48, 47, 71, 72, 274, 275, 619, 617, 508, - 46, 48, 47, 33, 274, 275, 0, 46, 48, 47, - 170, 46, 48, 47, 33, 0, 0, 46, 48, 47, - 73, 74, 46, 48, 47, 170, 33, 616, -84, 171, - 33, 172, 0, 33, 0, 0, 170, 33, 0, 0, - 46, 48, 47, 33, 171, 0, 404, 33, 0, 0, - 0, 46, 48, 47, -84, 171, 0, 172, 0, 33, - 0, 0, 0, 46, 48, 47, -337, 46, 48, 47, - 46, 48, 47, 0, 46, 48, 47, 0, 0, 0, - 46, 48, 47, 0, 46, 48, 47, 0, 5, 4, - 3, 1, 2, 277, 278, 0, 46, 48, 47, 277, - 278, 0, 279, 277, 278, 280, 0, 281, 279, 71, - 72, 280, 279, 281, 33, 280, 0, 281, 76, 77, - 0, -337, 33, 0, 0, 33, 78, 79, 0, 0, - 80, 0, 81, 76, 77, 0, 73, 74, 0, 0, - 0, 78, 79, 0, 0, 80, 0, 81, 0, 0, - 0, 46, 48, 47, 238, 237, 0, 243, 242, 46, - 48, 47, 46, 48, 47, 76, 77, 0, 33, 0, - 0, 0, 0, 78, 79, 76, 77, 80, 33, 81, - 0, 0, 0, 78, 79, 0, 33, 80, 0, 81, - 277, 278, 0, 0, 33, 0, 0, 0, 0, 279, - 243, 242, 280, 0, 281, 46, 48, 47, 0, 0, - 243, 242, 0, 0, 0, 46, 48, 47, 238, 237, - 0, 0, 0, 46, 48, 47, 238, 237, 0, 0, - 0, 46, 48, 47, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 150, 0, 0, 0, 151, - 0, 0, 0, 0, 0, 0, 76, 77, 152, 0, - 153, 0, 0, 0, 78, 79, 0, 0, 80, 0, - 81, 154, 149, 155, 60, 0, 0, 0, 0, 0, - 0, 156, 150, 0, 157, 61, 151, 0, 0, 0, - 158, 0, 0, 0, 0, 152, 159, 153, 0, 0, - 306, 0, 0, 0, 0, 0, 0, 0, 154, 0, - 155, 60, 160, 0, 0, 0, 0, 0, 156, 29, - 30, 157, 61, 0, 0, 0, 0, 158, 0, 32, - 0, 0, 149, 159, 0, 0, 33, 0, 0, 0, - 34, 35, 150, 36, 0, 0, 151, 0, 0, 160, - 498, 0, 0, 0, 43, 152, 0, 153, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 154, 0, - 155, 60, 49, 46, 48, 47, 0, 50, 156, 0, - 0, 157, 61, 0, 0, 0, 0, 158, 42, 52, - 31, 0, 0, 159, 39, 0, 0, 0, 0, 0, - 29, 30, 0, 0, 0, 0, 0, 0, 0, 160, - 32, 0, 0, 0, 0, 0, 0, 33, 0, 0, - 0, 34, 35, 0, 36, 0, 0, 0, 29, 30, - 0, 498, 0, 0, 0, 43, 0, 0, 32, 0, - 0, 0, 0, 0, 0, 33, 0, 0, 0, 34, - 35, 0, 36, 49, 46, 48, 47, 0, 50, 40, - 0, 0, 0, 43, 0, 0, 0, 0, 0, 42, - 52, 31, 0, 0, 0, 39, 0, 0, 0, 0, - 0, 49, 46, 48, 47, 0, 50, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 42, 52, 31, - 0, 0, 0, 39, 0, 0, 0, 29, 30, 0, - 0, 0, 0, 0, 0, 29, 30, 32, 0, 0, - 0, 0, 0, 0, 33, 32, 0, 0, 34, 35, - 0, 36, 33, 0, 0, 0, 34, 35, 40, 36, - 0, 0, 43, 0, 0, 0, 498, 0, 0, 0, - 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 49, 46, 48, 47, 0, 50, 0, 0, 49, 46, - 48, 47, 0, 50, 0, 0, 42, 52, 31, 0, - 0, 0, 39, 0, 42, 52, 31, 0, 0, 0, - 39, 0, 0, 0, 29, 30, 0, 0, 0, 0, - 0, 0, 29, 30, 32, 0, 0, 0, 0, 0, - 0, 33, 32, 0, 0, 34, 35, 0, 36, 33, - 0, 0, 0, 34, 35, 40, 36, 0, 0, 43, - 0, 0, 0, 498, 0, 0, 0, 43, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 49, 46, 48, - 47, 0, 50, 0, 0, 49, 46, 48, 47, 0, - 50, 0, 0, 42, 52, 31, 0, 0, 0, 39, - 0, 42, 52, 31, 0, 0, 0, 39, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 497, - 0, 29, 30, 0, 0, 0, 0, 0, 0, 0, - 0, 213, 0, 0, 0, 0, 0, 0, 33, 0, - 0, 0, 34, 35, 0, 36, 0, 0, 0, 0, - 0, 0, 498, 0, 0, 0, 43, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 49, 499, 501, 500, 0, 50, - 0, 0, 0, 0, 224, 0, 0, 0, 0, 0, - 42, 52, 31, 208, 0, 0, 39, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 497, 0, - 29, 30, 0, 0, 0, 0, 0, 0, 0, 0, - 213, 0, 0, 0, 0, 0, 0, 33, 0, 0, - 0, 34, 35, 0, 36, 0, 0, 0, 0, 0, - 0, 498, 0, 0, 0, 43, 0, 0, 0, 0, - 0, 0, 0, 602, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 49, 499, 501, 500, 0, 50, 0, - 0, 0, 0, 224, 0, 0, 0, 0, 0, 42, - 52, 31, 208, 0, 0, 39, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 497, 0, 29, - 30, 0, 0, 0, 0, 0, 0, 0, 0, 213, - 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, - 34, 35, 0, 36, 0, 0, 0, 0, 0, 0, - 498, 0, 0, 0, 43, 0, 0, 0, 0, 0, - 0, 0, 605, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 49, 499, 501, 500, 0, 50, 0, 0, - 0, 0, 224, 0, 0, 0, 0, 0, 42, 52, - 31, 208, 0, 0, 39, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 28, 29, 30, 0, - 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, - 0, 0, 0, 0, 33, 0, 0, 0, 34, 35, - 0, 36, 0, 0, 0, 37, 0, 38, 40, 41, - 0, 0, 43, 0, 0, 0, 44, 0, 45, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 49, 46, 48, 47, 0, 50, 0, 51, 0, 53, - 0, 54, 0, 0, 0, 0, 42, 52, 31, 0, - 0, 0, 39, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, -116, 0, 0, 0, 28, 29, - 30, 0, 0, 0, 0, 0, 0, 0, 0, 32, - 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, - 34, 35, 0, 36, 0, 0, 0, 37, 0, 38, - 40, 41, 0, 0, 43, 0, 0, 0, 44, 0, - 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 49, 46, 48, 47, 0, 50, 0, 51, - 0, 53, 0, 54, 0, 0, 0, 0, 42, 52, - 31, 0, 0, 0, 39, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 28, 29, 30, 0, - 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, - 0, 0, 0, 0, 33, 0, 0, 0, 34, 35, - 0, 36, 0, 0, 0, 37, 0, 38, 40, 41, - 0, 0, 43, 0, 0, 0, 44, 0, 45, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 49, 46, 48, 47, 0, 50, 0, 51, 0, 53, - 269, 54, 0, 0, 0, 0, 42, 52, 31, 0, - 0, 0, 39, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 473, 0, 0, 28, 29, 30, - 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, - 0, 0, 0, 0, 0, 33, 0, 0, 0, 34, - 35, 0, 36, 0, 0, 0, 37, 0, 38, 40, - 41, 0, 0, 43, 0, 0, 0, 44, 0, 45, - 0, 0, 474, 0, 0, 0, 0, 0, 0, 0, - 0, 49, 46, 48, 47, 0, 50, 0, 51, 0, - 53, 0, 54, 0, 0, 0, 0, 42, 52, 31, - 0, 0, 0, 39, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 481, 0, 0, 28, 29, - 30, 0, 0, 0, 0, 0, 0, 0, 0, 32, - 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, - 34, 35, 0, 36, 0, 0, 0, 37, 0, 38, - 40, 41, 0, 0, 43, 0, 0, 0, 44, 0, - 45, 0, 0, 484, 0, 0, 0, 0, 0, 0, - 0, 0, 49, 46, 48, 47, 0, 50, 0, 51, - 0, 53, 0, 54, 0, 0, 0, 0, 42, 52, - 31, 0, 0, 0, 39, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 481, 0, 0, 28, - 29, 30, 0, 0, 0, 0, 0, 0, 0, 0, - 32, 0, 0, 0, 0, 0, 0, 33, 0, 0, - 0, 34, 35, 0, 36, 0, 0, 0, 37, 0, - 38, 40, 41, 0, 0, 43, 0, 0, 0, 44, - 0, 45, 0, 0, 482, 0, 0, 0, 0, 0, - 0, 0, 0, 49, 46, 48, 47, 0, 50, 0, - 51, 0, 53, 0, 54, 0, 0, 0, 0, 42, - 52, 31, 0, 0, 0, 39, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 473, 0, 0, - 28, 29, 30, 0, 0, 0, 0, 0, 0, 0, - 0, 32, 0, 0, 0, 0, 0, 0, 33, 0, - 0, 0, 34, 35, 0, 36, 0, 0, 0, 37, - 0, 38, 40, 41, 0, 0, 43, 0, 0, 0, - 44, 0, 45, 0, 0, 479, 0, 0, 0, 0, - 0, 0, 0, 0, 49, 46, 48, 47, 0, 50, - 0, 51, 0, 53, 0, 54, 0, 0, 0, 0, - 42, 52, 31, 0, 0, 0, 39, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 28, 29, - 30, 0, 0, 0, 0, 0, 0, 0, 0, 32, - 0, 0, 0, 0, 0, 0, 33, 215, 0, 0, - 563, 564, 0, 36, 0, 0, 0, 37, 0, 38, - 40, 41, 0, 0, 43, 0, 0, 0, 44, 0, - 45, 0, 0, 0, 0, 0, 0, 0, 219, 0, - 0, 0, 49, 46, 48, 47, 0, 50, 0, 51, - 0, 53, 0, 54, 0, 0, 0, 0, 42, 52, - 31, 0, 0, 0, 39, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 107, 108, 109, 0, - 0, 111, 113, 114, 0, 0, 115, 0, 116, 0, - 0, 0, 118, 119, 120, 0, 0, 0, 0, 0, - 0, 33, 121, 122, 123, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 124, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 127, 0, 0, 0, 0, 0, 0, 46, 48, - 47, 128, 129, 130, 0, 132, 133, 134, 135, 136, - 137, 0, 0, 125, 131, 117, 110, 112, 126, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 107, 108, 109, 0, 0, 111, 113, 114, 0, - 0, 115, 0, 116, 0, 0, 0, 118, 119, 120, - 0, 0, 0, 0, 0, 0, 391, 121, 122, 123, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 124, 0, 0, 0, 392, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 127, 0, 0, 0, - 0, 0, 396, 393, 395, 0, 128, 129, 130, 0, - 132, 133, 134, 135, 136, 137, 0, 0, 125, 131, - 117, 110, 112, 126, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 107, 108, 109, 0, - 0, 111, 113, 114, 0, 0, 115, 0, 116, 0, - 0, 0, 118, 119, 120, 0, 0, 0, 0, 0, - 0, 391, 121, 122, 123, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 124, 0, 0, 0, 392, - 0, 0, 0, 0, 0, 0, 0, 394, 0, 0, - 0, 127, 0, 0, 0, 0, 0, 396, 393, 395, - 0, 128, 129, 130, 0, 132, 133, 134, 135, 136, - 137, 0, 0, 125, 131, 117, 110, 112, 126, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 207, 0, 0, 0, 0, 209, 0, 28, 29, - 30, 211, 0, 0, 0, 0, 0, 0, 212, 32, - 0, 0, 0, 0, 0, 0, 214, 215, 0, 0, - 216, 35, 0, 36, 0, 0, 0, 37, 0, 38, - 40, 41, 0, 0, 43, 0, 0, 0, 44, 0, - 45, 0, 0, 0, 0, 0, 218, 0, 219, 0, - 0, 0, 49, 217, 220, 47, 221, 50, 222, 51, - 223, 53, 224, 54, 225, 226, 0, 0, 42, 52, - 31, 208, 210, 0, 39, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 207, 0, 0, 0, - 0, 209, 0, 28, 29, 30, 211, 0, 0, 0, - 0, 0, 0, 212, 213, 0, 0, 0, 0, 0, - 0, 214, 215, 0, 0, 216, 35, 0, 36, 0, - 0, 0, 37, 0, 38, 40, 41, 0, 0, 43, - 0, 0, 0, 44, 0, 45, 0, 0, 0, 0, - 0, 218, 0, 219, 0, 0, 0, 49, 217, 220, - 47, 221, 50, 222, 51, 223, 53, 224, 54, 225, - 226, 0, 0, 42, 52, 31, 208, 210, 0, 39, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 566, 108, 109, 0, 0, 568, 113, 570, 29, - 30, 571, 0, 116, 0, 0, 0, 118, 573, 574, - 0, 0, 0, 0, 0, 0, 575, 576, 122, 123, - 216, 35, 0, 36, 0, 0, 0, 37, 0, 38, - 577, 41, 0, 0, 579, 0, 0, 0, 44, 0, - 45, 0, 0, 0, 0, 0, 581, 0, 219, 0, - 0, 0, 583, 580, 582, 47, 584, 585, 586, 51, - 588, 589, 590, 591, 592, 593, 0, 0, 578, 587, - 572, 567, 569, 126, 39, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 359, 108, 109, 0, - 0, 361, 113, 363, 29, 30, 364, 0, 116, 0, - 0, 0, 118, 366, 367, 0, 0, 0, 0, 0, - 0, 368, 369, 122, 123, 216, 35, 0, 36, 0, - 0, 0, 37, 0, 38, 370, 41, 0, 0, 372, - 0, 0, 0, 44, 0, 45, 0, -262, 0, 0, - 0, 374, 0, 219, 0, 0, 0, 376, 373, 375, - 47, 377, 378, 379, 51, 381, 382, 383, 384, 385, - 386, 0, 0, 371, 380, 365, 360, 362, 126, 39, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, - - 620, 531, 522, 629, 184, 494, 318, 510, 459, 15, - 470, 518, 138, 535, 236, 180, 485, 248, 241, 300, - 601, 180, 550, 615, 538, 437, 148, 309, 554, 307, - 434, 251, 305, 248, 549, 515, 547, 445, 447, 248, - 448, 443, 452, 236, 351, 458, 454, 241, 236, 400, - 180, 141, 456, 161, 433, 174, 146, 408, 465, 205, - 186, 413, 427, 300, 430, 431, 423, 415, 437, 169, - 434, 345, 388, 437, 434, 390, 336, 241, 332, 398, - 337, 334, 347, 349, 167, 483, 459, 205, 480, 184, - 144, 626, 205, 205, 493, 235, 318, 300, 0, 0, - 0, 58, 0, 178, 58, 300, 0, 496, 58, 0, - 630, 58, 0, 449, 597, 0, 58, 300, 163, 0, - 88, 0, 0, 58, 166, 487, 58, 58, 450, 58, - 58, 87, 488, 144, 284, 58, 58, 450, 405, 58, - 144, 286, 402, 58, 300, 176, 58, 58, 285, 100, - 86, 58, 58, 58, 68, 264, 469, 283, 282, 98, - 268, 328, 58, 402, 449, 0, 58, 58, 327, 330, - 403, 90, 82, 339, 58, 58, 58, 59, 449, 58, - 89, 301, 300, 58, 342, 492, 58, 70, 66, 58, - 58, 403, 67, 58, 402, 75, 58, 58, 65, 96, - 58, 0, 58, 94, 450, 58, 95, 58, 303, 178, - 93, 58, 58, 178, 491, 58, 58, 490, 58, 58, - 489, 92, 403, 478, 91, 0, 296, 477, 58, 58, - 58, 268, 296, 268, 268, 268, 496, 268, 58, 271, - 104, 291, 296, 268, 0, 296, 314, 268, 315, 293, - 268, 495, 505, 296, 324, 58, 0, 0, 268, 0, - 268, 58, 106, 173, 295, 0, 268, 298, 276, 0, - 311, 58, 0, 0, 496, 317, 268, 600, 289, 594, - 58, 597, 596, 58, 104, 268, 597, 288, 268, 603, - 287, 0, 0, 0, 0, 0, 496, 0, 0, 0, - 0, 470, 0, 0, 0, 0, 106, 562, 0, 0, - 0, 495, 505, 0, 565, 558, 559, 560, 561, 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, 606, 0, 0, 0, 0, - 0, 0, 496, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 495, 505, 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, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0}; - -const short QmlJSGrammar::action_check [] = { - 8, 36, 55, 55, 66, 36, 36, 7, 33, 7, - 66, 29, 16, 29, 36, 7, 60, 7, 61, 33, - 7, 36, 5, 36, 60, 36, 77, 55, 33, 7, - 5, 60, 55, 36, 60, 7, 33, 8, 5, 33, - 36, 7, 7, 36, 7, 36, 7, 36, 60, 7, - 60, 33, 7, 55, 8, 7, 7, 90, 7, 36, - 33, 20, 36, 1, 17, 7, 61, 7, 0, 29, - 79, 8, 48, 7, 7, 1, 61, 8, 2, 36, - 79, 8, 7, 1, 7, 2, 48, 8, 7, 90, - 60, 7, 48, 79, 2, 79, 2, 36, 7, 29, - 29, 36, 48, 7, 7, 17, 8, 50, 8, 37, - 60, 54, 60, 24, 36, 8, 36, 31, 33, 8, - 33, 8, 8, 33, 8, 61, 62, 6, 8, 10, - 8, 7, 8, 40, -1, -1, -1, 8, 8, -1, - 7, 20, 40, -1, 51, 50, 40, 42, 8, 54, - 15, -1, 8, 51, 12, 8, 56, 51, 53, 61, - 61, 62, 61, 62, 61, 62, 33, 60, 40, 34, - 56, 60, 56, 60, 55, 15, 61, 62, 56, 51, - 60, 8, 29, 1, 61, 62, 61, 62, 8, 60, - 60, 15, 61, 62, 34, 61, 62, 61, 62, 57, - 60, 8, 61, 62, 60, 63, 7, -1, 61, 62, - 34, 25, 36, 27, 25, 7, 27, 25, -1, 27, - 25, -1, 27, 25, 38, 27, 29, 38, 75, 12, - 38, 29, 8, 38, 61, 62, 38, -1, 25, 86, - 27, 61, 62, 25, 25, 27, 27, 12, -1, -1, - 25, 38, 27, 8, 61, 62, 38, 38, 29, 29, - 61, 62, 25, 38, 27, 25, 25, 27, 27, 61, - 62, 25, 75, 27, 57, 38, 15, 75, 38, 38, - 63, 15, 29, 86, 38, 61, 62, 36, 86, 61, - 62, -1, 57, 29, -1, 34, -1, 36, 63, -1, - 34, -1, 36, 29, 75, 75, 61, 62, 18, 19, - 29, -1, 61, 62, 29, 86, 86, 18, 19, 91, - 29, -1, -1, 47, -1, 29, -1, -1, 75, -1, - 66, 67, 68, 18, 19, 45, 46, 61, 62, 86, - 66, 67, 68, 29, 45, 46, -1, 66, 67, 68, - 15, 66, 67, 68, 29, -1, -1, 66, 67, 68, - 45, 46, 66, 67, 68, 15, 29, 91, 33, 34, - 29, 36, -1, 29, -1, -1, 15, 29, -1, -1, - 66, 67, 68, 29, 34, -1, 36, 29, -1, -1, - -1, 66, 67, 68, 33, 34, -1, 36, -1, 29, - -1, -1, -1, 66, 67, 68, 36, 66, 67, 68, - 66, 67, 68, -1, 66, 67, 68, -1, -1, -1, - 66, 67, 68, -1, 66, 67, 68, -1, 92, 93, - 94, 95, 96, 23, 24, -1, 66, 67, 68, 23, - 24, -1, 32, 23, 24, 35, -1, 37, 32, 18, - 19, 35, 32, 37, 29, 35, -1, 37, 23, 24, - -1, 36, 29, -1, -1, 29, 31, 32, -1, -1, - 35, -1, 37, 23, 24, -1, 45, 46, -1, -1, - -1, 31, 32, -1, -1, 35, -1, 37, -1, -1, - -1, 66, 67, 68, 61, 62, -1, 61, 62, 66, - 67, 68, 66, 67, 68, 23, 24, -1, 29, -1, - -1, -1, -1, 31, 32, 23, 24, 35, 29, 37, - -1, -1, -1, 31, 32, -1, 29, 35, -1, 37, - 23, 24, -1, -1, 29, -1, -1, -1, -1, 32, - 61, 62, 35, -1, 37, 66, 67, 68, -1, -1, - 61, 62, -1, -1, -1, 66, 67, 68, 61, 62, - -1, -1, -1, 66, 67, 68, 61, 62, -1, -1, - -1, 66, 67, 68, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 3, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 13, -1, -1, -1, 17, - -1, -1, -1, -1, -1, -1, 23, 24, 26, -1, - 28, -1, -1, -1, 31, 32, -1, -1, 35, -1, - 37, 39, 3, 41, 42, -1, -1, -1, -1, -1, - -1, 49, 13, -1, 52, 53, 17, -1, -1, -1, - 58, -1, -1, -1, -1, 26, 64, 28, -1, -1, - 31, -1, -1, -1, -1, -1, -1, -1, 39, -1, - 41, 42, 80, -1, -1, -1, -1, -1, 49, 12, - 13, 52, 53, -1, -1, -1, -1, 58, -1, 22, - -1, -1, 3, 64, -1, -1, 29, -1, -1, -1, - 33, 34, 13, 36, -1, -1, 17, -1, -1, 80, - 43, -1, -1, -1, 47, 26, -1, 28, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, - 41, 42, 65, 66, 67, 68, -1, 70, 49, -1, - -1, 52, 53, -1, -1, -1, -1, 58, 81, 82, - 83, -1, -1, 64, 87, -1, -1, -1, -1, -1, - 12, 13, -1, -1, -1, -1, -1, -1, -1, 80, - 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, - -1, 33, 34, -1, 36, -1, -1, -1, 12, 13, - -1, 43, -1, -1, -1, 47, -1, -1, 22, -1, - -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, - 34, -1, 36, 65, 66, 67, 68, -1, 70, 43, - -1, -1, -1, 47, -1, -1, -1, -1, -1, 81, - 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, - -1, 65, 66, 67, 68, -1, 70, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 81, 82, 83, - -1, -1, -1, 87, -1, -1, -1, 12, 13, -1, - -1, -1, -1, -1, -1, 12, 13, 22, -1, -1, - -1, -1, -1, -1, 29, 22, -1, -1, 33, 34, - -1, 36, 29, -1, -1, -1, 33, 34, 43, 36, - -1, -1, 47, -1, -1, -1, 43, -1, -1, -1, - 47, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 65, 66, 67, 68, -1, 70, -1, -1, 65, 66, - 67, 68, -1, 70, -1, -1, 81, 82, 83, -1, - -1, -1, 87, -1, 81, 82, 83, -1, -1, -1, - 87, -1, -1, -1, 12, 13, -1, -1, -1, -1, - -1, -1, 12, 13, 22, -1, -1, -1, -1, -1, - -1, 29, 22, -1, -1, 33, 34, -1, 36, 29, - -1, -1, -1, 33, 34, 43, 36, -1, -1, 47, - -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, - 68, -1, 70, -1, -1, 65, 66, 67, 68, -1, - 70, -1, -1, 81, 82, 83, -1, -1, -1, 87, - -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, - -1, 12, 13, -1, -1, -1, -1, -1, -1, -1, - -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, - -1, -1, 33, 34, -1, 36, -1, -1, -1, -1, - -1, -1, 43, -1, -1, -1, 47, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, - -1, -1, -1, -1, 75, -1, -1, -1, -1, -1, - 81, 82, 83, 84, -1, -1, 87, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 10, -1, - 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, - 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, - -1, 33, 34, -1, 36, -1, -1, -1, -1, -1, - -1, 43, -1, -1, -1, 47, -1, -1, -1, -1, - -1, -1, -1, 55, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, - -1, -1, -1, 75, -1, -1, -1, -1, -1, 81, - 82, 83, 84, -1, -1, 87, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 10, -1, 12, - 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, - -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, - 33, 34, -1, 36, -1, -1, -1, -1, -1, -1, - 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, - -1, -1, 55, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 65, 66, 67, 68, -1, 70, -1, -1, - -1, -1, 75, -1, -1, -1, -1, -1, 81, 82, - 83, 84, -1, -1, 87, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 11, 12, 13, -1, - -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, - -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, - -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, - -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 65, 66, 67, 68, -1, 70, -1, 72, -1, 74, - -1, 76, -1, -1, -1, -1, 81, 82, 83, -1, - -1, -1, 87, -1, -1, -1, -1, -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, 66, 67, 68, -1, 70, -1, 72, - -1, 74, -1, 76, -1, -1, -1, -1, 81, 82, - 83, -1, -1, -1, 87, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 11, 12, 13, -1, - -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, - -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, - -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, - -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 65, 66, 67, 68, -1, 70, -1, 72, -1, 74, - 75, 76, -1, -1, -1, -1, 81, 82, 83, -1, - -1, -1, 87, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 8, -1, -1, 11, 12, 13, - -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, - -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, - 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, - 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, - -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, - -1, 65, 66, 67, 68, -1, 70, -1, 72, -1, - 74, -1, 76, -1, -1, -1, -1, 81, 82, 83, - -1, -1, -1, 87, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 8, -1, -1, 11, 12, - 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, - -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, - 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, - 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, - 53, -1, -1, 56, -1, -1, -1, -1, -1, -1, - -1, -1, 65, 66, 67, 68, -1, 70, -1, 72, - -1, 74, -1, 76, -1, -1, -1, -1, 81, 82, - 83, -1, -1, -1, 87, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 8, -1, -1, 11, - 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, - 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, - -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, - 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, - -1, 53, -1, -1, 56, -1, -1, -1, -1, -1, - -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, - 72, -1, 74, -1, 76, -1, -1, -1, -1, 81, - 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, - 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, - -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, - -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, - -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, - 51, -1, 53, -1, -1, 56, -1, -1, -1, -1, - -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, - -1, 72, -1, 74, -1, 76, -1, -1, -1, -1, - 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 11, 12, - 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, - -1, -1, -1, -1, -1, -1, 29, 30, -1, -1, - 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, - 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, - 53, -1, -1, -1, -1, -1, -1, -1, 61, -1, - -1, -1, 65, 66, 67, 68, -1, 70, -1, 72, - -1, 74, -1, 76, -1, -1, -1, -1, 81, 82, - 83, -1, -1, -1, 87, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 4, 5, 6, -1, - -1, 9, 10, 11, -1, -1, 14, -1, 16, -1, - -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, - -1, 29, 30, 31, 32, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 43, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 59, -1, -1, -1, -1, -1, -1, 66, 67, - 68, 69, 70, 71, -1, 73, 74, 75, 76, 77, - 78, -1, -1, 81, 82, 83, 84, 85, 86, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 4, 5, 6, -1, -1, 9, 10, 11, -1, - -1, 14, -1, 16, -1, -1, -1, 20, 21, 22, - -1, -1, -1, -1, -1, -1, 29, 30, 31, 32, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 59, -1, -1, -1, - -1, -1, 65, 66, 67, -1, 69, 70, 71, -1, - 73, 74, 75, 76, 77, 78, -1, -1, 81, 82, - 83, 84, 85, 86, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 4, 5, 6, -1, - -1, 9, 10, 11, -1, -1, 14, -1, 16, -1, - -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, - -1, 29, 30, 31, 32, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 43, -1, -1, -1, 47, - -1, -1, -1, -1, -1, -1, -1, 55, -1, -1, - -1, 59, -1, -1, -1, -1, -1, 65, 66, 67, - -1, 69, 70, 71, -1, 73, 74, 75, 76, 77, - 78, -1, -1, 81, 82, 83, 84, 85, 86, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 4, -1, -1, -1, -1, 9, -1, 11, 12, - 13, 14, -1, -1, -1, -1, -1, -1, 21, 22, - -1, -1, -1, -1, -1, -1, 29, 30, -1, -1, - 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, - 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, - 53, -1, -1, -1, -1, -1, 59, -1, 61, -1, - -1, -1, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, -1, -1, 81, 82, - 83, 84, 85, -1, 87, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, - -1, 9, -1, 11, 12, 13, 14, -1, -1, -1, - -1, -1, -1, 21, 22, -1, -1, -1, -1, -1, - -1, 29, 30, -1, -1, 33, 34, -1, 36, -1, - -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, - -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, - -1, 59, -1, 61, -1, -1, -1, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, -1, -1, 81, 82, 83, 84, 85, -1, 87, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 4, 5, 6, -1, -1, 9, 10, 11, 12, - 13, 14, -1, 16, -1, -1, -1, 20, 21, 22, - -1, -1, -1, -1, -1, -1, 29, 30, 31, 32, - 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, - 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, - 53, -1, -1, -1, -1, -1, 59, -1, 61, -1, - -1, -1, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, -1, -1, 81, 82, - 83, 84, 85, 86, 87, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 4, 5, 6, -1, - -1, 9, 10, 11, 12, 13, 14, -1, 16, -1, - -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, - -1, 29, 30, 31, 32, 33, 34, -1, 36, -1, - -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, - -1, -1, -1, 51, -1, 53, -1, 55, -1, -1, - -1, 59, -1, 61, -1, -1, -1, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, -1, -1, 81, 82, 83, 84, 85, 86, 87, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, - - 14, 3, 24, 10, 14, 2, 14, 24, 14, 3, - 34, 12, 3, 24, 14, 14, 3, 2, 14, 3, - 18, 14, 14, 12, 3, 20, 66, 2, 14, 3, - 3, 3, 2, 2, 24, 3, 24, 14, 20, 2, - 20, 97, 3, 14, 2, 2, 2, 14, 14, 2, - 14, 34, 3, 34, 80, 3, 34, 2, 34, 2, - 14, 2, 92, 3, 80, 3, 95, 3, 20, 34, - 3, 2, 34, 20, 3, 35, 2, 14, 2, 34, - 14, 3, 3, 2, 34, 34, 14, 2, 34, 14, - 34, 14, 2, 2, 4, 4, 14, 3, -1, -1, - -1, 43, -1, 45, 43, 3, -1, 12, 43, -1, - 15, 43, -1, 45, 19, -1, 43, 3, 57, -1, - 47, -1, -1, 43, 59, 45, 43, 43, 45, 43, - 43, 47, 45, 34, 48, 43, 43, 45, 39, 43, - 34, 48, 12, 43, 3, 39, 43, 43, 48, 53, - 47, 43, 43, 43, 46, 43, 84, 48, 48, 55, - 48, 67, 43, 12, 45, -1, 43, 43, 86, 67, - 40, 48, 48, 98, 43, 43, 43, 46, 45, 43, - 48, 67, 3, 43, 99, 45, 43, 51, 45, 43, - 43, 40, 45, 43, 12, 49, 43, 43, 45, 49, - 43, -1, 43, 49, 45, 43, 49, 43, 67, 45, - 48, 43, 43, 45, 45, 43, 43, 45, 43, 43, - 45, 48, 40, 30, 48, -1, 43, 34, 43, 43, - 43, 48, 43, 48, 48, 48, 12, 48, 43, 52, - 14, 56, 43, 48, -1, 43, 60, 48, 65, 54, - 48, 27, 28, 43, 65, 43, -1, -1, 48, -1, - 48, 43, 36, 37, 65, -1, 48, 65, 50, -1, - 58, 43, -1, -1, 12, 65, 48, 15, 50, 12, - 43, 19, 15, 43, 14, 48, 19, 50, 48, 5, - 50, -1, -1, -1, -1, -1, 12, -1, -1, -1, - -1, 34, -1, -1, -1, -1, 36, 12, -1, -1, - -1, 27, 28, -1, 19, 20, 21, 22, 23, -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, 5, -1, -1, -1, -1, - -1, -1, 12, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 27, 28, -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, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1}; - -QT_END_NAMESPACE diff --git a/src/shared/qmljs/qmljs.pri b/src/shared/qmljs/qmljs.pri deleted file mode 100644 index c6128ec21ad493a8f0b1a52995badb62c46cf147..0000000000000000000000000000000000000000 --- a/src/shared/qmljs/qmljs.pri +++ /dev/null @@ -1,33 +0,0 @@ -include(parser/parser.pri) - -DEPENDPATH += $$PWD $$PWD/metatype -INCLUDEPATH += $$PWD/.. - -HEADERS += \ - $$PWD/qml_global.h \ - $$PWD/qmlidcollector.h \ - $$PWD/qmldocument.h \ - $$PWD/qmlpackageinfo.h \ - $$PWD/qmlsymbol.h \ - $$PWD/QmlMetaTypeBackend.h \ - $$PWD/qmltypesystem.h - -SOURCES += \ - $$PWD/qmlidcollector.cpp \ - $$PWD/qmldocument.cpp \ - $$PWD/qmlsymbol.cpp \ - $$PWD/qmlpackageinfo.cpp \ - $$PWD/QmlMetaTypeBackend.cpp \ - $$PWD/qmltypesystem.cpp - -contains(QT_CONFIG, declarative) { - QT += declarative - - DEFINES += BUILD_DECLARATIVE_BACKEND - - HEADERS += \ - $$PWD/QtDeclarativeMetaTypeBackend.h - - SOURCES += \ - $$PWD/QtDeclarativeMetaTypeBackend.cpp -} diff --git a/src/shared/qscripthighlighter/qscripthighlighter.pri b/src/shared/qscripthighlighter/qscripthighlighter.pri deleted file mode 100644 index 97f8917113c702dc0127332f3b0f04bbe934fc06..0000000000000000000000000000000000000000 --- a/src/shared/qscripthighlighter/qscripthighlighter.pri +++ /dev/null @@ -1,11 +0,0 @@ -INCLUDEPATH *= $$PWD $$PWD/.. - -DEFINES += QSCRIPTHIGHLIGHTER_BUILD_LIB - -SOURCES += $$PWD/qscriptincrementalscanner.cpp -HEADERS += $$PWD/qscriptincrementalscanner.h - -contains(QT, gui) { - SOURCES += $$PWD/qscripthighlighter.cpp $$PWD/qscriptindenter.cpp - HEADERS += $$PWD/qscripthighlighter.h $$PWD/qscriptindenter.h -} diff --git a/src/tools/ICheck/ICheck.pri b/src/tools/ICheck/ICheck.pri new file mode 100644 index 0000000000000000000000000000000000000000..22772cc4b1c22bf799a519c5ed59399864fe2430 --- /dev/null +++ b/src/tools/ICheck/ICheck.pri @@ -0,0 +1,5 @@ +# ---------------------------------------------------- +# This file is generated by the Qt Visual Studio Add-in. +# ------------------------------------------------------ + +SOURCES += ./main.cpp diff --git a/src/tools/ICheck/ICheck.pro b/src/tools/ICheck/ICheck.pro new file mode 100644 index 0000000000000000000000000000000000000000..75a1f24c02ec342fb5cfd8c726f936f30a30f2cb --- /dev/null +++ b/src/tools/ICheck/ICheck.pro @@ -0,0 +1,6 @@ +TEMPLATE = subdirs +CONFIG += ordered + +SUBDIRS = \ + ICheckLib \ + ICheckApp diff --git a/src/tools/ICheck/ICheckApp/ICheckApp.pro b/src/tools/ICheck/ICheckApp/ICheckApp.pro new file mode 100644 index 0000000000000000000000000000000000000000..c841d43072f399e2013301d3e8665c56191b0742 --- /dev/null +++ b/src/tools/ICheck/ICheckApp/ICheckApp.pro @@ -0,0 +1,23 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2010-01-18T15:27:35 +# +#------------------------------------------------- + +QT -= gui + +TARGET = ICheckApp +CONFIG += console +CONFIG -= app_bundle + +TEMPLATE = app + +INCLUDEPATH += ../ICheckLib +CONFIG(debug, debug|release){ + LIBS += -L../ICheckLib/debug -lICheckLibd +} +else { + LIBS += -L../ICheckLib/release -lICheckLib +} + +SOURCES += main.cpp diff --git a/src/tools/ICheck/ICheckApp/main.cpp b/src/tools/ICheck/ICheckApp/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..94e9a999b5215f8c68678ff064d8422f6696b36e --- /dev/null +++ b/src/tools/ICheck/ICheckApp/main.cpp @@ -0,0 +1,129 @@ +#include "ichecklib.h" +#include <QtCore/QCoreApplication> +#include <QString> +#include <QStringList> +#include <iostream> +#include <QDebug> +#include <QDir> +#include <QFile> +#include <QFileInfo> +#include <QProcess> + +using namespace std; + +QStringList getQTIncludePath() +{ + QStringList ret; + QStringList processevironment = QProcess::systemEnvironment(); + foreach(QString item, processevironment){ + if(item.indexOf("QTDIR=") == 0){ + QString qtpath = item.remove("QTDIR="); + ret << qtpath + "\\include\\QtCore"; + break; + } + } + return ret; +} + +int main(int argc, char *argv[]) +{ + int ret = 0; + if(argc == 3){ + try{ + //Extract the file name and path from the arguments + QString interfaceHeaderFile = argv[1]; + QString checkHeaderFile = argv[2]; + QString curpath = QDir::currentPath(); + //Create FileInfos for the header files + QFile ifile(interfaceHeaderFile); + if (!ifile.exists()){ + QString err = "File does not exist: " + interfaceHeaderFile; + throw err; + } + QFile chfile(checkHeaderFile); + if (!chfile.exists()){ + QString err = "File does not exist: " + checkHeaderFile; + throw err; + } + QFileInfo iFileInfo(ifile); + QFileInfo chFileInfo(chfile); + + //Now create a list of the include path + QString chIncludepath = chFileInfo.absolutePath(); + QStringList chIncludepathlist; + chIncludepathlist << chIncludepath; + chIncludepathlist << getQTIncludePath(); + + QString iIncludepath = iFileInfo.absolutePath(); + QStringList iIncludepathlist; + iIncludepathlist << iIncludepath; + + //Create a list of all the soucre files they need to be parsed. + //In our case it is just the header file + QStringList chFilelist; + chFilelist << chFileInfo.filePath(); + + QStringList iFilelist; + iFilelist << iFileInfo.filePath(); + + ICheckLib i_ichecklib; + i_ichecklib.ParseHeader(iIncludepathlist, iFilelist); + + ICheckLib ichecklib; + ichecklib.ParseHeader(chIncludepathlist, chFilelist); + + if(!ichecklib.check(i_ichecklib)){ + cout << "Folowing interface items are missing:" << endl; + QStringList errorlist = ichecklib.getErrorMsg(); + foreach(QString msg, errorlist){ + cout << (const char *)msg.toLatin1() << endl; + } + ret = -1; + } + else + cout << "Interface is full defined."; + +/* + //Parse the interface header + CPlusPlus::ParseManager* iParseManager = new CPlusPlus::ParseManager(); + iParseManager->setIncludePath(iIncludepathlist); + iParseManager->parse(iFilelist); + + //Parse the header that needs to be compared against the interface header + CPlusPlus::ParseManager* chParseManager = new CPlusPlus::ParseManager(); + chIncludepathlist << getQTIncludePath(); + chParseManager->setIncludePath(chIncludepathlist); + chParseManager->parse(chFilelist); + + if(!chParseManager->checkAllMetadatas(iParseManager)){ + cout << "Folowing interface items are missing:" << endl; + QStringList errorlist = chParseManager->getErrorMsg(); + foreach(QString msg, errorlist){ + cout << (const char *)msg.toLatin1() << endl; + } + ret = -1; + } + else + cout << "Interface is full defined."; + + delete iParseManager; + delete chParseManager; + */ + } + catch (QString msg) + { + cout << endl << "Error:" << endl; + cout << (const char *)msg.toLatin1(); + ret = -2; + } + } + else{ + cout << "CompareHeaderWithHeader.exe"; + cout << " \"Interface header\""; + cout << " \"headerfile to check\""; + } + + qDebug() << endl << endl << "return value: " << ret; + getchar(); + return ret; +} diff --git a/src/tools/ICheck/ICheckLib/ICheckLib.pri b/src/tools/ICheck/ICheckLib/ICheckLib.pri new file mode 100644 index 0000000000000000000000000000000000000000..9eebf58160fb8edc82d03ff7c2777f7727959a1e --- /dev/null +++ b/src/tools/ICheck/ICheckLib/ICheckLib.pri @@ -0,0 +1,110 @@ +# ---------------------------------------------------- +# This file is generated by the Qt Visual Studio Add-in. +# ------------------------------------------------------ +HEADERS += $$REL_PATH_TO_SRC/shared/cplusplus/Array.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/AST.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/ASTMatcher.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/ASTVisitor.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/CheckDeclaration.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/CheckDeclarator.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/CheckExpression.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/CheckName.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/CheckSpecifier.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/CheckStatement.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/Control.h \ + $$REL_PATH_TO_SRC/plugins/coreplugin/core_global.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/CoreTypes.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/CPlusPlusForwardDeclarations.h \ + $$REL_PATH_TO_SRC/libs/cplusplus/CppBindings.h \ + $$REL_PATH_TO_SRC/libs/cplusplus/CppDocument.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/DiagnosticClient.h \ + $$REL_PATH_TO_SRC/libs/cplusplus/FastPreprocessor.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/FullySpecifiedType.h \ + ./ichecklib.h \ + ./ICheckLib_global.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/Lexer.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/Literals.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/LiteralTable.h \ + $$REL_PATH_TO_SRC/libs/cplusplus/Macro.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/MemoryPool.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/Name.h \ + $$REL_PATH_TO_SRC/libs/cplusplus/NamePrettyPrinter.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/Names.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/NameVisitor.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/ObjectiveCTypeQualifiers.h \ + $$REL_PATH_TO_SRC/libs/cplusplus/Overview.h \ + ./ParseManager.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/Parser.h \ + $$REL_PATH_TO_SRC/libs/cplusplus/pp-cctype.h \ + $$REL_PATH_TO_SRC/libs/cplusplus/pp-engine.h \ + $$REL_PATH_TO_SRC/libs/cplusplus/pp-macro-expander.h \ + $$REL_PATH_TO_SRC/libs/cplusplus/pp-scanner.h \ + $$REL_PATH_TO_SRC/libs/cplusplus/pp.h \ + $$REL_PATH_TO_SRC/libs/cplusplus/PreprocessorClient.h \ + $$REL_PATH_TO_SRC/libs/cplusplus/PreprocessorEnvironment.h \ + $$REL_PATH_TO_SRC/libs/utils/qtcassert.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/Scope.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/Semantic.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/SemanticCheck.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/Symbol.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/Symbols.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/SymbolVisitor.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/Token.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/TranslationUnit.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/Type.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/TypeMatcher.h \ + $$REL_PATH_TO_SRC/libs/cplusplus/TypePrettyPrinter.h \ + $$REL_PATH_TO_SRC/shared/cplusplus/TypeVisitor.h +SOURCES += $$REL_PATH_TO_SRC/shared/cplusplus/Array.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/AST.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/ASTMatch0.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/ASTMatcher.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/ASTVisit.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/ASTVisitor.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/CheckDeclaration.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/CheckDeclarator.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/CheckExpression.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/CheckName.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/CheckSpecifier.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/CheckStatement.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/Control.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/CoreTypes.cpp \ + $$REL_PATH_TO_SRC/libs/cplusplus/CppBindings.cpp \ + $$REL_PATH_TO_SRC/libs/cplusplus/CppDocument.cpp \ + $$REL_PATH_TO_SRC/plugins/cpptools/cppmodelmanager.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/DiagnosticClient.cpp \ + $$REL_PATH_TO_SRC/libs/cplusplus/FastPreprocessor.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/FullySpecifiedType.cpp \ + ./ichecklib.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/Keywords.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/Lexer.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/Literals.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/LiteralTable.cpp \ + $$REL_PATH_TO_SRC/libs/cplusplus/Macro.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/MemoryPool.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/Name.cpp \ + $$REL_PATH_TO_SRC/libs/cplusplus/NamePrettyPrinter.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/Names.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/NameVisitor.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/ObjectiveCAtKeywords.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/ObjectiveCTypeQualifiers.cpp \ + $$REL_PATH_TO_SRC/libs/cplusplus/Overview.cpp \ + ./ParseManager.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/Parser.cpp \ + $$REL_PATH_TO_SRC/libs/cplusplus/pp-engine.cpp \ + $$REL_PATH_TO_SRC/libs/cplusplus/pp-macro-expander.cpp \ + $$REL_PATH_TO_SRC/libs/cplusplus/pp-scanner.cpp \ + $$REL_PATH_TO_SRC/libs/cplusplus/PreprocessorClient.cpp \ + $$REL_PATH_TO_SRC/libs/cplusplus/PreprocessorEnvironment.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/Scope.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/Semantic.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/SemanticCheck.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/Symbol.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/Symbols.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/SymbolVisitor.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/Token.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/TranslationUnit.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/Type.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/TypeMatcher.cpp \ + $$REL_PATH_TO_SRC/libs/cplusplus/TypePrettyPrinter.cpp \ + $$REL_PATH_TO_SRC/shared/cplusplus/TypeVisitor.cpp diff --git a/src/tools/ICheck/ICheckLib/ICheckLib.pro b/src/tools/ICheck/ICheckLib/ICheckLib.pro new file mode 100644 index 0000000000000000000000000000000000000000..36f8c33b283507dd89000621a756404c68b4a76d --- /dev/null +++ b/src/tools/ICheck/ICheckLib/ICheckLib.pro @@ -0,0 +1,35 @@ +REL_PATH_TO_SRC = ../../../ + +TEMPLATE = lib + +CONFIG(debug, debug|release){ + TARGET = ICheckLibd + DESTDIR = ./debug + DLLDESTDIR = ../ICheckApp/debug + MOC_DIR += ./debug/GeneratedFiles + OBJECTS_DIR += ./debug + INCLUDEPATH += ./ \ + ./debug/GeneratedFiles \ + $$REL_PATH_TO_SRC/plugins \ + $$REL_PATH_TO_SRC/libs \ + $$REL_PATH_TO_SRC/shared/cplusplus \ + $$REL_PATH_TO_SRC/libs/cplusplus \ + $(QTDIR) +} +else { + TARGET = ICheckLib + DESTDIR = ./release + DLLDESTDIR = ../ICheckApp/release + MOC_DIR += ./release/GeneratedFiles + OBJECTS_DIR += ./release + INCLUDEPATH += ./ \ + ./release/GeneratedFiles \ + $$REL_PATH_TO_SRC/plugins \ + $$REL_PATH_TO_SRC/libs \ + $$REL_PATH_TO_SRC/shared/cplusplus \ + $$REL_PATH_TO_SRC/libs/cplusplus \ + $(QTDIR) +} + +DEFINES += ICHECKLIB_LIBRARY ICHECK_BUILD +include(ICheckLib.pri) diff --git a/src/tools/ICheck/ICheckLib/ParseManager.cpp b/src/tools/ICheck/ICheckLib/ParseManager.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c902eea2b6082feb4fcd951ed63503621d04e2a9 --- /dev/null +++ b/src/tools/ICheck/ICheckLib/ParseManager.cpp @@ -0,0 +1,1362 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** +**************************************************************************/ + +#include "ParseManager.h" +#include "cplusplus\CppDocument.h" +#include "Control.h" +#include "TranslationUnit.h" +#include "AST.h" +#include "Symbols.h" +#include <QDebug> +#include "Name.h" +#include "cpptools\cppmodelmanager.h" + +using namespace CppTools; +using namespace CppTools::Internal; + + +using namespace CPlusPlus; + +//<------------------------------------------------------- Compare function for the internal structures +/********************************** +Compares function with function +with return type, function name +and their arguments and arguments +types. +**********************************/ +bool ParseManager::FUNCTIONITEM::isEqualTo(ParseManager::FUNCTIONITEM *cpfct, bool ignoreName/* = true*/) +{ + if(ignoreName) + return function->isEqualTo(cpfct->function, true); + return function->isEqualTo(cpfct->function); +} + +/***************************************************************** +Compares two property regarding +of their function definition, +type definition, function arguments +and function types. + +Q_PROPERTY( ConnectionState state READ state NOTIFY stateChanged); +******************************************************************/ +bool ParseManager::PROPERTYITEM::isEqualTo(ParseManager::PROPERTYITEM *cpppt) +{ + QString thistype = this->trlUnit->spell(this->ast->type_token); + QString cppttype = cpppt->trlUnit->spell(cpppt->ast->type_token); + + if(thistype != cppttype) + return false; + + QString thistypename = this->trlUnit->spell(this->ast->type_name_token); + QString cppttypename = cpppt->trlUnit->spell(cpppt->ast->type_name_token); + if(thistypename != cppttypename) + return false; + + if(this->readdefined != cpppt->readdefined) + return false; + if(this->writedefined != cpppt->writedefined) + return false; + if(this->resetdefined != cpppt->resetdefined) + return false; + if(this->notifydefined != cpppt->notifydefined) + return false; + //check for read function + if(this->readdefined){ + if(!this->readFct || !cpppt->readFct) + return false; + if(!this->readFct->isEqualTo(cpppt->readFct)) + return false; + } + //check for write function + if(this->writedefined){ + if(!this->writeFct || !cpppt->writeFct) + return false; + if(!this->writeFct->isEqualTo(cpppt->writeFct)) + return false; + } + //check for reset function + if(this->resetdefined){ + if(!this->resetFct || !cpppt->resetFct) + return false; + if(!this->resetFct->isEqualTo(cpppt->resetFct)) + return false; + } + //check for notify function + if(this->notifydefined){ + if(!this->notifyFct || !cpppt->notifyFct) + return false; + if(!this->notifyFct->isEqualTo(cpppt->notifyFct)) + return false; + } + return true; +} + +/***************************************************************** +Compares two enums regarding +of their values created by the getEnumValueStringList function. +*****************************************************************/ +bool ParseManager::QENUMITEM::isEqualTo(QENUMITEM *cpenum) +{ + if(this->values.count() != cpenum->values.count()) + return false; + foreach(QString str, this->values){ + if(!cpenum->values.contains(str)) + return false; + } + return true; +} + +/***************************************************************** +Compares two flags regarding +of their enum definitions and their +values created by the getEnumValueStringList function. +*****************************************************************/ +bool ParseManager::QFLAGITEM::isEqualTo(QFLAGITEM *cpflag) +{ + if(this->enumvalues.count() != cpflag->enumvalues.count()) + return false; + foreach(QString str, this->enumvalues){ + if(!cpflag->enumvalues.contains(str)) + return false; + } + return true; +} + + + +ParseManager::ParseManager() +: pCppPreprocessor(0) +{ + +} + +ParseManager::~ParseManager() +{ + if(pCppPreprocessor) + delete pCppPreprocessor; +} + +/************************************** +Function for setting the include +Paths +**************************************/ +void ParseManager::setIncludePath(const QStringList &includePath) +{ + m_includePaths = includePath; +} + +/************************************** +public Function that starts the parsing +all of the files in the sourceFiles +string list. +**************************************/ +void ParseManager::parse(const QStringList &sourceFiles) +{ + m_errormsgs.clear(); + if(pCppPreprocessor){ + delete pCppPreprocessor; + pCppPreprocessor = 0; + } + + if (! sourceFiles.isEmpty()) { + m_strHeaderFile = sourceFiles[0]; + pCppPreprocessor = new CppTools::Internal::CppPreprocessor(QPointer<CPlusPlus::ParseManager>(this)); + pCppPreprocessor->setIncludePaths(m_includePaths); + pCppPreprocessor->setFrameworkPaths(m_frameworkPaths); + parse(pCppPreprocessor, sourceFiles); + } +} + +/********************************************* +private function that prepare the filelist +to parse and starts the parser. +*********************************************/ +void ParseManager::parse(CppTools::Internal::CppPreprocessor *preproc, + const QStringList &files) +{ + if (files.isEmpty()) + return; + + //check if file is C++ header file + QStringList headers; + foreach (const QString &file, files) { + const QFileInfo fileInfo(file); + QString ext = fileInfo.suffix(); + if (ext.toLower() == "h") + headers.append(file); + } + + foreach (const QString &file, files) { + preproc->snapshot.remove(file); + } + preproc->setTodo(headers); + QString conf = QLatin1String("<configuration>"); + + preproc->run(conf); + for (int i = 0; i < headers.size(); ++i) { + QString fileName = headers.at(i); + preproc->run(fileName); + } +} + +//This function creates a class list for each class and its base classes in +//the header file that needs to be checked. +//e.g. +// Cl1 Cl2 +// __|__ __|__ +// | | | | +// Cl11 Cl12 Cl21 Cl22 +// +//==> list[0] = {Cl1, Cl11, Cl12} +// list[1] = {Cl2, Cl21, Cl22} + +QList<ParseManager::CLASSTREE*> ParseManager::CreateClassLists() +{ + QList<CLASSTREE*>ret; + QList<CLASSLISTITEM*> classlist; + QList<CLASSLISTITEM*> allclasslist; + + //Iteration over all parsed documents + if(getPreProcessor()){ + for (Snapshot::const_iterator it = getPreProcessor()->snapshot.begin() + ; it != getPreProcessor()->snapshot.end(); ++it) + { + Document::Ptr doc = (*it); + if(doc){ + QFileInfo fileinf(doc->fileName()); + QFileInfo fileinf1(m_strHeaderFile); + //Get the Translated unit + Control* ctrl = doc->control(); + TranslationUnit* trlUnit = ctrl->translationUnit(); + AST* pAst = trlUnit->ast(); + TranslationUnitAST *ptrAst = 0; + if(pAst && (ptrAst = pAst->asTranslationUnit())){ + //iteration over all translated declaration in this document + for (DeclarationListAST *pDecllist = ptrAst->declaration_list; pDecllist; pDecllist = pDecllist->next) { + if(pDecllist->value){ + SimpleDeclarationAST *pSimpleDec = pDecllist->value->asSimpleDeclaration(); + if(pSimpleDec){ + //Iteration over class specifier + for (SpecifierListAST *pSimpleDecDecllist = pSimpleDec->decl_specifier_list; pSimpleDecDecllist; pSimpleDecDecllist = pSimpleDecDecllist->next) { + ClassSpecifierAST * pclassspec = pSimpleDecDecllist->value->asClassSpecifier(); + if(pclassspec){ + CLASSLISTITEM* item = new CLASSLISTITEM(); + item->classspec = pclassspec; + item->trlUnit = trlUnit; + allclasslist.push_back(item); + //We found a class that is defined in the header file that needs to be checked + if(fileinf.fileName().toLower() == fileinf1.fileName().toLower()){ + CLASSTREE* cltree = new CLASSTREE(); + cltree->highestlevelclass = item; + cltree->classlist.push_back(item); + //now add all baseclasses from this class + ret.push_back(cltree); + } + } + } + } + } + } + } + } + } + } + //after we search for the classes we need to search for the baseclasses + foreach(CLASSTREE *cltree, ret){ + QList<CLASSLISTITEM*> baseclasslist; + getBaseClasses(cltree->highestlevelclass, baseclasslist, allclasslist); + cltree->classlist.append(baseclasslist); + } + return ret; +} + +/******************************************** +Gets all the baseclass from a class and +add those base classes into the baseclasslist +********************************************/ +void ParseManager::getBaseClasses(const CLASSLISTITEM* pclass, QList<CLASSLISTITEM*> &baseclasslist, const QList<CLASSLISTITEM*> &allclasslist) +{ + //iteration over the base_clause_list of the current class + QList<CLASSLISTITEM*>child; + for(BaseSpecifierListAST *pBaseSpecList = pclass->classspec->base_clause_list; pBaseSpecList; pBaseSpecList = pBaseSpecList->next) + { + BaseSpecifierAST *pBaseSpec = pBaseSpecList->value; + foreach(CLASSLISTITEM* pclspec, allclasslist) + { + if(pclspec->classspec->symbol->name()->isEqualTo(pBaseSpec->symbol->name())) + { + child.push_back(pclspec); + baseclasslist.push_back(pclspec); + break; + } + } + } + //call the function recursive because all the basclasses can have other base classes + foreach(CLASSLISTITEM* pchclass, child){ + getBaseClasses(pchclass, baseclasslist, allclasslist); + } +} + +/************************************************** +This function finds and creates all Elements wich +are significant for MetaDatas. +Those element will be added in the aparameter +lists. +**************************************************/ +void ParseManager::getElements(QList<FUNCTIONITEM*> &functionlist + , QList<PROPERTYITEM*> &propertylist + , QList<QENUMITEM*> &qenumlist + , QList<ENUMITEM*> &enumlist + , QList<QFLAGITEM*> &qflaglist + , QList<QDECLAREFLAGSITEM*> &qdeclareflaglist + , const QList<CLASSLISTITEM*> classitems + , const CLASSLISTITEM* highestlevelclass) +{ + foreach(CLASSLISTITEM* classitem, classitems){ + for (DeclarationListAST *pmemberlist = classitem->classspec->member_specifier_list; pmemberlist; pmemberlist = pmemberlist->next) { + /********** + Functions + **********/ + SimpleDeclarationAST *pdecl = pmemberlist->value->asSimpleDeclaration(); + if(pdecl){ + for(List<Declaration*>* decllist = pdecl->symbols; decllist; decllist = decllist->next) + { + Function* pfct = decllist->value->type()->asFunctionType(); + if(pfct){ + FUNCTIONITEM* item = new FUNCTIONITEM(); + item->init(); + item->trlUnit = classitem->trlUnit; + item->function = pfct; + item->ast = pdecl; + item->classAst = classitem->classspec; + item->highestlevelclass = highestlevelclass; + functionlist.push_back(item); + } + } + /****** + enum + ******/ + for(List<SpecifierAST*>* decllist = pdecl->decl_specifier_list; decllist; decllist = decllist->next) + { + EnumSpecifierAST * penum = decllist->value->asEnumSpecifier(); + if(penum){ + ENUMITEM* item = new ENUMITEM(); + item->init(); + item->ast = penum; + item->highestlevelclass = highestlevelclass; + item->trlUnit = classitem->trlUnit; + enumlist.push_back(item); + } + } + } + else{ + /********** + Q_PROPERTY + **********/ + QPropertyDeclarationAST *ppdecl = pmemberlist->value->asQPropertyDeclarationAST(); + if(ppdecl){ + PROPERTYITEM* item = new PROPERTYITEM(); + item->init(); + item->ast = ppdecl; + item->highestlevelclass = highestlevelclass; + item->trlUnit = classitem->trlUnit; + item->readdefined = (ppdecl->read_token > 0); + item->writedefined = (ppdecl->write_token > 0); + item->resetdefined = (ppdecl->reset_token > 0); + item->notifydefined = (ppdecl->notify_token > 0); + propertylist.push_back(item); + } + else{ + /********** + Q_ENUM + **********/ + QEnumDeclarationAST *pqenum = pmemberlist->value->asQEnumDeclarationAST(); + if(pqenum){ + QENUMITEM* item = new QENUMITEM(); + item->init(); + item->ast = pqenum; + item->highestlevelclass = highestlevelclass; + item->trlUnit = classitem->trlUnit; + qenumlist.push_back(item); + } + else{ + /********** + Q_FLAGS + **********/ + QFlagsDeclarationAST *pqflags = pmemberlist->value->asQFlagsDeclarationAST(); + if(pqflags){ + QFLAGITEM* item = new QFLAGITEM(); + item->init(); + item->ast = pqflags; + item->highestlevelclass = highestlevelclass; + item->trlUnit = classitem->trlUnit; + qflaglist.push_back(item); + } + else { + /**************** + Q_DECLARE_FLAGS + ****************/ + QDeclareFlagsDeclarationAST *pqdeclflags = pmemberlist->value->asQDeclareFlagsDeclarationAST(); + if(pqdeclflags){ + QDECLAREFLAGSITEM* item = new QDECLAREFLAGSITEM(); + item->init(); + item->ast = pqdeclflags; + item->highestlevelclass = highestlevelclass; + item->trlUnit = classitem->trlUnit; + qdeclareflaglist.push_back(item); + } + } + } + } + } + } + } +} + +/********************************************* +Function that starts the comare between the +parser result and their metadata content. +*********************************************/ +bool ParseManager::checkAllMetadatas(ParseManager* pInterfaceParserManager) +{ + bool ret = true; + + /************************************************ + Get all elements from the interface header file + ************************************************/ + QList<CLASSTREE*> ilookuplist = pInterfaceParserManager->CreateClassLists(); + QList<QList<FUNCTIONITEM*> > ifunctionslookuplist; + QList<QList<PROPERTYITEM*> > ipropertieslookuplist; + QList<QList<QENUMITEM*> > iqenumlookuplist; + QList<QList<ENUMITEM*> > ienumlookuplist; + QList<QList<QFLAGITEM*> > iqflaglookuplist; + QList<QList<QDECLAREFLAGSITEM*> > iqdeclareflaglookuplist; + foreach(CLASSTREE* iclasstree, ilookuplist){ + QList<FUNCTIONITEM*>functionlist; + QList<PROPERTYITEM*>propertylist; + QList<QENUMITEM*>qenumlist; + QList<ENUMITEM*>enumlist; + QList<QFLAGITEM*> qflaglist; + QList<QDECLAREFLAGSITEM*> qdeclareflag; + getElements(functionlist + , propertylist + , qenumlist + , enumlist + , qflaglist + , qdeclareflag + , iclasstree->classlist + , iclasstree->highestlevelclass); + if(functionlist.size() > 0) + ifunctionslookuplist.append(functionlist); + if(propertylist.size() > 0) + ipropertieslookuplist.append(propertylist); + if(qenumlist.size() > 0) + iqenumlookuplist.append(qenumlist); + if(enumlist.size() > 0) + ienumlookuplist.append(enumlist); + if(qflaglist.size() > 0) + iqflaglookuplist.append(qflaglist); + if(qdeclareflag.size() > 0) + iqdeclareflaglookuplist.append(qdeclareflag); + } + + /************************************************ + Get all elements from the compare header file + ************************************************/ + QList<CLASSTREE*> lookuplist = CreateClassLists(); + QList<QList<FUNCTIONITEM*> > functionslookuplist; + QList<QList<PROPERTYITEM*> > propertieslookuplist; + QList<QList<QENUMITEM*> > qenumlookuplist; + QList<QList<ENUMITEM*> > enumlookuplist; + QList<QList<QFLAGITEM*> > qflaglookuplist; + QList<QList<QDECLAREFLAGSITEM*> > qdeclareflaglookuplist; + foreach(CLASSTREE* classtree, lookuplist){ + QList<FUNCTIONITEM*>functionlist; + QList<PROPERTYITEM*>propertylist; + QList<QENUMITEM*>qenumlist; + QList<ENUMITEM*>enumlist; + QList<QFLAGITEM*> qflaglist; + QList<QDECLAREFLAGSITEM*> qdeclareflag; + getElements(functionlist + , propertylist + , qenumlist + , enumlist + , qflaglist + , qdeclareflag + , classtree->classlist + , classtree->highestlevelclass); + if(functionlist.size() > 0) + functionslookuplist.append(functionlist); + if(propertylist.size() > 0) + propertieslookuplist.append(propertylist); + if(qenumlist.size() > 0) + qenumlookuplist.append(qenumlist); + if(enumlist.size() > 0) + enumlookuplist.append(enumlist); + if(qflaglist.size() > 0) + qflaglookuplist.append(qflaglist); + if(qdeclareflag.size() > 0) + qdeclareflaglookuplist.append(qdeclareflag); + } + + /****************************** + Check for function + ******************************/ + QList<FUNCTIONITEM*> missingifcts = checkMetadataFunctions(functionslookuplist, ifunctionslookuplist); + if(missingifcts.size() > 0){ + foreach(FUNCTIONITEM* ifct, missingifcts){ + m_errormsgs.push_back(getErrorMessage(ifct)); + } + ret = false; + } + + /****************************** + Check for properies + ******************************/ + QList<PROPERTYITEM*> missingippts = checkMetadataProperties(propertieslookuplist, functionslookuplist, ipropertieslookuplist, ifunctionslookuplist); + if(missingippts.size() > 0){ + foreach(PROPERTYITEM* ippt, missingippts){ + m_errormsgs.push_back(getErrorMessage(ippt)); + } + ret = false; + } + + /****************************** + Check for enums + ******************************/ + QList<QENUMITEM*> missingiqenums = checkMetadataEnums(qenumlookuplist, enumlookuplist, iqenumlookuplist, ienumlookuplist); + if(missingiqenums.size() > 0){ + foreach(QENUMITEM* ienum, missingiqenums){ + m_errormsgs.push_back(getErrorMessage(ienum)); + } + ret = false; + } + + /****************************** + Check for flags + ******************************/ + QList<QFLAGITEM*> missingiqflags = checkMetadataFlags(qflaglookuplist, qdeclareflaglookuplist, enumlookuplist + , iqflaglookuplist, iqdeclareflaglookuplist, ienumlookuplist); + if(missingiqflags.size() > 0){ + foreach(QFLAGITEM* iflags, missingiqflags){ + m_errormsgs.push_back(getErrorMessage(iflags)); + } + ret = false; + } + + //now delet all Classitems + foreach(CLASSTREE* l, ilookuplist){ + l->classlist.clear(); + } + foreach(CLASSTREE* l, lookuplist){ + l->classlist.clear(); + } + //delete all functionitems + foreach(QList<FUNCTIONITEM*>l, ifunctionslookuplist){ + l.clear(); + } + foreach(QList<FUNCTIONITEM*>l, functionslookuplist){ + l.clear(); + } + //delete all properties + foreach(QList<PROPERTYITEM*>l, ipropertieslookuplist){ + l.clear(); + } + foreach(QList<PROPERTYITEM*>l, propertieslookuplist){ + l.clear(); + } + //delete all qenums + foreach(QList<QENUMITEM*>l, iqenumlookuplist){ + l.clear(); + } + foreach(QList<QENUMITEM*>l, iqenumlookuplist){ + l.clear(); + } + //delete all enums + foreach(QList<ENUMITEM*>l, ienumlookuplist){ + l.clear(); + } + foreach(QList<ENUMITEM*>l, enumlookuplist){ + l.clear(); + } + //delete all qflags + foreach(QList<QFLAGITEM*>l, iqflaglookuplist){ + l.clear(); + } + foreach(QList<QFLAGITEM*>l, qflaglookuplist){ + l.clear(); + } + //delete all qdeclareflags + foreach(QList<QDECLAREFLAGSITEM*>l, iqdeclareflaglookuplist){ + l.clear(); + } + foreach(QList<QDECLAREFLAGSITEM*>l, qdeclareflaglookuplist){ + l.clear(); + } + + return ret; +} + +//<------------------------------------------------------- Start of MetaData functions +/*********************************** +Function that checks all functions +which will occur in the MetaData +***********************************/ +QList<ParseManager::FUNCTIONITEM*> ParseManager::checkMetadataFunctions(const QList<QList<FUNCTIONITEM*> > &classfctlist, const QList<QList<FUNCTIONITEM*> > &iclassfctlist) +{ + QList<FUNCTIONITEM*> missingifcts; + //Compare each function from interface with function from header (incl. baseclass functions) + QList<FUNCTIONITEM*> ifcts; + foreach(QList<FUNCTIONITEM*>ifunctionlist, iclassfctlist){ + ifcts.clear(); + //check if one header class contains all function from one interface header class + if(classfctlist.count() > 0){ + foreach(QList<FUNCTIONITEM*>functionlist, classfctlist){ + QList<FUNCTIONITEM*> tmpl = containsAllMetadataFunction(functionlist, ifunctionlist); + if(tmpl.size() == 0) + ifcts.clear(); + else + ifcts.append(tmpl); + } + } + else { + foreach(FUNCTIONITEM *pfct, ifunctionlist) + pfct->classWichIsNotFound << "<all classes>"; + ifcts.append(ifunctionlist); + } + missingifcts.append(ifcts); + } + return missingifcts; +} + +/********************************************* +Helper function to check if a function will +occure in the MetaData. +*********************************************/ +bool ParseManager::isMetaObjFunction(FUNCTIONITEM* fct) +{ + if(fct->function->isInvokable() + || fct->function->isSignal() + || fct->function->isSlot()) + return true; + return false; +} + +/**************************************************** +Check if all function from iclassfctlist are defined +in the classfctlist as well. +It will return all the function they are missing. +****************************************************/ +QList<ParseManager::FUNCTIONITEM*> ParseManager::containsAllMetadataFunction(const QList<FUNCTIONITEM*> &classfctlist, const QList<FUNCTIONITEM*> &iclassfctlist) +{ + QList<FUNCTIONITEM*> ret; + foreach(FUNCTIONITEM* ifct, iclassfctlist){ + if(isMetaObjFunction(ifct)){ + bool found = false; + QStringList missingimplinclasses; + ClassSpecifierAST* clspec = 0; + foreach(FUNCTIONITEM* fct, classfctlist){ + if(clspec != fct->highestlevelclass->classspec){ + clspec = fct->highestlevelclass->classspec; + //get the classname + QString classname = ""; + unsigned int firsttoken = clspec->name->firstToken(); + classname += fct->trlUnit->spell(firsttoken); + if(missingimplinclasses.indexOf(classname) < 0) + missingimplinclasses.push_back(classname); + } + if(fct->isEqualTo(ifct, false)){ + found = true; + missingimplinclasses.clear(); + break; + } + } + if(!found){ + ifct->classWichIsNotFound.append(missingimplinclasses); + ret.push_back(ifct); + } + } + } + return ret; +} + +/************************************ +Function that gives back an error +string for a MetaData function +mismatch. +************************************/ +QString ParseManager::getErrorMessage(FUNCTIONITEM* fct) +{ + QString ret = ""; + QTextStream out(&ret); + QString fctstring = ""; + QString fcttype = ""; + + foreach(QString classname, fct->classWichIsNotFound){ + if(ret.size() > 0) + out << endl; + + fcttype = ""; + fctstring = classname; + fctstring += "::"; + + unsigned int firsttoken = fct->ast->firstToken(); + unsigned int lasttoken = fct->ast->lastToken(); + for(unsigned int i = firsttoken; i < lasttoken; i++){ + fctstring += fct->trlUnit->spell(i); + fctstring += " "; + } + + SimpleDeclarationAST *psdecl = fct->ast->asSimpleDeclaration(); + if(psdecl){ + for(List<Declaration*>* decllist = psdecl->symbols; decllist; decllist = decllist->next) + { + Function* pfct = decllist->value->type()->asFunctionType(); + if(pfct){ + fcttype = "type: "; + //Check for private, protected and public + if(pfct->isPublic()) + fcttype = "public "; + if(pfct->isProtected()) + fcttype = "protected "; + if(pfct->isPrivate()) + fcttype = "private "; + + if(pfct->isVirtual()) + fcttype += "virtual "; + if(pfct->isPureVirtual()) + fcttype += "pure virtual "; + + if(pfct->isSignal()) + fcttype += "Signal "; + if(pfct->isSlot()) + fcttype += "Slot "; + if(pfct->isNormal()) + fcttype += "Normal "; + if(pfct->isInvokable()) + fcttype += "Invokable "; + } + } + } + out << fcttype << fctstring; + } + return ret; +} +//---> + +//<------------------------------------------------------- Start of Q_PROPERTY checks +/*********************************** +Function that checks all Property +which will occur in the MetaData +***********************************/ +QList<ParseManager::PROPERTYITEM*> ParseManager::checkMetadataProperties(const QList<QList<PROPERTYITEM*> > &classproplist + , const QList<QList<FUNCTIONITEM*> > &classfctlist + , const QList<QList<PROPERTYITEM*> > &iclassproplist + , const QList<QList<FUNCTIONITEM*> > &iclassfctlist) +{ + QList<PROPERTYITEM*> missingifcts; + //assign the property functions + foreach(QList<PROPERTYITEM*>proplist, classproplist){ + foreach(PROPERTYITEM* prop, proplist){ + assignPropertyFunctions(prop, classfctlist); + } + } + + foreach(QList<PROPERTYITEM*>proplist, iclassproplist){ + foreach(PROPERTYITEM* prop, proplist){ + assignPropertyFunctions(prop, iclassfctlist); + } + } + + //Compare each qproperty from interface with qproperty from header (incl. baseclass functions) + QList<PROPERTYITEM*> ippts; + foreach(QList<PROPERTYITEM*>ipropertylist, iclassproplist){ + ippts.clear(); + //check if one header class contains all function from one interface header class + if(classproplist.count() > 0){ + foreach(QList<PROPERTYITEM*>propertylist, classproplist){ + QList<PROPERTYITEM*> tmpl = containsAllPropertyFunction(propertylist, ipropertylist); + if(tmpl.size() == 0) + ippts.clear(); + else + ippts.append(tmpl); + } + } + else { + foreach(PROPERTYITEM *pprop, ipropertylist) + pprop->classWichIsNotFound << "<all classes>"; + ippts.append(ipropertylist); + } + missingifcts.append(ippts); + } + return missingifcts; +} + +/************************************** +Function that resolves the dependensies +between Q_PROPERTY +and thier READ, WRITE, NOTIFY and RESET +functions. +***************************************/ +void ParseManager::assignPropertyFunctions(PROPERTYITEM* prop, const QList<QList<FUNCTIONITEM*> > &fctlookuplist) +{ + //get the name of the needed functions + QString type; + QString readfctname; + QString writefctname; + QString resetfctname; + QString notifyfctname; + + int needtofind = 0; + type = prop->trlUnit->spell(prop->ast->type_token); + if(prop->readdefined){ + readfctname = prop->trlUnit->spell(prop->ast->read_function_token); + needtofind++; + } + if(prop->writedefined){ + writefctname = prop->trlUnit->spell(prop->ast->write_function_token); + needtofind++; + } + if(prop->resetdefined){ + resetfctname = prop->trlUnit->spell(prop->ast->reset_function_token); + needtofind++; + } + if(prop->notifydefined){ + notifyfctname = prop->trlUnit->spell(prop->ast->notify_function_token); + needtofind++; + } + //Now iterate over all function to find all functions wich are defined in the Q_PROPERTY macro + if(needtofind > 0){ + prop->foundalldefinedfct = false; + foreach(QList<FUNCTIONITEM*> fctlist, fctlookuplist){ + foreach(FUNCTIONITEM* pfct, fctlist){ + QString fcttype =pfct->trlUnit->spell(pfct->ast->firstToken()); + //check the function type against the property type + QString fctname = pfct->trlUnit->spell(pfct->ast->firstToken() + 1); + if(prop->readdefined && fctname == readfctname){ + if(type != fcttype) + continue; + prop->readFct = pfct; + needtofind--; + } + if(prop->writedefined && fctname == writefctname){ + prop->writeFct = pfct; + needtofind--; + } + if(prop->resetdefined && fctname == resetfctname){ + prop->resetFct = pfct; + needtofind--; + } + if(prop->notifydefined && fctname == notifyfctname){ + prop->notifyFct = pfct; + needtofind--; + } + if(needtofind <= 0){ + //a flag that indicates if a function was missing + prop->foundalldefinedfct = true; + return; + } + } + } + } +} + +/************************************** +Function that checks if all functions +dependencies in Q_PROPERTY have the +same arguments and retunr value. +***************************************/ +QList<ParseManager::PROPERTYITEM*> ParseManager::containsAllPropertyFunction(const QList<PROPERTYITEM*> &classproplist, const QList<PROPERTYITEM*> &iclassproplist) +{ + QList<PROPERTYITEM*> ret; + foreach(PROPERTYITEM* ipropt, iclassproplist){ + if(ipropt->foundalldefinedfct){ + bool found = false; + QStringList missingimplinclasses; + ClassSpecifierAST* clspec = 0; + foreach(PROPERTYITEM* propt, classproplist){ + if(clspec != propt->highestlevelclass->classspec){ + clspec = propt->highestlevelclass->classspec; + //get the classname + QString classname = ""; + unsigned int firsttoken = clspec->name->firstToken(); + classname += propt->trlUnit->spell(firsttoken); + if(missingimplinclasses.indexOf(classname) < 0) + missingimplinclasses.push_back(classname); + } + if(propt->isEqualTo(ipropt)){ + found = true; + missingimplinclasses.clear(); + break; + } + } + if(!found){ + ipropt->classWichIsNotFound.append(missingimplinclasses); + ret.push_back(ipropt); + } + } + else{ + ret.push_back(ipropt); + } + } + return ret; +} + +/************************************ +Function that gives back an error +string for a Q_PROPERTY mismatch. +************************************/ +QString ParseManager::getErrorMessage(PROPERTYITEM* ppt) +{ + QString ret = ""; + QTextStream out(&ret); + QString pptstring = ""; + QString ppttype = ""; + + if(!ppt->foundalldefinedfct) + { + unsigned int firsttoken = ppt->highestlevelclass->classspec->name->firstToken(); + unsigned int lasttoken = ppt->highestlevelclass->classspec->name->lastToken(); + for(unsigned int i = firsttoken; i < lasttoken; i++){ + out << ppt->trlUnit->spell(i); + } + out << "::"; + firsttoken = ppt->ast->firstToken(); + lasttoken = ppt->ast->lastToken(); + for(unsigned int i = firsttoken; i <= lasttoken; i++){ + out << ppt->trlUnit->spell(i) << " "; + } + out << endl << " -"; + if(ppt->readdefined && !ppt->readFct) + out << "READ "; + if(ppt->writedefined && !ppt->writeFct) + out << "WRITE "; + if(ppt->resetdefined && !ppt->resetFct) + out << "RESET."; + if(ppt->notifydefined && !ppt->notifyFct) + out << "NOTIFY "; + out << "functions missing." << endl; + } + for(int i = 0; i < ppt->classWichIsNotFound.size(); i++){ + if(ret.size() > 0) + out << endl; + + pptstring = ppt->classWichIsNotFound[i]; + pptstring += "::"; + + unsigned int firsttoken = ppt->ast->firstToken(); + unsigned int lasttoken = ppt->ast->lastToken(); + for(unsigned int i = firsttoken; i <= lasttoken; i++){ + pptstring += ppt->trlUnit->spell(i); + pptstring += " "; + } + + out << ppttype << pptstring; + } + return ret; +} +//---> + + +//<------------------------------------------------------- Start of Q_ENUMS checks +/*********************************** +Function that checks all enums +which will occur in the MetaData +***********************************/ +QList<ParseManager::QENUMITEM*> ParseManager::checkMetadataEnums(const QList<QList<QENUMITEM*> > &classqenumlist + , const QList<QList<ENUMITEM*> > &classenumlist + , const QList<QList<QENUMITEM*> > &iclassqenumlist + , const QList<QList<ENUMITEM*> > &iclassenumlist) +{ + QList<QENUMITEM*> missingiqenums; + //assign the property functions + foreach(QList<QENUMITEM*>qenumlist, classqenumlist){ + foreach(QENUMITEM* qenum, qenumlist){ + assignEnumValues(qenum, classenumlist); + } + } + foreach(QList<QENUMITEM*>qenumlist, iclassqenumlist){ + foreach(QENUMITEM* qenum, qenumlist){ + assignEnumValues(qenum, iclassenumlist); + } + } + + //Compare each qenum from interface with qenum from header (incl. baseclass functions) + QList<QENUMITEM*> iqenums; + foreach(QList<QENUMITEM*>iqenumlist, iclassqenumlist){ + iqenums.clear(); + //check if one header class contains all function from one interface header class + if(classqenumlist.count() > 0){ + foreach(QList<QENUMITEM*>qenumlist, classqenumlist){ + QList<QENUMITEM*> tmpl = containsAllEnums(qenumlist, iqenumlist); + if(tmpl.size() == 0) + iqenums.clear(); + else + iqenums.append(tmpl); + + } + } + else { + foreach(QENUMITEM *qenum, iqenumlist) + qenum->classWichIsNotFound << "<all classes>"; + iqenums.append(iqenumlist); + } + missingiqenums.append(iqenums); + } + + return missingiqenums; +} + +/********************************************* +Helper function which creates a string out of +an enumerator including its values. +*********************************************/ +QStringList ParseManager::getEnumValueStringList(ENUMITEM *penum, QString mappedenumname/* = ""*/) +{ + QStringList ret; + EnumSpecifierAST *penumsec = penum->ast; + QString enumname = penum->trlUnit->spell(penumsec->name->firstToken()); + int enumvalue = 0; + //now iterrate over all enumitems and create a string like following: + //EnumName.EnumItemName.Value + //ConnectionState.disconnected.0 + for (EnumeratorListAST *plist = penum->ast->enumerator_list; plist; plist = plist->next) { + QString value = enumname; + if(mappedenumname.size() > 0) + value = mappedenumname; + value += "."; + value += penum->trlUnit->spell(plist->value->identifier_token); + value += "."; + if(plist->value->equal_token > 0 && plist->value->expression){ + QString v = penum->trlUnit->spell(plist->value->expression->firstToken()); + bool ch; + int newval = enumvalue; + if(v.indexOf("0x") >= 0) + newval = v.toInt(&ch, 16); + else + newval = v.toInt(&ch, 10); + if(ch) + enumvalue = newval; + } + value += QString::number(enumvalue); + enumvalue++; + // now add this enumitem string in the VALUE list + ret << value; + } + return ret; +} + +/************************************** +Function that resolves the dependensies +between Q_ENUMS and enums. +***************************************/ +void ParseManager::assignEnumValues(QENUMITEM* qenum, const QList<QList<ENUMITEM*> > &enumlookuplist) +{ + QString enumname; + for (EnumeratorListAST *plist = qenum->ast->enumerator_list; plist; plist = plist->next) { + EnumeratorAST *penum = plist->value->asEnumerator(); + if(penum){ + //get the name of the enum definition + enumname = qenum->trlUnit->spell(penum->firstToken()); + //iterate over all enums and find the one with the same name like enumname + bool found = false; + foreach (QList<ENUMITEM*> penumlist, enumlookuplist) { + foreach(ENUMITEM *penum, penumlist){ + EnumSpecifierAST *penumsec = penum->ast; + QString enumname1 = penum->trlUnit->spell(penumsec->name->firstToken()); + if(enumname == enumname1){ + qenum->values << getEnumValueStringList(penum); + found = true; + break; + } + } + if(!found) + qenum->foundallenums = false; + } + } + } +} + +/*********************************** +Function that checkt if the Q_ENUMS +are completed defined and if the +Enum values are the same. +***********************************/ +QList<ParseManager::QENUMITEM*> ParseManager::containsAllEnums(const QList<QENUMITEM*> &classqenumlist, const QList<QENUMITEM*> &iclassqenumlist) +{ + QList<QENUMITEM*> ret; + foreach(QENUMITEM* iqenum, iclassqenumlist){ + bool found = false; + QStringList missingimplinclasses; + ClassSpecifierAST* clspec = 0; + foreach(QENUMITEM* qenum, classqenumlist){ + if(clspec != qenum->highestlevelclass->classspec){ + clspec = qenum->highestlevelclass->classspec; + //get the classname + QString classname = ""; + unsigned int firsttoken = clspec->name->firstToken(); + classname += qenum->trlUnit->spell(firsttoken); + if(missingimplinclasses.indexOf(classname) < 0) + missingimplinclasses.push_back(classname); + } + if(qenum->isEqualTo(iqenum)){ + found = true; + missingimplinclasses.clear(); + break; + } + } + if(!found){ + iqenum->classWichIsNotFound.append(missingimplinclasses); + ret.push_back(iqenum); + } + } + return ret; +} + +/************************************ +Function that gives back an error +string for a Q_ENUMS mismatch. +************************************/ +QString ParseManager::getErrorMessage(QENUMITEM* qenum) +{ + QString ret = ""; + QTextStream out(&ret); + + if(!qenum->foundallenums) + { + unsigned int firsttoken = qenum->highestlevelclass->classspec->name->firstToken(); + unsigned int lasttoken = qenum->highestlevelclass->classspec->name->lastToken(); + for(unsigned int i = firsttoken; i < lasttoken; i++){ + out << qenum->trlUnit->spell(i); + } + out << "::"; + firsttoken = qenum->ast->firstToken(); + lasttoken = qenum->ast->lastToken(); + for(unsigned int i = firsttoken; i <= lasttoken; i++){ + out << qenum->trlUnit->spell(i) << " "; + } + out << endl << " - one or more Enums missing." << endl; + } + + for(int i = 0; i < qenum->classWichIsNotFound.size(); i++){ + if(ret.size() > 0) + out << endl; + + out << qenum->classWichIsNotFound[i] << "::"; + + unsigned int firsttoken = qenum->ast->firstToken(); + unsigned int lasttoken = qenum->ast->lastToken(); + for(unsigned int i = firsttoken; i <= lasttoken; i++){ + out << qenum->trlUnit->spell(i) << " "; + } + } + return ret; +} +//---> + +//<------------------------------------------------------- Start of Q_FLAGS checks +/*********************************** +Function that checks all flags +which will occur in the MetaData +***********************************/ +QList<ParseManager::QFLAGITEM*> ParseManager::checkMetadataFlags(const QList<QList<QFLAGITEM*> > &classqflaglist + , const QList<QList<QDECLAREFLAGSITEM*> > &classqdeclareflaglist + , const QList<QList<ENUMITEM*> > &classenumlist + , const QList<QList<QFLAGITEM*> > &iclassqflaglist + , const QList<QList<QDECLAREFLAGSITEM*> > &iclassqdeclareflaglist + , const QList<QList<ENUMITEM*> > &iclassenumlist) +{ + QList<QFLAGITEM*> missingqflags; + //assign the enums to the flags + foreach(QList<QFLAGITEM*>qflaglist, classqflaglist){ + foreach(QFLAGITEM* qflag, qflaglist){ + assignFlagValues(qflag, classqdeclareflaglist, classenumlist); + } + } + foreach(QList<QFLAGITEM*>qflaglist, iclassqflaglist){ + foreach(QFLAGITEM* qflag, qflaglist){ + assignFlagValues(qflag, iclassqdeclareflaglist, iclassenumlist); + } + } + + //Compare each qenum from interface with qenum from header (incl. baseclass functions) + QList<QFLAGITEM*> iqflags; + foreach(QList<QFLAGITEM*>iqflaglist, iclassqflaglist){ + iqflags.clear(); + //check if one header class contains all function from one interface header class + if(classqflaglist.count() >0){ + foreach(QList<QFLAGITEM*>qflaglist, classqflaglist){ + QList<QFLAGITEM*> tmpl = containsAllFlags(qflaglist, iqflaglist); + if(tmpl.size() == 0) + iqflags.clear(); + else + iqflags.append(tmpl); + + } + } + else { + foreach(QFLAGITEM *pflag, iqflaglist) + pflag->classWichIsNotFound << "<all classes>"; + iqflags.append(iqflaglist); + } + missingqflags.append(iqflags); + } + return missingqflags; +} + +/************************************** +Function that resolves the dependensies +between Q_FLAG, Q_DECLARE_FLAGS +and enums. +***************************************/ +void ParseManager::assignFlagValues(QFLAGITEM* qflags, const QList<QList<QDECLAREFLAGSITEM*> > &qdeclareflagslookuplist, const QList<QList<ENUMITEM*> > &enumlookuplist) +{ + QString qflagname; + QString enumname; + //read the flag names + for (EnumeratorListAST *plist = qflags->ast->enumerator_list; plist; plist = plist->next) { + EnumeratorAST *pflags = plist->value->asEnumerator(); + if(pflags){ + qflagname = qflags->trlUnit->spell(pflags->firstToken()); + enumname = qflagname; + //try to find if there is a deflare flag macro with the same name as in qflagname + bool found = false; + foreach(QList<QDECLAREFLAGSITEM*> qdeclarelist, qdeclareflagslookuplist){ + foreach(QDECLAREFLAGSITEM* qdeclare, qdeclarelist){ + QString declarename = qdeclare->trlUnit->spell(qdeclare->ast->flag_token); + if(declarename == qflagname){ + //now map the right enum name to the flag + enumname = qdeclare->trlUnit->spell(qdeclare->ast->enum_token); + found = true; + break; + } + } + if(found) + break; + } + //now we have the right enum name now we need to find the enum + found = false; + foreach(QList<ENUMITEM*> enumitemlist, enumlookuplist){ + foreach(ENUMITEM* enumitem, enumitemlist){ + EnumSpecifierAST *penumspec = enumitem->ast; + QString enumspecname = enumitem->trlUnit->spell(penumspec->name->firstToken()); + if(enumspecname == enumname){ + qflags->enumvalues << getEnumValueStringList(enumitem, qflagname); + found = true; + break; + } + } + if(found) + break; + } + if(!found) + qflags->foundallenums = false; + } + } +} + +/***************************************** +Function that compares if all enums +and flags assigned by using the Q_FLAGS +are complete defined. +*****************************************/ +QList<ParseManager::QFLAGITEM*> ParseManager::containsAllFlags(const QList<QFLAGITEM*> &classqflaglist, const QList<QFLAGITEM*> &iclassqflaglist) +{ + QList<QFLAGITEM*> ret; + foreach(QFLAGITEM* iqflags, iclassqflaglist){ + if(iqflags->foundallenums){ + bool found = false; + QStringList missingimplinclasses; + ClassSpecifierAST* clspec = 0; + foreach(QFLAGITEM* qflags, classqflaglist){ + if(clspec != qflags->highestlevelclass->classspec){ + clspec = qflags->highestlevelclass->classspec; + //get the classname + QString classname = ""; + unsigned int firsttoken = clspec->name->firstToken(); + classname += qflags->trlUnit->spell(firsttoken); + if(missingimplinclasses.indexOf(classname) < 0) + missingimplinclasses.push_back(classname); + } + if(qflags->isEqualTo(iqflags)){ + found = true; + missingimplinclasses.clear(); + break; + } + } + if(!found){ + iqflags->classWichIsNotFound.append(missingimplinclasses); + ret.push_back(iqflags); + } + } + else + ret.push_back(iqflags); + } + return ret; +} + +/************************************ +Function that gives back an error +string for a Q_FLAGS mismatch. +************************************/ +QString ParseManager::getErrorMessage(QFLAGITEM* pfg) +{ + QString ret = ""; + QTextStream out(&ret); + + if(!pfg->foundallenums) + { + unsigned int firsttoken = pfg->highestlevelclass->classspec->name->firstToken(); + unsigned int lasttoken = pfg->highestlevelclass->classspec->name->lastToken(); + for(unsigned int i = firsttoken; i < lasttoken; i++){ + out << pfg->trlUnit->spell(i); + } + out << "::"; + firsttoken = pfg->ast->firstToken(); + lasttoken = pfg->ast->lastToken(); + for(unsigned int i = firsttoken; i <= lasttoken; i++){ + out << pfg->trlUnit->spell(i) << " "; + } + out << endl << " - one or more Enums missing." << endl; + } + for(int i = 0; i < pfg->classWichIsNotFound.size(); i++){ + if(ret.size() > 0) + out << endl; + + out << pfg->classWichIsNotFound[i] << "::"; + + unsigned int firsttoken = pfg->ast->firstToken(); + unsigned int lasttoken = pfg->ast->lastToken(); + for(unsigned int i = firsttoken; i <= lasttoken; i++){ + out << pfg->trlUnit->spell(i) << " "; + } + } + return ret; +} +//---> diff --git a/src/tools/ICheck/ICheckLib/ParseManager.h b/src/tools/ICheck/ICheckLib/ParseManager.h new file mode 100644 index 0000000000000000000000000000000000000000..329fc8f56280a955cf77aa5e48fe072d091a7539 --- /dev/null +++ b/src/tools/ICheck/ICheckLib/ParseManager.h @@ -0,0 +1,300 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** +** Description: +** +** The ParseManager parses and compares to different header files +** of its metadata. This can be used for checking if an Interface +** is implemented complete. +** +** How to use it: +** +** //Parse the interface header +** ParseManager* iParseManager = new ParseManager(); +** iParseManager->setIncludePath(iIncludepathlist); +** iParseManager->parse(iFilelist); +** +** //Parse the header that needs to be compared against the interface header +** ParseManager* chParseManager = new ParseManager(); +** chIncludepathlist << getQTIncludePath(); +** chParseManager->setIncludePath(chIncludepathlist); +** chParseManager->parse(chFilelist); +** +** if(!chParseManager->checkAllMetadatas(iParseManager)){ +** cout << "Folowing interface items are missing:" << endl; +** QStringList errorlist = chParseManager->getErrorMsg(); +** foreach(QString msg, errorlist){ +** cout << (const char *)msg.toLatin1() << endl; +** } +** return -1; +** } +** else +** cout << "Interface is full defined."; +** +**************************************************************************/ + + +#ifndef PARSEMANAGER_H +#define PARSEMANAGER_H + +#include <QObject> +#include <QList> +#include <QFuture> +#include <QStringList> +#include "cplusplus\CppDocument.h" + +namespace CppTools{ + namespace Internal{ + class CppPreprocessor; + } +} + +namespace CPlusPlus { + class TranslationUnit; + class AST; + class ClassSpecifierAST; + class SimpleDeclarationAST; + class QPropertyDeclarationAST; + class QEnumDeclarationAST; + class QFlagsDeclarationAST; + class QDeclareFlagsDeclarationAST; + class EnumSpecifierAST; + class Function; + + class ParseManager : public QObject + { + Q_OBJECT + struct CLASSLISTITEM + { + CPlusPlus::TranslationUnit* trlUnit; + ClassSpecifierAST* classspec; + }; + struct CLASSTREE + { + CLASSLISTITEM* highestlevelclass; + QList<CLASSLISTITEM*> classlist; + }; + struct FUNCTIONITEM + { + const CLASSLISTITEM* highestlevelclass; + CPlusPlus::TranslationUnit* trlUnit; + ClassSpecifierAST* classAst; + QStringList classWichIsNotFound; + CPlusPlus::Function* function; + SimpleDeclarationAST* ast; + + bool isEqualTo(FUNCTIONITEM* cpfct, bool ignoreName = true); + void init() + { + highestlevelclass = 0; + trlUnit = 0; + classAst = 0; + function = 0; + ast = 0; + } + }; + struct PROPERTYITEM + { + const CLASSLISTITEM* highestlevelclass; + QStringList classWichIsNotFound; + QPropertyDeclarationAST *ast; + CPlusPlus::TranslationUnit* trlUnit; + bool readdefined; + FUNCTIONITEM *readFct; + bool writedefined; + FUNCTIONITEM *writeFct; + bool resetdefined; + FUNCTIONITEM *resetFct; + bool notifydefined; + FUNCTIONITEM *notifyFct; + bool foundalldefinedfct; + + bool isEqualTo(PROPERTYITEM* cpppt); + void init() + { + highestlevelclass = 0; + ast = 0; + trlUnit = 0; + readdefined = false; + readFct = 0; + writedefined = false; + writeFct = 0; + resetdefined = false; + resetFct = 0; + notifydefined = false; + notifyFct = 0; + foundalldefinedfct = false; + } + }; + + struct QENUMITEM + { + const CLASSLISTITEM* highestlevelclass; + CPlusPlus::TranslationUnit* trlUnit; + QStringList classWichIsNotFound; + QEnumDeclarationAST* ast; + //an item in this list will be shown like: + //EnumName.EnumItemName.Value + //ConnectionState.disconnected.0 + QStringList values; + bool foundallenums; + + bool isEqualTo(QENUMITEM *cpenum); + void init() + { + highestlevelclass = 0; + trlUnit = 0; + ast = 0; + values.clear(); + foundallenums = true; + } + }; + + struct ENUMITEM + { + const CLASSLISTITEM* highestlevelclass; + CPlusPlus::TranslationUnit* trlUnit; + QStringList classWichIsNotFound; + EnumSpecifierAST* ast; + + void init() + { + highestlevelclass = 0; + trlUnit = 0; + ast = 0; + } + }; + + struct QFLAGITEM + { + const CLASSLISTITEM* highestlevelclass; + CPlusPlus::TranslationUnit* trlUnit; + QStringList classWichIsNotFound; + QFlagsDeclarationAST* ast; + QStringList enumvalues; + bool foundallenums; + + bool isEqualTo(QFLAGITEM *cpflag); + void init() + { + highestlevelclass = 0; + trlUnit = 0; + ast = 0; + enumvalues.clear(); + foundallenums = true; + } + }; + + struct QDECLAREFLAGSITEM + { + const CLASSLISTITEM* highestlevelclass; + CPlusPlus::TranslationUnit* trlUnit; + QStringList classWichIsNotFound; + QDeclareFlagsDeclarationAST* ast; + + void init() + { + highestlevelclass = 0; + trlUnit = 0; + ast = 0; + } + }; + + + public: + ParseManager(); + virtual ~ParseManager(); + void setIncludePath(const QStringList &includePath); + void parse(const QStringList &sourceFiles); + bool checkAllMetadatas(ParseManager* pInterfaceParserManager); + CppTools::Internal::CppPreprocessor *getPreProcessor() { return pCppPreprocessor; } + QList<CLASSTREE*> CreateClassLists(); + QStringList getErrorMsg() { return m_errormsgs; } + + private: + void parse(CppTools::Internal::CppPreprocessor *preproc, const QStringList &files); + void getBaseClasses(const CLASSLISTITEM* pclass, QList<CLASSLISTITEM*> &baseclasslist, const QList<CLASSLISTITEM*> &allclasslist); + void getElements(QList<FUNCTIONITEM*> &functionlist + , QList<PROPERTYITEM*> &propertylist + , QList<QENUMITEM*> &qenumlist + , QList<ENUMITEM*> &enumlist + , QList<QFLAGITEM*> &qflaglist + , QList<QDECLAREFLAGSITEM*> &qdeclareflaglist + , const QList<CLASSLISTITEM*> classitems + , const CLASSLISTITEM* highestlevelclass); + + //<--- for Metadata functions checks + QList<FUNCTIONITEM*> checkMetadataFunctions(const QList<QList<FUNCTIONITEM*> > &classfctlist, const QList<QList<FUNCTIONITEM*> > &iclassfctlist); + bool isMetaObjFunction(FUNCTIONITEM* fct); + QList<FUNCTIONITEM*> containsAllMetadataFunction(const QList<FUNCTIONITEM*> &classfctlist, const QList<FUNCTIONITEM*> &iclassfctlist); + QString getErrorMessage(FUNCTIONITEM* fct); + //---> + + //<--- for Q_PROPERTY functions checks + QList<PROPERTYITEM*> checkMetadataProperties(const QList<QList<PROPERTYITEM*> > &classproplist + , const QList<QList<FUNCTIONITEM*> > &classfctlist + , const QList<QList<PROPERTYITEM*> > &iclassproplist + , const QList<QList<FUNCTIONITEM*> > &iclassfctlist); + void assignPropertyFunctions(PROPERTYITEM* prop, const QList<QList<FUNCTIONITEM*> > &fctlookuplist); + QList<PROPERTYITEM*> containsAllPropertyFunction(const QList<PROPERTYITEM*> &classproplist, const QList<PROPERTYITEM*> &iclassproplist); + QString getErrorMessage(PROPERTYITEM* ppt); + //---> + + //<--- for Q_ENUMS checks + QList<QENUMITEM*> checkMetadataEnums(const QList<QList<QENUMITEM*> > &classqenumlist + , const QList<QList<ENUMITEM*> > &classenumlist + , const QList<QList<QENUMITEM*> > &iclassqenumlist + , const QList<QList<ENUMITEM*> > &iclassenumlist); + QStringList getEnumValueStringList(ENUMITEM *penum, QString mappedenumname = ""); + void assignEnumValues(QENUMITEM* qenum, const QList<QList<ENUMITEM*> > &enumlookuplist); + QList<QENUMITEM*> containsAllEnums(const QList<QENUMITEM*> &classqenumlist, const QList<QENUMITEM*> &iclassqenumlist); + QString getErrorMessage(QENUMITEM* qenum); + //---> + + //<--- for QFlags checks ---> + QList<QFLAGITEM*> checkMetadataFlags(const QList<QList<QFLAGITEM*> > &classqflaglist + , const QList<QList<QDECLAREFLAGSITEM*> > &classqdeclareflaglist + , const QList<QList<ENUMITEM*> > &classenumlist + , const QList<QList<QFLAGITEM*> > &iclassqflaglist + , const QList<QList<QDECLAREFLAGSITEM*> > &iclassqdeclareflaglist + , const QList<QList<ENUMITEM*> > &iclassenumlist); + void assignFlagValues(QFLAGITEM* qflags, const QList<QList<QDECLAREFLAGSITEM*> > &qdeclareflagslookuplist, const QList<QList<ENUMITEM*> > &enumlookuplist); + QList<QFLAGITEM*> containsAllFlags(const QList<QFLAGITEM*> &classqflaglist, const QList<QFLAGITEM*> &iclassqflaglist); + QString getErrorMessage(QFLAGITEM* pfg); + //---> + + private: + // cache + QStringList m_includePaths; + QStringList m_frameworkPaths; + QByteArray m_definedMacros; + CppTools::Internal::CppPreprocessor* pCppPreprocessor; + QString m_strHeaderFile; + QStringList m_errormsgs; + }; +} +#endif // PARSEMANAGER_H diff --git a/src/tools/ICheck/ICheckLib/ichecklib.cpp b/src/tools/ICheck/ICheckLib/ichecklib.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ae4cc0b8f12d149fc48098b268ef4c4be29348ba --- /dev/null +++ b/src/tools/ICheck/ICheckLib/ichecklib.cpp @@ -0,0 +1,60 @@ +#include "ichecklib.h" +#include "ParseManager.h" +#include <QtCore/QCoreApplication> +#include <QString> +#include <QStringList> +#include <iostream> +#include <QDebug> +#include <QDir> +#include <QFile> +#include <QFileInfo> +#include <QProcess> + +QStringList getQTIncludePath() +{ + QStringList ret; + QStringList processevironment = QProcess::systemEnvironment(); + foreach(QString item, processevironment){ + if(item.indexOf("QTDIR=") == 0){ + QString qtpath = item.remove("QTDIR="); + ret << qtpath + "\\include\\QtCore"; + break; + } + } + return ret; +} + +ICheckLib::ICheckLib() +: pParseManager(0) +{ +} + +void ICheckLib::ParseHeader(const QStringList& includePath, const QStringList& filelist) +{ + if(pParseManager) + delete pParseManager; + pParseManager = 0; + pParseManager = new CPlusPlus::ParseManager(); + pParseManager->setIncludePath(includePath); + pParseManager->parse(filelist); +} + +bool ICheckLib::check(const ICheckLib& ichecklib /*ICheckLib from interface header*/) +{ + if(pParseManager){ + CPlusPlus::ParseManager* cpparsemanager = ichecklib.pParseManager; + return pParseManager->checkAllMetadatas(cpparsemanager); + } + return false; +} + +QStringList ICheckLib::getErrorMsg() +{ + QStringList ret; + if(pParseManager){ + ret.append(pParseManager->getErrorMsg()); + } + else + ret << "no file was parsed."; + return ret; +} diff --git a/src/tools/ICheck/ICheckLib/ichecklib.h b/src/tools/ICheck/ICheckLib/ichecklib.h new file mode 100644 index 0000000000000000000000000000000000000000..3d7b5df3fa189df466c0607af2d9dd83743f1191 --- /dev/null +++ b/src/tools/ICheck/ICheckLib/ichecklib.h @@ -0,0 +1,21 @@ +#ifndef ICHECKLIB_H +#define ICHECKLIB_H + +#include <QStringList> +#include "ICheckLib_global.h" + +namespace CPlusPlus{ + class ParseManager; +} + +class ICHECKLIBSHARED_EXPORT ICheckLib { +public: + ICheckLib(); + void ParseHeader(const QStringList& includePath, const QStringList& filelist); + bool check(const ICheckLib& ichecklib /*ICheckLib from interface header*/); + QStringList getErrorMsg(); +private: + CPlusPlus::ParseManager* pParseManager; +}; + +#endif // ICHECKLIB_H diff --git a/src/tools/ICheck/ICheckLib/ichecklib_global.h b/src/tools/ICheck/ICheckLib/ichecklib_global.h new file mode 100644 index 0000000000000000000000000000000000000000..c6d6ef76d946ed9edbb43104b235c7924342683b --- /dev/null +++ b/src/tools/ICheck/ICheckLib/ichecklib_global.h @@ -0,0 +1,12 @@ +#ifndef ICHECKLIB_GLOBAL_H +#define ICHECKLIB_GLOBAL_H + +#include <QtCore/qglobal.h> + +#if defined(ICHECKLIB_LIBRARY) +# define ICHECKLIBSHARED_EXPORT Q_DECL_EXPORT +#else +# define ICHECKLIBSHARED_EXPORT Q_DECL_IMPORT +#endif + +#endif // ICHECKLIB_GLOBAL_H diff --git a/src/tools/qmldesigner/standalone/standalone.pro b/src/tools/qmldesigner/standalone/standalone.pro index 9bc191991af5503dcc01e229bbabcadbd3d69e3f..9c574f855f816b472ad71345d53453ab708e33d3 100644 --- a/src/tools/qmldesigner/standalone/standalone.pro +++ b/src/tools/qmldesigner/standalone/standalone.pro @@ -23,7 +23,7 @@ SOURCES += \ application.cpp \ welcomescreen.cpp -include(../../../shared/qmljs/qmljs.pri) +include(../../../libs/qmljs/qmljs-lib.pri) HEADERS+=../../../libs/utils/changeset.h SOURCES+=../../../libs/utils/changeset.cpp INCLUDEPATH+=../../../libs diff --git a/src/tools/tools.pro b/src/tools/tools.pro index e90b1d6e1710c598f3b9b45866e1a6d4e86ed0b8..017d2fd2b59cbec7f941d8f09a5755d9667151ca 100644 --- a/src/tools/tools.pro +++ b/src/tools/tools.pro @@ -1,2 +1,2 @@ TEMPLATE = subdirs -win32:SUBDIRS = qtcdebugger +win32:SUBDIRS = qtcdebugger ICheck diff --git a/tests/auto/qml/qmldesigner/bauhaustests/bauhaustests.pro b/tests/auto/qml/qmldesigner/bauhaustests/bauhaustests.pro index e356d168a4b5b83bccaf1c10e5cafa655d5d9a05..79e8a180cc52e30ce3a533125eb5ebc53a64d33b 100644 --- a/tests/auto/qml/qmldesigner/bauhaustests/bauhaustests.pro +++ b/tests/auto/qml/qmldesigner/bauhaustests/bauhaustests.pro @@ -3,7 +3,7 @@ QT += testlib DESTDIR = $$DESIGNER_BINARY_DIRECTORY include(../../../../../src/plugins/qmldesigner/core/core.pri) -include(../../../../../src/shared/qmljs/qmljs.pri) +include(../../../../../src/libs/qmljs/qmljs-lib.pri) HEADERS+=../../../../../src/libs/utils/changeset.h SOURCES+=../../../../../src/libs/utils/changeset.cpp INCLUDEPATH+=../../../../../src/libs diff --git a/tests/auto/qml/qmldesigner/coretests/coretests.pro b/tests/auto/qml/qmldesigner/coretests/coretests.pro index 803f2418869112b3c3538aa2f40a1fd1d5e53c80..c4a7de34a7d2c37aa6c361896fd28e90c1d5ab43 100644 --- a/tests/auto/qml/qmldesigner/coretests/coretests.pro +++ b/tests/auto/qml/qmldesigner/coretests/coretests.pro @@ -4,7 +4,7 @@ QT += testlib \ declarative DESTDIR = $$DESIGNER_BINARY_DIRECTORY include(../../../../../src/plugins/qmldesigner/core/core.pri) -include(../../../../../src/shared/qmljs/qmljs.pri) +include(../../../../../src/libs/qmljs/qmljs-lib.pri) HEADERS+=../../../../../src/libs/utils/changeset.h SOURCES+=../../../../../src/libs/utils/changeset.cpp INCLUDEPATH+=../../../../../src/libs diff --git a/tests/auto/qml/qmldesigner/propertyeditortests/propertyeditortests.pro b/tests/auto/qml/qmldesigner/propertyeditortests/propertyeditortests.pro index 9c86267b81b6cbe8e54d3fae14bbf8ed16c7b9d2..0f353ce58ded19fa17bf05201da6b00417ded4b3 100644 --- a/tests/auto/qml/qmldesigner/propertyeditortests/propertyeditortests.pro +++ b/tests/auto/qml/qmldesigner/propertyeditortests/propertyeditortests.pro @@ -6,7 +6,7 @@ QT += testlib \ declarative DESTDIR = $$DESIGNER_BINARY_DIRECTORY include(../../../../../src/plugins/qmldesigner/core/core.pri) -include(../../../../../src/shared/qmljs/qmljs.pri) +include(../../../../../src/libs/qmljs/qmljs-lib.pri) HEADERS+=../../../../../src/libs/utils/changeset.h SOURCES+=../../../../../src/libs/utils/changeset.cpp INCLUDEPATH+=../../../../../src/libs diff --git a/tests/auto/qml/qmleditor/lookup/lookup.pro b/tests/auto/qml/qmleditor/lookup/lookup.pro index d23180fc5b47f3945d083dd4850b75e6e7e040b4..c4f210ac940d0048976ddacb9ccbf851a7c8ef5a 100644 --- a/tests/auto/qml/qmleditor/lookup/lookup.pro +++ b/tests/auto/qml/qmleditor/lookup/lookup.pro @@ -1,7 +1,7 @@ TEMPLATE = app CONFIG += qt warn_on console depend_includepath QT += testlib -include(../../../../../src/shared/qmljs/qmljs.pri) +include(../../../../../src/libs/qmljs/qmljs-lib.pri) DEFINES += QML_BUILD_STATIC_LIB EDITOR_DIR=../../../../../src/plugins/qmljseditor diff --git a/tests/auto/qml/qmleditor/lookup/tst_lookup.cpp b/tests/auto/qml/qmleditor/lookup/tst_lookup.cpp index c081781b814fa616b98c795d7a4ca955e3429241..795f536f8335c6b099d62c10d59f5b6fbe6f128c 100644 --- a/tests/auto/qml/qmleditor/lookup/tst_lookup.cpp +++ b/tests/auto/qml/qmleditor/lookup/tst_lookup.cpp @@ -3,14 +3,13 @@ #include <QObject> #include <QFile> -#include <qmljs/qmldocument.h> +#include <qmljs/qmljsdocument.h> #include <qmljs/parser/qmljsast_p.h> #include <qmllookupcontext.h> #include <typeinfo> -using namespace Qml; using namespace QmlJSEditor; using namespace QmlJSEditor::Internal; using namespace QmlJS; @@ -35,12 +34,12 @@ private Q_SLOTS: void localRootLookup(); protected: - QmlDocument::Ptr basicSymbolTest(const QString &input) const + Document::Ptr basicSymbolTest(const QString &input) const { const QLatin1String filename("<lookup test>"); - QmlDocument::Ptr doc = QmlDocument::create(filename); + Document::Ptr doc = Document::create(filename); doc->setSource(input); - doc->parse(); + doc->parseQml(); QList<DiagnosticMessage> msgs = doc->diagnosticMessages(); foreach (const DiagnosticMessage &msg, msgs) { @@ -56,21 +55,21 @@ protected: return doc; } - Snapshot snapshot(const QmlDocument::Ptr &doc) const + Snapshot snapshot(const Document::Ptr &doc) const { Snapshot snapshot; snapshot.insert(doc); return snapshot; } - QmlTypeSystem *typeSystem() { + TypeSystem *typeSystem() { if (!_typeSystem) - _typeSystem = new QmlTypeSystem; + _typeSystem = new TypeSystem; return _typeSystem; } private: - QmlTypeSystem *_typeSystem; + TypeSystem *_typeSystem; }; void tst_Lookup::basicSymbolTest() @@ -86,10 +85,10 @@ void tst_Lookup::basicSymbolTest() "}\n" ); - QmlDocument::Ptr doc = basicSymbolTest(input); + Document::Ptr doc = basicSymbolTest(input); QVERIFY(doc->isParsedCorrectly()); - UiProgram *program = doc->program(); + UiProgram *program = doc->qmlProgram(); QVERIFY(program); QVERIFY(program->members); QVERIFY(program->members->member); @@ -108,16 +107,16 @@ void tst_Lookup::basicSymbolTest() QVERIFY(xBinding->qualifiedId->name); QCOMPARE(xBinding->qualifiedId->name->asString(), QLatin1String("x")); - QmlSymbol::List docSymbols = doc->symbols(); + Symbol::List docSymbols = doc->symbols(); QCOMPARE(docSymbols.size(), 1); - QmlSymbol *rectSymbol = docSymbols.at(0); + Symbol *rectSymbol = docSymbols.at(0); QCOMPARE(rectSymbol->name(), QLatin1String("Rectangle")); QCOMPARE(rectSymbol->members().size(), 4); - QmlSymbolFromFile *rectFromFile = rectSymbol->asSymbolFromFile(); + SymbolFromFile *rectFromFile = rectSymbol->asSymbolFromFile(); QVERIFY(rectFromFile); - QmlSymbolFromFile *xSymbol = rectFromFile->findMember(xBinding); + SymbolFromFile *xSymbol = rectFromFile->findMember(xBinding); QVERIFY(xSymbol); QCOMPARE(xSymbol->name(), QLatin1String("x")); } @@ -129,26 +128,26 @@ void tst_Lookup::basicLookupTest() "Item{}\n" ); - QmlDocument::Ptr doc = basicSymbolTest(input); + Document::Ptr doc = basicSymbolTest(input); QVERIFY(doc->isParsedCorrectly()); - UiProgram *program = doc->program(); + UiProgram *program = doc->qmlProgram(); QVERIFY(program); - QStack<QmlSymbol *> emptyScope; + QStack<Symbol *> emptyScope; QmlLookupContext context(emptyScope, doc, snapshot(doc), typeSystem()); - QmlSymbol *rectSymbol = context.resolveType(QLatin1String("Text")); + Symbol *rectSymbol = context.resolveType(QLatin1String("Text")); QVERIFY(rectSymbol); - QmlBuildInSymbol *buildInRect = rectSymbol->asBuildInSymbol(); + PrimitiveSymbol *buildInRect = rectSymbol->asPrimitiveSymbol(); QVERIFY(buildInRect); QCOMPARE(buildInRect->name(), QLatin1String("Text")); - QmlSymbol::List allBuildInRectMembers = buildInRect->members(true); + Symbol::List allBuildInRectMembers = buildInRect->members(true); QVERIFY(!allBuildInRectMembers.isEmpty()); bool xPropFound = false; bool fontPropFound = false; - foreach (QmlSymbol *symbol, allBuildInRectMembers) { + foreach (Symbol *symbol, allBuildInRectMembers) { if (symbol->name() == QLatin1String("x")) xPropFound = true; else if (symbol->name() == QLatin1String("font")) @@ -157,12 +156,12 @@ void tst_Lookup::basicLookupTest() QVERIFY(xPropFound); QVERIFY(fontPropFound); - QmlSymbol::List buildInRectMembers = buildInRect->members(false); + Symbol::List buildInRectMembers = buildInRect->members(false); QVERIFY(!buildInRectMembers.isEmpty()); QSKIP("Getting properties _without_ the inerited properties doesn't work.", SkipSingle); fontPropFound = false; - foreach (QmlSymbol *symbol, buildInRectMembers) { + foreach (Symbol *symbol, buildInRectMembers) { if (symbol->name() == QLatin1String("x")) QFAIL("Text has x property"); else if (symbol->name() == QLatin1String("font")) @@ -176,7 +175,7 @@ void tst_Lookup::localIdLookup() QFile input(":/data/localIdLookup.qml"); QVERIFY(input.open(QIODevice::ReadOnly)); - QmlDocument::Ptr doc = basicSymbolTest(input.readAll()); + Document::Ptr doc = basicSymbolTest(input.readAll()); QVERIFY(doc->isParsedCorrectly()); QStringList symbolNames; @@ -192,17 +191,17 @@ void tst_Lookup::localIdLookup() } // try lookup - QStack<QmlSymbol *> scopes; + QStack<Symbol *> scopes; foreach (const QString &contextSymbolName, symbolNames) { scopes.push_back(doc->ids()[contextSymbolName]->parentNode()); QmlLookupContext context(scopes, doc, snapshot(doc), typeSystem()); foreach (const QString &lookupSymbolName, symbolNames) { - QmlSymbol *resolvedSymbol = context.resolve(lookupSymbolName); - QmlIdSymbol *targetSymbol = doc->ids()[lookupSymbolName]; + Symbol *resolvedSymbol = context.resolve(lookupSymbolName); + IdSymbol *targetSymbol = doc->ids()[lookupSymbolName]; QCOMPARE(resolvedSymbol, targetSymbol); - QmlIdSymbol *resolvedId = resolvedSymbol->asIdSymbol(); + IdSymbol *resolvedId = resolvedSymbol->asIdSymbol(); QVERIFY(resolvedId); QCOMPARE(resolvedId->parentNode(), targetSymbol->parentNode()); } @@ -214,7 +213,7 @@ void tst_Lookup::localScriptMethodLookup() QFile input(":/data/localScriptMethodLookup.qml"); QVERIFY(input.open(QIODevice::ReadOnly)); - QmlDocument::Ptr doc = basicSymbolTest(input.readAll()); + Document::Ptr doc = basicSymbolTest(input.readAll()); QVERIFY(doc->isParsedCorrectly()); QStringList symbolNames; @@ -233,13 +232,13 @@ void tst_Lookup::localScriptMethodLookup() } // try lookup - QStack<QmlSymbol *> scopes; + QStack<Symbol *> scopes; foreach (const QString &contextSymbolName, symbolNames) { scopes.push_back(doc->ids()[contextSymbolName]->parentNode()); QmlLookupContext context(scopes, doc, snapshot(doc), typeSystem()); foreach (const QString &functionName, functionNames) { - QmlSymbol *symbol = context.resolve(functionName); + Symbol *symbol = context.resolve(functionName); QVERIFY(symbol); QVERIFY(!symbol->isProperty()); // verify that it's a function @@ -252,7 +251,7 @@ void tst_Lookup::localScopeLookup() QFile input(":/data/localScopeLookup.qml"); QVERIFY(input.open(QIODevice::ReadOnly)); - QmlDocument::Ptr doc = basicSymbolTest(input.readAll()); + Document::Ptr doc = basicSymbolTest(input.readAll()); QVERIFY(doc->isParsedCorrectly()); QStringList symbolNames; @@ -266,13 +265,13 @@ void tst_Lookup::localScopeLookup() } // try lookup - QStack<QmlSymbol *> scopes; + QStack<Symbol *> scopes; foreach (const QString &contextSymbolName, symbolNames) { - QmlSymbol *parent = doc->ids()[contextSymbolName]->parentNode(); + Symbol *parent = doc->ids()[contextSymbolName]->parentNode(); scopes.push_back(parent); QmlLookupContext context(scopes, doc, snapshot(doc), typeSystem()); - QmlSymbol *symbol; + Symbol *symbol; symbol = context.resolve("prop"); QVERIFY(symbol); QVERIFY(symbol->isPropertyDefinitionSymbol()); @@ -290,7 +289,7 @@ void tst_Lookup::localRootLookup() QFile input(":/data/localRootLookup.qml"); QVERIFY(input.open(QIODevice::ReadOnly)); - QmlDocument::Ptr doc = basicSymbolTest(input.readAll()); + Document::Ptr doc = basicSymbolTest(input.readAll()); QVERIFY(doc->isParsedCorrectly()); QStringList symbolNames; @@ -299,18 +298,18 @@ void tst_Lookup::localRootLookup() symbolNames.append("theChild"); // check symbol existence and build scopes - QStack<QmlSymbol *> scopes; + QStack<Symbol *> scopes; foreach (const QString &symbolName, symbolNames) { - QmlIdSymbol *id = doc->ids()[symbolName]; + IdSymbol *id = doc->ids()[symbolName]; QVERIFY(id); scopes.push_back(id->parentNode()); } // try lookup - QmlSymbol *parent = scopes.front(); + Symbol *parent = scopes.front(); QmlLookupContext context(scopes, doc, snapshot(doc), typeSystem()); - QmlSymbol *symbol; + Symbol *symbol; symbol = context.resolve("prop"); QVERIFY(symbol); QVERIFY(symbol->isPropertyDefinitionSymbol());