diff options
author | Martin Smith <martin.smith@digia.com> | 2015-03-09 10:23:50 +0100 |
---|---|---|
committer | Martin Smith <martin.smith@digia.com> | 2015-03-12 08:32:30 +0000 |
commit | ee63462f472d528214b4a5163a36da0bb963c166 (patch) | |
tree | 571482bfdbc88b411d693eb478af61dae1cfac71 | |
parent | fd826c112e01226f40bbfad7e20bdb5461b7ace6 (diff) | |
download | qtbase-ee63462f472d528214b4a5163a36da0bb963c166.tar.gz |
qdoc: Bring qdoc's QML parser up to date
qdoc's QML parser has fallen behind the QML: parser in
QtDeclarative. Bring it up to date.
Change-Id: I12a688873564762434852960350c56655004e460
Task-number: QTBUG-44868
Reviewed-by: Martin Smith <martin.smith@digia.com>
-rw-r--r-- | src/tools/qdoc/qmlparser/qqmljsast_p.h | 574 | ||||
-rw-r--r-- | src/tools/qdoc/qmlparser/qqmljsastfwd_p.h | 2 | ||||
-rw-r--r-- | src/tools/qdoc/qmlparser/qqmljsengine_p.cpp | 8 | ||||
-rw-r--r-- | src/tools/qdoc/qmlparser/qqmljsengine_p.h | 5 | ||||
-rw-r--r-- | src/tools/qdoc/qmlparser/qqmljsglobal_p.h | 15 | ||||
-rw-r--r-- | src/tools/qdoc/qmlparser/qqmljslexer.cpp | 162 | ||||
-rw-r--r-- | src/tools/qdoc/qmlparser/qqmljslexer_p.h | 11 | ||||
-rw-r--r-- | src/tools/qdoc/qmlparser/qqmljsmemorypool_p.h | 26 | ||||
-rw-r--r-- | src/tools/qdoc/qmlparser/qqmljsparser.cpp | 19 |
9 files changed, 498 insertions, 324 deletions
diff --git a/src/tools/qdoc/qmlparser/qqmljsast_p.h b/src/tools/qdoc/qmlparser/qqmljsast_p.h index 9dbf4bb514..fa6b5d2488 100644 --- a/src/tools/qdoc/qmlparser/qqmljsast_p.h +++ b/src/tools/qdoc/qmlparser/qqmljsast_p.h @@ -247,7 +247,7 @@ class QML_PARSER_EXPORT ExpressionNode: public Node public: ExpressionNode() {} - virtual ExpressionNode *expressionCast() Q_DECL_OVERRIDE; + virtual ExpressionNode *expressionCast(); }; class QML_PARSER_EXPORT Statement: public Node @@ -255,7 +255,7 @@ class QML_PARSER_EXPORT Statement: public Node public: Statement() {} - virtual Statement *statementCast() Q_DECL_OVERRIDE; + virtual Statement *statementCast(); }; class QML_PARSER_EXPORT NestedExpression: public ExpressionNode @@ -267,12 +267,12 @@ public: : expression(expression) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return lparenToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return rparenToken; } // attributes @@ -288,12 +288,12 @@ public: ThisExpression() { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return thisToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return thisToken; } // attributes @@ -308,12 +308,12 @@ public: IdentifierExpression(const QStringRef &n): name (n) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return identifierToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return identifierToken; } // attributes @@ -328,12 +328,12 @@ public: NullExpression() { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return nullToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return nullToken; } // attributes @@ -347,12 +347,12 @@ public: TrueLiteral() { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return trueToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return trueToken; } // attributes @@ -366,12 +366,12 @@ public: FalseLiteral() { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return falseToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return falseToken; } // attributes @@ -386,12 +386,12 @@ public: NumericLiteral(double v): value(v) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return literalToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return literalToken; } // attributes: @@ -407,12 +407,12 @@ public: StringLiteral(const QStringRef &v): value (v) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return literalToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return literalToken; } // attributes: @@ -428,12 +428,12 @@ public: RegExpLiteral(const QStringRef &p, int f): pattern (p), flags (f) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return literalToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return literalToken; } // attributes: @@ -459,12 +459,12 @@ public: elements (elts), elision (e) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return lbracketToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return rbracketToken; } // attributes @@ -486,12 +486,12 @@ public: ObjectLiteral(PropertyAssignmentList *plist): properties (plist) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return lbraceToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return rbraceToken; } // attributes @@ -515,12 +515,12 @@ public: previous->next = this; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return commaToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return next ? next->lastSourceLocation() : commaToken; } inline Elision *finish () @@ -559,16 +559,16 @@ public: return front; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { if (elision) return elision->firstSourceLocation(); return expression->firstSourceLocation(); } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { if (next) return next->lastSourceLocation(); @@ -589,12 +589,14 @@ public: PropertyName() { kind = K; } - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return propertyNameToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return propertyNameToken; } + virtual QString asString() const = 0; + // attributes SourceLocation propertyNameToken; }; @@ -602,7 +604,11 @@ public: class QML_PARSER_EXPORT PropertyAssignment: public Node { public: - PropertyAssignment() {} + PropertyAssignment(PropertyName *n) + : name(n) + {} +// attributes + PropertyName *name; }; class QML_PARSER_EXPORT PropertyAssignmentList: public Node @@ -630,12 +636,12 @@ public: return front; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return assignment->firstSourceLocation(); } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return next ? next->lastSourceLocation() : assignment->lastSourceLocation(); } // attributes @@ -650,19 +656,18 @@ public: QQMLJS_DECLARE_AST_NODE(PropertyNameAndValue) PropertyNameAndValue(PropertyName *n, ExpressionNode *v) - : name(n), value(v) + : PropertyAssignment(n), value(v) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return name->firstSourceLocation(); } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return value->lastSourceLocation(); } // attributes - PropertyName *name; SourceLocation colonToken; ExpressionNode *value; SourceLocation commaToken; @@ -679,25 +684,24 @@ public: }; PropertyGetterSetter(PropertyName *n, FunctionBody *b) - : type(Getter), name(n), formals(0), functionBody (b) + : PropertyAssignment(n), type(Getter), formals(0), functionBody (b) { kind = K; } PropertyGetterSetter(PropertyName *n, FormalParameterList *f, FunctionBody *b) - : type(Setter), name(n), formals(f), functionBody (b) + : PropertyAssignment(n), type(Setter), formals(f), functionBody (b) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return getSetToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return rbraceToken; } // attributes Type type; SourceLocation getSetToken; - PropertyName *name; SourceLocation lparenToken; FormalParameterList *formals; SourceLocation rparenToken; @@ -714,7 +718,9 @@ public: IdentifierPropertyName(const QStringRef &n): id (n) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); + + virtual QString asString() const { return id.toString(); } // attributes QStringRef id; @@ -728,7 +734,9 @@ public: StringLiteralPropertyName(const QStringRef &n): id (n) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); + + virtual QString asString() const { return id.toString(); } // attributes QStringRef id; @@ -742,7 +750,9 @@ public: NumericLiteralPropertyName(double n): id (n) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); + + virtual QString asString() const { return QString::number(id, 'g', 16); } // attributes double id; @@ -757,12 +767,12 @@ public: base (b), expression (e) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return base->firstSourceLocation(); } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return rbracketToken; } // attributes @@ -781,12 +791,12 @@ public: base (b), name (n) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return base->firstSourceLocation(); } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return identifierToken; } // attributes @@ -805,12 +815,12 @@ public: base (b), arguments (a) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return newToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return rparenToken; } // attributes @@ -829,12 +839,12 @@ public: NewExpression(ExpressionNode *e): expression (e) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return newToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return expression->lastSourceLocation(); } // attributes @@ -851,12 +861,12 @@ public: base (b), arguments (a) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return base->firstSourceLocation(); } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return rparenToken; } // attributes @@ -883,12 +893,12 @@ public: previous->next = this; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return expression->firstSourceLocation(); } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { if (next) return next->lastSourceLocation(); @@ -916,12 +926,12 @@ public: PostIncrementExpression(ExpressionNode *b): base (b) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return base->firstSourceLocation(); } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return incrementToken; } // attributes @@ -937,12 +947,12 @@ public: PostDecrementExpression(ExpressionNode *b): base (b) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return base->firstSourceLocation(); } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return decrementToken; } // attributes @@ -958,12 +968,12 @@ public: DeleteExpression(ExpressionNode *e): expression (e) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return deleteToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return expression->lastSourceLocation(); } // attributes @@ -979,12 +989,12 @@ public: VoidExpression(ExpressionNode *e): expression (e) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return voidToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return expression->lastSourceLocation(); } // attributes @@ -1000,12 +1010,12 @@ public: TypeOfExpression(ExpressionNode *e): expression (e) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return typeofToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return expression->lastSourceLocation(); } // attributes @@ -1021,12 +1031,12 @@ public: PreIncrementExpression(ExpressionNode *e): expression (e) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return incrementToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return expression->lastSourceLocation(); } // attributes @@ -1042,12 +1052,12 @@ public: PreDecrementExpression(ExpressionNode *e): expression (e) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return decrementToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return expression->lastSourceLocation(); } // attributes @@ -1063,12 +1073,12 @@ public: UnaryPlusExpression(ExpressionNode *e): expression (e) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return plusToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return expression->lastSourceLocation(); } // attributes @@ -1084,12 +1094,12 @@ public: UnaryMinusExpression(ExpressionNode *e): expression (e) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return minusToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return expression->lastSourceLocation(); } // attributes @@ -1105,12 +1115,12 @@ public: TildeExpression(ExpressionNode *e): expression (e) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return tildeToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return expression->lastSourceLocation(); } // attributes @@ -1126,12 +1136,12 @@ public: NotExpression(ExpressionNode *e): expression (e) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return notToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return expression->lastSourceLocation(); } // attributes @@ -1148,14 +1158,14 @@ public: left (l), op (o), right (r) { kind = K; } - virtual BinaryExpression *binaryExpressionCast() Q_DECL_OVERRIDE; + virtual BinaryExpression *binaryExpressionCast(); - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return left->firstSourceLocation(); } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return right->lastSourceLocation(); } // attributes @@ -1174,12 +1184,12 @@ public: expression (e), ok (t), ko (f) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return expression->firstSourceLocation(); } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return ko->lastSourceLocation(); } // attributes @@ -1198,12 +1208,12 @@ public: Expression(ExpressionNode *l, ExpressionNode *r): left (l), right (r) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return left->firstSourceLocation(); } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return right->lastSourceLocation(); } // attributes @@ -1220,12 +1230,12 @@ public: Block(StatementList *slist): statements (slist) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return lbraceToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return rbraceToken; } // attributes @@ -1251,12 +1261,12 @@ public: previous->next = this; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return statement->firstSourceLocation(); } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return next ? next->lastSourceLocation() : statement->lastSourceLocation(); } inline StatementList *finish () @@ -1280,12 +1290,12 @@ public: declarations (vlist) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return declarationKindToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return semicolonToken; } // attributes @@ -1303,12 +1313,12 @@ public: name (n), expression (e), readOnly(false) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return identifierToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return expression ? expression->lastSourceLocation() : identifierToken; } // attributes @@ -1335,12 +1345,12 @@ public: previous->next = this; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return declaration->firstSourceLocation(); } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { if (next) return next->lastSourceLocation(); @@ -1372,12 +1382,12 @@ public: EmptyStatement() { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return semicolonToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return semicolonToken; } // attributes @@ -1392,12 +1402,12 @@ public: ExpressionStatement(ExpressionNode *e): expression (e) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return expression->firstSourceLocation(); } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return semicolonToken; } // attributes @@ -1414,12 +1424,12 @@ public: expression (e), ok (t), ko (f) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return ifToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { if (ko) return ko->lastSourceLocation(); @@ -1446,12 +1456,12 @@ public: statement (stmt), expression (e) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return doToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return semicolonToken; } // attributes @@ -1473,12 +1483,12 @@ public: expression (e), statement (stmt) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return whileToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return statement->lastSourceLocation(); } // attributes @@ -1498,12 +1508,12 @@ public: initialiser (i), condition (c), expression (e), statement (stmt) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return forToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return statement->lastSourceLocation(); } // attributes @@ -1527,12 +1537,12 @@ public: declarations (vlist), condition (c), expression (e), statement (stmt) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return forToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return statement->lastSourceLocation(); } // attributes @@ -1557,12 +1567,12 @@ public: initialiser (i), expression (e), statement (stmt) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return forToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return statement->lastSourceLocation(); } // attributes @@ -1584,12 +1594,12 @@ public: declaration (v), expression (e), statement (stmt) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return forToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return statement->lastSourceLocation(); } // attributes @@ -1611,12 +1621,12 @@ public: ContinueStatement(const QStringRef &l = QStringRef()): label (l) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return continueToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return semicolonToken; } // attributes @@ -1634,12 +1644,12 @@ public: BreakStatement(const QStringRef &l): label (l) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return breakToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return semicolonToken; } // attributes @@ -1657,12 +1667,12 @@ public: ReturnStatement(ExpressionNode *e): expression (e) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return returnToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return semicolonToken; } // attributes @@ -1680,12 +1690,12 @@ public: expression (e), statement (stmt) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return withToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return statement->lastSourceLocation(); } // attributes @@ -1705,12 +1715,12 @@ public: clauses (c), defaultClause (d), moreClauses (r) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return lbraceToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return rbraceToken; } // attributes @@ -1730,12 +1740,12 @@ public: expression (e), block (b) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return switchToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return block->rbraceToken; } // attributes @@ -1755,12 +1765,12 @@ public: expression (e), statements (slist) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return caseToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return statements ? statements->lastSourceLocation() : colonToken; } // attributes @@ -1787,12 +1797,12 @@ public: previous->next = this; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return clause->firstSourceLocation(); } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return next ? next->lastSourceLocation() : clause->lastSourceLocation(); } inline CaseClauses *finish () @@ -1816,12 +1826,12 @@ public: statements (slist) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return defaultToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return statements ? statements->lastSourceLocation() : colonToken; } // attributes @@ -1839,12 +1849,12 @@ public: label (l), statement (stmt) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return identifierToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return statement->lastSourceLocation(); } // attributes @@ -1862,12 +1872,12 @@ public: ThrowStatement(ExpressionNode *e): expression (e) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return throwToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return semicolonToken; } // attributes @@ -1885,12 +1895,12 @@ public: name (n), statement (stmt) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return catchToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return statement->lastSourceLocation(); } // attributes @@ -1911,12 +1921,12 @@ public: statement (stmt) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return finallyToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return statement ? statement->lastSourceLocation() : finallyToken; } // attributes @@ -1941,12 +1951,12 @@ public: statement (stmt), catchExpression (c), finallyExpression (0) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return tryToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { if (finallyExpression) return finallyExpression->statement->rbraceToken; @@ -1972,12 +1982,12 @@ public: name (n), formals (f), body (b) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return functionToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return rbraceToken; } // attributes @@ -2001,7 +2011,7 @@ public: FunctionExpression(n, f, b) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); }; class QML_PARSER_EXPORT FormalParameterList: public Node @@ -2021,12 +2031,12 @@ public: previous->next = this; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return identifierToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return next ? next->lastSourceLocation() : identifierToken; } inline FormalParameterList *finish () @@ -2069,12 +2079,12 @@ public: previous->next = this; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return element->firstSourceLocation(); } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return next ? next->lastSourceLocation() : element->lastSourceLocation(); } inline SourceElements *finish () @@ -2098,12 +2108,12 @@ public: elements (elts) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return elements ? elements->firstSourceLocation() : SourceLocation(); } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return elements ? elements->lastSourceLocation() : SourceLocation(); } // attributes @@ -2119,12 +2129,12 @@ public: elements (elts) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return elements ? elements->firstSourceLocation() : SourceLocation(); } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return elements ? elements->lastSourceLocation() : SourceLocation(); } // attributes @@ -2140,12 +2150,12 @@ public: declaration (f) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return declaration->firstSourceLocation(); } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return declaration->lastSourceLocation(); } // attributes @@ -2161,12 +2171,12 @@ public: statement (stmt) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return statement->firstSourceLocation(); } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return statement->lastSourceLocation(); } // attributes @@ -2181,12 +2191,12 @@ public: DebuggerStatement() { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return debuggerToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return semicolonToken; } // attributes @@ -2218,12 +2228,12 @@ public: return head; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return identifierToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return next ? next->lastSourceLocation() : identifierToken; } // attributes @@ -2245,12 +2255,12 @@ public: : importUri(uri) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return importToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return semicolonToken; } // attributes @@ -2268,10 +2278,10 @@ public: class QML_PARSER_EXPORT UiObjectMember: public Node { public: - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE = 0; - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE = 0; + virtual SourceLocation firstSourceLocation() const = 0; + virtual SourceLocation lastSourceLocation() const = 0; - virtual UiObjectMember *uiObjectMemberCast() Q_DECL_OVERRIDE; + virtual UiObjectMember *uiObjectMemberCast(); }; class QML_PARSER_EXPORT UiObjectMemberList: public Node @@ -2291,12 +2301,12 @@ public: previous->next = this; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return member->firstSourceLocation(); } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return next ? next->lastSourceLocation() : member->lastSourceLocation(); } UiObjectMemberList *finish() @@ -2335,12 +2345,12 @@ public: return head; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return identifierToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return next ? next->lastSourceLocation() : identifierToken; } // attributes @@ -2358,12 +2368,12 @@ public: : pragmaType(type) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return pragmaToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return semicolonToken; } // attributes @@ -2408,12 +2418,12 @@ public: return head; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return headerItem->firstSourceLocation(); } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return next ? next->lastSourceLocation() : headerItem->lastSourceLocation(); } // attributes @@ -2430,9 +2440,9 @@ public: : headers(headers), members(members) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { if (headers) return headers->firstSourceLocation(); @@ -2441,7 +2451,7 @@ public: return SourceLocation(); } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { if (members) return members->lastSourceLocation(); @@ -2472,12 +2482,12 @@ public: previous->next = this; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return member->firstSourceLocation(); } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return next ? next->lastSourceLocation() : member->lastSourceLocation(); } UiArrayMemberList *finish() @@ -2502,12 +2512,12 @@ public: : members(members) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return lbraceToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return rbraceToken; } // attributes @@ -2533,12 +2543,12 @@ public: previous->next = this; } - virtual void accept0(Visitor *) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return propertyTypeToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return next ? next->lastSourceLocation() : identifierToken; } inline UiParameterList *finish () @@ -2573,9 +2583,9 @@ public: : type(Property), memberType(memberType), name(name), statement(statement), binding(0), isDefaultMember(false), isReadonlyMember(false), parameters(0) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { if (defaultToken.isValid()) return defaultToken; @@ -2585,7 +2595,7 @@ public: return propertyToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { if (binding) return binding->lastSourceLocation(); @@ -2625,12 +2635,12 @@ public: : qualifiedTypeNameId(qualifiedTypeNameId), initializer(initializer) { kind = K; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return qualifiedTypeNameId->identifierToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return initializer->rbraceToken; } // attributes @@ -2647,7 +2657,7 @@ public: : sourceElement(sourceElement) { kind = K; } - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { if (FunctionDeclaration *funDecl = cast<FunctionDeclaration *>(sourceElement)) return funDecl->firstSourceLocation(); @@ -2657,7 +2667,7 @@ public: return SourceLocation(); } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { if (FunctionDeclaration *funDecl = cast<FunctionDeclaration *>(sourceElement)) return funDecl->lastSourceLocation(); @@ -2667,7 +2677,7 @@ public: return SourceLocation(); } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); // attributes @@ -2688,7 +2698,7 @@ public: hasOnToken(false) { kind = K; } - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { if (hasOnToken && qualifiedTypeNameId) return qualifiedTypeNameId->identifierToken; @@ -2696,10 +2706,10 @@ public: return qualifiedId->identifierToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return initializer->rbraceToken; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); // attributes @@ -2721,13 +2731,13 @@ public: statement(statement) { kind = K; } - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return qualifiedId->identifierToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return statement->lastSourceLocation(); } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); // attributes UiQualifiedId *qualifiedId; @@ -2746,13 +2756,13 @@ public: members(members) { kind = K; } - virtual SourceLocation firstSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation firstSourceLocation() const { return qualifiedId->identifierToken; } - virtual SourceLocation lastSourceLocation() const Q_DECL_OVERRIDE + virtual SourceLocation lastSourceLocation() const { return rbracketToken; } - virtual void accept0(Visitor *visitor) Q_DECL_OVERRIDE; + virtual void accept0(Visitor *visitor); // attributes UiQualifiedId *qualifiedId; diff --git a/src/tools/qdoc/qmlparser/qqmljsastfwd_p.h b/src/tools/qdoc/qmlparser/qqmljsastfwd_p.h index c4cb59293d..eae4125ab2 100644 --- a/src/tools/qdoc/qmlparser/qqmljsastfwd_p.h +++ b/src/tools/qdoc/qmlparser/qqmljsastfwd_p.h @@ -56,7 +56,7 @@ namespace QQmlJS { namespace AST { class SourceLocation { public: - SourceLocation(quint32 offset = 0, quint32 length = 0, quint32 line = 0, quint32 column = 0) + explicit SourceLocation(quint32 offset = 0, quint32 length = 0, quint32 line = 0, quint32 column = 0) : offset(offset), length(length), startLine(line), startColumn(column) { } diff --git a/src/tools/qdoc/qmlparser/qqmljsengine_p.cpp b/src/tools/qdoc/qmlparser/qqmljsengine_p.cpp index faf05f71f1..1c0a70a372 100644 --- a/src/tools/qdoc/qmlparser/qqmljsengine_p.cpp +++ b/src/tools/qdoc/qmlparser/qqmljsengine_p.cpp @@ -114,7 +114,7 @@ double integerFromString(const QString &str, int radix) Engine::Engine() - : _lexer(0) + : _lexer(0), _directives(0) { } Engine::~Engine() @@ -135,6 +135,12 @@ Lexer *Engine::lexer() const void Engine::setLexer(Lexer *lexer) { _lexer = lexer; } +Directives *Engine::directives() const +{ return _directives; } + +void Engine::setDirectives(Directives *directives) +{ _directives = directives; } + MemoryPool *Engine::pool() { return &_pool; } diff --git a/src/tools/qdoc/qmlparser/qqmljsengine_p.h b/src/tools/qdoc/qmlparser/qqmljsengine_p.h index 210797ffcd..fb65d7f028 100644 --- a/src/tools/qdoc/qmlparser/qqmljsengine_p.h +++ b/src/tools/qdoc/qmlparser/qqmljsengine_p.h @@ -57,6 +57,7 @@ QT_QML_BEGIN_NAMESPACE namespace QQmlJS { class Lexer; +class Directives; class MemoryPool; class QML_PARSER_EXPORT DiagnosticMessage @@ -84,6 +85,7 @@ public: class QML_PARSER_EXPORT Engine { Lexer *_lexer; + Directives *_directives; MemoryPool _pool; QList<AST::SourceLocation> _comments; QString _extraCode; @@ -102,6 +104,9 @@ public: Lexer *lexer() const; void setLexer(Lexer *lexer); + Directives *directives() const; + void setDirectives(Directives *directives); + MemoryPool *pool(); inline QStringRef midRef(int position, int size) { return _code.midRef(position, size); } diff --git a/src/tools/qdoc/qmlparser/qqmljsglobal_p.h b/src/tools/qdoc/qmlparser/qqmljsglobal_p.h index c9b5b4c5b4..fe2cbe7d1d 100644 --- a/src/tools/qdoc/qmlparser/qqmljsglobal_p.h +++ b/src/tools/qdoc/qmlparser/qqmljsglobal_p.h @@ -33,17 +33,6 @@ #ifndef QQMLJSGLOBAL_P_H #define QQMLJSGLOBAL_P_H -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - #include <QtCore/qglobal.h> #ifdef QT_CREATOR @@ -65,9 +54,9 @@ // QmlDevTools is a static library # define QML_PARSER_EXPORT # elif defined(QT_BUILD_QML_LIB) -# define QML_PARSER_EXPORT Q_AUTOTEST_EXPORT +# define QML_PARSER_EXPORT Q_DECL_EXPORT # else -# define QML_PARSER_EXPORT +# define QML_PARSER_EXPORT Q_DECL_IMPORT # endif #endif // QT_CREATOR diff --git a/src/tools/qdoc/qmlparser/qqmljslexer.cpp b/src/tools/qdoc/qmlparser/qqmljslexer.cpp index 69dcb15794..62748ef10d 100644 --- a/src/tools/qdoc/qmlparser/qqmljslexer.cpp +++ b/src/tools/qdoc/qmlparser/qqmljslexer.cpp @@ -887,8 +887,7 @@ again: int Lexer::scanNumber(QChar ch) { if (ch != QLatin1Char('0')) { - QByteArray buf; - buf.reserve(64); + QVarLengthArray<char, 64> buf; buf += ch.toLatin1(); QChar n = _char; @@ -1225,12 +1224,60 @@ bool Lexer::canInsertAutomaticSemicolon(int token) const || _followsClosingBrace; } -bool Lexer::scanDirectives(Directives *directives) +static const int uriTokens[] = { + QQmlJSGrammar::T_IDENTIFIER, + QQmlJSGrammar::T_PROPERTY, + QQmlJSGrammar::T_SIGNAL, + QQmlJSGrammar::T_READONLY, + QQmlJSGrammar::T_ON, + QQmlJSGrammar::T_BREAK, + QQmlJSGrammar::T_CASE, + QQmlJSGrammar::T_CATCH, + QQmlJSGrammar::T_CONTINUE, + QQmlJSGrammar::T_DEFAULT, + QQmlJSGrammar::T_DELETE, + QQmlJSGrammar::T_DO, + QQmlJSGrammar::T_ELSE, + QQmlJSGrammar::T_FALSE, + QQmlJSGrammar::T_FINALLY, + QQmlJSGrammar::T_FOR, + QQmlJSGrammar::T_FUNCTION, + QQmlJSGrammar::T_IF, + QQmlJSGrammar::T_IN, + QQmlJSGrammar::T_INSTANCEOF, + QQmlJSGrammar::T_NEW, + QQmlJSGrammar::T_NULL, + QQmlJSGrammar::T_RETURN, + QQmlJSGrammar::T_SWITCH, + QQmlJSGrammar::T_THIS, + QQmlJSGrammar::T_THROW, + QQmlJSGrammar::T_TRUE, + QQmlJSGrammar::T_TRY, + QQmlJSGrammar::T_TYPEOF, + QQmlJSGrammar::T_VAR, + QQmlJSGrammar::T_VOID, + QQmlJSGrammar::T_WHILE, + QQmlJSGrammar::T_CONST, + QQmlJSGrammar::T_DEBUGGER, + QQmlJSGrammar::T_RESERVED_WORD, + QQmlJSGrammar::T_WITH, + + QQmlJSGrammar::EOF_SYMBOL +}; +static inline bool isUriToken(int token) { - if (_qmlMode) { - // the directives are a Javascript-only extension. - return false; + const int *current = uriTokens; + while (*current != QQmlJSGrammar::EOF_SYMBOL) { + if (*current == token) + return true; + ++current; } + return false; +} + +bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error) +{ + Q_ASSERT(!_qmlMode); lex(); // fetch the first token @@ -1238,24 +1285,33 @@ bool Lexer::scanDirectives(Directives *directives) return true; do { - lex(); // skip T_DOT - const int lineNumber = tokenStartLine(); + const int column = tokenStartColumn(); + + lex(); // skip T_DOT if (! (_tokenKind == T_IDENTIFIER || _tokenKind == T_RESERVED_WORD)) - return false; // expected a valid QML/JS directive + return true; // expected a valid QML/JS directive const QString directiveName = tokenText(); if (! (directiveName == QLatin1String("pragma") || - directiveName == QLatin1String("import"))) + directiveName == QLatin1String("import"))) { + error->message = QCoreApplication::translate("QQmlParser", "Syntax error"); + error->loc.startLine = tokenStartLine(); + error->loc.startColumn = tokenStartColumn(); return false; // not a valid directive name + } // it must be a pragma or an import directive. if (directiveName == QLatin1String("pragma")) { // .pragma library - if (! (lex() == T_IDENTIFIER && tokenText() == QLatin1String("library"))) + if (! (lex() == T_IDENTIFIER && tokenText() == QLatin1String("library"))) { + error->message = QCoreApplication::translate("QQmlParser", "Syntax error"); + error->loc.startLine = tokenStartLine(); + error->loc.startColumn = tokenStartColumn(); return false; // expected `library + } // we found a .pragma library directive directives->pragmaLibrary(); @@ -1274,22 +1330,53 @@ bool Lexer::scanDirectives(Directives *directives) fileImport = true; pathOrUri = tokenText(); + if (!pathOrUri.endsWith(QLatin1String("js"))) { + error->message = QCoreApplication::translate("QQmlParser","Imported file must be a script"); + error->loc.startLine = tokenStartLine(); + error->loc.startColumn = tokenStartColumn(); + return false; + } + } else if (_tokenKind == T_IDENTIFIER) { // .import T_IDENTIFIER (. T_IDENTIFIER)* T_NUMERIC_LITERAL as T_IDENTIFIER - pathOrUri = tokenText(); + while (true) { + if (!isUriToken(_tokenKind)) { + error->message = QCoreApplication::translate("QQmlParser","Invalid module URI"); + error->loc.startLine = tokenStartLine(); + error->loc.startColumn = tokenStartColumn(); + return false; + } - lex(); // skip the first T_IDENTIFIER - for (; _tokenKind == T_DOT; lex()) { - if (lex() != T_IDENTIFIER) + pathOrUri.append(tokenText()); + + lex(); + if (tokenStartLine() != lineNumber) { + error->message = QCoreApplication::translate("QQmlParser","Invalid module URI"); + error->loc.startLine = tokenStartLine(); + error->loc.startColumn = tokenStartColumn(); return false; + } + if (_tokenKind != QQmlJSGrammar::T_DOT) + break; + + pathOrUri.append(QLatin1Char('.')); - pathOrUri += QLatin1Char('.'); - pathOrUri += tokenText(); + lex(); + if (tokenStartLine() != lineNumber) { + error->message = QCoreApplication::translate("QQmlParser","Invalid module URI"); + error->loc.startLine = tokenStartLine(); + error->loc.startColumn = tokenStartColumn(); + return false; + } } - if (_tokenKind != T_NUMERIC_LITERAL) + if (_tokenKind != T_NUMERIC_LITERAL) { + error->message = QCoreApplication::translate("QQmlParser","Module import requires a version"); + error->loc.startLine = tokenStartLine(); + error->loc.startColumn = tokenStartColumn(); return false; // expected the module version number + } version = tokenText(); } @@ -1297,22 +1384,51 @@ bool Lexer::scanDirectives(Directives *directives) // // recognize the mandatory `as' followed by the module name // - if (! (lex() == T_IDENTIFIER && tokenText() == QLatin1String("as"))) + if (! (lex() == T_IDENTIFIER && tokenText() == QLatin1String("as") && tokenStartLine() == lineNumber)) { + if (fileImport) + error->message = QCoreApplication::translate("QQmlParser", "File import requires a qualifier"); + else + error->message = QCoreApplication::translate("QQmlParser", "Module import requires a qualifier"); + if (tokenStartLine() != lineNumber) { + error->loc.startLine = lineNumber; + error->loc.startColumn = column; + } else { + error->loc.startLine = tokenStartLine(); + error->loc.startColumn = tokenStartColumn(); + } return false; // expected `as' + } - if (lex() != T_IDENTIFIER) + if (lex() != T_IDENTIFIER || tokenStartLine() != lineNumber) { + if (fileImport) + error->message = QCoreApplication::translate("QQmlParser", "File import requires a qualifier"); + else + error->message = QCoreApplication::translate("QQmlParser", "Module import requires a qualifier"); + error->loc.startLine = tokenStartLine(); + error->loc.startColumn = tokenStartColumn(); return false; // expected module name + } const QString module = tokenText(); + if (!module.at(0).isUpper()) { + error->message = QCoreApplication::translate("QQmlParser","Invalid import qualifier"); + error->loc.startLine = tokenStartLine(); + error->loc.startColumn = tokenStartColumn(); + return false; + } if (fileImport) - directives->importFile(pathOrUri, module); + directives->importFile(pathOrUri, module, lineNumber, column); else - directives->importModule(pathOrUri, version, module); + directives->importModule(pathOrUri, version, module, lineNumber, column); } - if (tokenStartLine() != lineNumber) + if (tokenStartLine() != lineNumber) { + error->message = QCoreApplication::translate("QQmlParser", "Syntax error"); + error->loc.startLine = tokenStartLine(); + error->loc.startColumn = tokenStartColumn(); return false; // the directives cannot span over multiple lines + } // fetch the first token after the .pragma/.import directive lex(); diff --git a/src/tools/qdoc/qmlparser/qqmljslexer_p.h b/src/tools/qdoc/qmlparser/qqmljslexer_p.h index 20f4b42b8d..427affe4b9 100644 --- a/src/tools/qdoc/qmlparser/qqmljslexer_p.h +++ b/src/tools/qdoc/qmlparser/qqmljslexer_p.h @@ -55,6 +55,7 @@ QT_QML_BEGIN_NAMESPACE namespace QQmlJS { class Engine; +class DiagnosticMessage; class QML_PARSER_EXPORT Directives { public: @@ -64,17 +65,21 @@ public: { } - virtual void importFile(const QString &jsfile, const QString &module) + virtual void importFile(const QString &jsfile, const QString &module, int line, int column) { Q_UNUSED(jsfile); Q_UNUSED(module); + Q_UNUSED(line); + Q_UNUSED(column); } - virtual void importModule(const QString &uri, const QString &version, const QString &module) + virtual void importModule(const QString &uri, const QString &version, const QString &module, int line, int column) { Q_UNUSED(uri); Q_UNUSED(version); Q_UNUSED(module); + Q_UNUSED(line); + Q_UNUSED(column); } }; @@ -146,7 +151,7 @@ public: int lex(); bool scanRegExp(RegExpBodyPrefix prefix = NoPrefix); - bool scanDirectives(Directives *directives); + bool scanDirectives(Directives *directives, DiagnosticMessage *error); int regExpFlags() const { return _patternFlags; } QString regExpPattern() const { return _tokenText; } diff --git a/src/tools/qdoc/qmlparser/qqmljsmemorypool_p.h b/src/tools/qdoc/qmlparser/qqmljsmemorypool_p.h index f8bb70c54c..16927251c7 100644 --- a/src/tools/qdoc/qmlparser/qqmljsmemorypool_p.h +++ b/src/tools/qdoc/qmlparser/qqmljsmemorypool_p.h @@ -57,6 +57,8 @@ QT_QML_BEGIN_NAMESPACE namespace QQmlJS { +class Managed; + class QML_PARSER_EXPORT MemoryPool : public QSharedData { MemoryPool(const MemoryPool &other); @@ -100,6 +102,30 @@ public: _ptr = _end = 0; } + template <typename _Tp> _Tp *New() { return new (this->allocate(sizeof(_Tp))) _Tp(); } + + template <typename PoolContentType, typename Visitor> + void visitManagedPool(Visitor &visitor) + { + for (int i = 0; i <= _blockCount; ++i) { + char *p = _blocks[i]; + char *end = p + BLOCK_SIZE; + if (i == _blockCount) { + Q_ASSERT(_ptr <= end); + end = _ptr; + } + + Q_ASSERT(p <= end); + + const qptrdiff increment = (sizeof(PoolContentType) + 7) & ~7; + + while (p + increment <= end) { + visitor(reinterpret_cast<PoolContentType*>(p)); + p += increment; + } + } + } + private: void *allocate_helper(size_t size) { diff --git a/src/tools/qdoc/qmlparser/qqmljsparser.cpp b/src/tools/qdoc/qmlparser/qqmljsparser.cpp index 44279260d7..520c377034 100644 --- a/src/tools/qdoc/qmlparser/qqmljsparser.cpp +++ b/src/tools/qdoc/qmlparser/qqmljsparser.cpp @@ -161,7 +161,24 @@ bool Parser::parse(int startToken) token_buffer[0].token = startToken; first_token = &token_buffer[0]; - last_token = &token_buffer[1]; + if (startToken == T_FEED_JS_PROGRAM && !lexer->qmlMode()) { + Directives ignoreDirectives; + Directives *directives = driver->directives(); + if (!directives) + directives = &ignoreDirectives; + DiagnosticMessage error; + if (!lexer->scanDirectives(directives, &error)) { + diagnostic_messages.append(error); + return false; + } + token_buffer[1].token = lexer->tokenKind(); + token_buffer[1].dval = lexer->tokenValue(); + token_buffer[1].loc = location(lexer); + token_buffer[1].spell = lexer->tokenSpell(); + last_token = &token_buffer[2]; + } else { + last_token = &token_buffer[1]; + } tos = -1; program = 0; |