aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/3rdparty/cplusplus
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@digia.com>2013-10-08 13:42:39 +0200
committerNikolai Kosjar <nikolai.kosjar@digia.com>2013-10-09 15:13:31 +0200
commit0e4deaba2356e0baec5d6e65dabf503bf6f7c3bc (patch)
treedab8ff508e9aba1e4ae06711fcf0f1555e2db9f8 /src/libs/3rdparty/cplusplus
parentc5dfcce948dd40dac4f1a22d97a53afc5c6b7494 (diff)
C++: Parse MEMBER in Q_PROPERTY()
MEMBER was added in Qt5. Task-number: QTCREATORBUG-10068 Change-Id: Ic6c15a0e5ee8981ab98e4c12fc1521dc281b731f Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src/libs/3rdparty/cplusplus')
-rw-r--r--src/libs/3rdparty/cplusplus/Bind.cpp2
-rw-r--r--src/libs/3rdparty/cplusplus/Parser.cpp25
-rw-r--r--src/libs/3rdparty/cplusplus/QtContextKeywords.cpp15
-rw-r--r--src/libs/3rdparty/cplusplus/QtContextKeywords.h3
-rw-r--r--src/libs/3rdparty/cplusplus/Symbols.h25
5 files changed, 45 insertions, 25 deletions
diff --git a/src/libs/3rdparty/cplusplus/Bind.cpp b/src/libs/3rdparty/cplusplus/Bind.cpp
index 0defcc0a1f6..eb34bba3968 100644
--- a/src/libs/3rdparty/cplusplus/Bind.cpp
+++ b/src/libs/3rdparty/cplusplus/Bind.cpp
@@ -2002,6 +2002,8 @@ bool Bind::visit(QtPropertyDeclarationAST *ast)
flags |= QtPropertyDeclaration::ReadFunction;
} else if (name == "WRITE") {
flags |= QtPropertyDeclaration::WriteFunction;
+ } else if (name == "MEMBER") {
+ flags |= QtPropertyDeclaration::MemberVariable;
} else if (name == "RESET") {
flags |= QtPropertyDeclaration::ResetFunction;
} else if (name == "NOTIFY") {
diff --git a/src/libs/3rdparty/cplusplus/Parser.cpp b/src/libs/3rdparty/cplusplus/Parser.cpp
index b67920266fe..bf798038543 100644
--- a/src/libs/3rdparty/cplusplus/Parser.cpp
+++ b/src/libs/3rdparty/cplusplus/Parser.cpp
@@ -2138,16 +2138,17 @@ bool Parser::parseAccessDeclaration(DeclarationAST *&node)
/*
Q_PROPERTY(type name
- READ getFunction
- [WRITE setFunction]
- [RESET resetFunction]
- [NOTIFY notifySignal]
- [DESIGNABLE bool]
- [SCRIPTABLE bool]
- [STORED bool]
- [USER bool]
- [CONSTANT]
- [FINAL])
+ (READ getFunction [WRITE setFunction]
+ | MEMBER memberName [(READ getFunction | WRITE setFunction)])
+ [RESET resetFunction]
+ [NOTIFY notifySignal]
+ [REVISION int]
+ [DESIGNABLE bool]
+ [SCRIPTABLE bool]
+ [STORED bool]
+ [USER bool]
+ [CONSTANT]
+ [FINAL])
Note that "type" appears to be any valid type. So these are valid:
Q_PROPERTY(const char *zoo READ zoo)
@@ -2155,7 +2156,8 @@ bool Parser::parseAccessDeclaration(DeclarationAST *&node)
Furthermore, the only restriction on the order of the items in between the
parenthesis is that the type is the first parameter and the name comes after
- the type.
+ the type. Especially, there seems to be no restriction on the READ/WRITE/MEMBER
+ order.
*/
bool Parser::parseQtPropertyDeclaration(DeclarationAST *&node)
{
@@ -2201,6 +2203,7 @@ bool Parser::parseQtPropertyDeclaration(DeclarationAST *&node)
switch (peekAtQtContextKeyword()) {
case Token_READ:
case Token_WRITE:
+ case Token_MEMBER:
case Token_RESET:
case Token_NOTIFY:
case Token_REVISION:
diff --git a/src/libs/3rdparty/cplusplus/QtContextKeywords.cpp b/src/libs/3rdparty/cplusplus/QtContextKeywords.cpp
index cc4fdff1f1e..87403aed14f 100644
--- a/src/libs/3rdparty/cplusplus/QtContextKeywords.cpp
+++ b/src/libs/3rdparty/cplusplus/QtContextKeywords.cpp
@@ -63,7 +63,20 @@ static inline int classify5(const char *s) {
}
static inline int classify6(const char *s) {
- if (s[0] == 'N') {
+ if (s[0] == 'M') {
+ if (s[1] == 'E') {
+ if (s[2] == 'M') {
+ if (s[3] == 'B') {
+ if (s[4] == 'E') {
+ if (s[5] == 'R') {
+ return Token_MEMBER;
+ }
+ }
+ }
+ }
+ }
+ }
+ else if (s[0] == 'N') {
if (s[1] == 'O') {
if (s[2] == 'T') {
if (s[3] == 'I') {
diff --git a/src/libs/3rdparty/cplusplus/QtContextKeywords.h b/src/libs/3rdparty/cplusplus/QtContextKeywords.h
index b84ccf6ffce..a7a1f1c3f8d 100644
--- a/src/libs/3rdparty/cplusplus/QtContextKeywords.h
+++ b/src/libs/3rdparty/cplusplus/QtContextKeywords.h
@@ -18,7 +18,8 @@ enum {
Token_CONSTANT,
Token_DESIGNABLE,
Token_SCRIPTABLE,
- Token_REVISION
+ Token_REVISION,
+ Token_MEMBER
};
CPLUSPLUS_EXPORT int classifyQtContextKeyword(const char *s, int n);
diff --git a/src/libs/3rdparty/cplusplus/Symbols.h b/src/libs/3rdparty/cplusplus/Symbols.h
index b6a711b8f87..6551dc7616b 100644
--- a/src/libs/3rdparty/cplusplus/Symbols.h
+++ b/src/libs/3rdparty/cplusplus/Symbols.h
@@ -556,18 +556,19 @@ public:
NoFlags = 0,
ReadFunction = 1 << 0,
WriteFunction = 1 << 1,
- ResetFunction = 1 << 2,
- NotifyFunction = 1 << 3,
- DesignableFlag = 1 << 4,
- DesignableFunction = 1 << 5,
- ScriptableFlag = 1 << 6,
- ScriptableFunction = 1 << 7,
- StoredFlag = 1 << 8,
- StoredFunction = 1 << 9,
- UserFlag = 1 << 10,
- UserFunction = 1 << 11,
- ConstantFlag = 1 << 12,
- FinalFlag = 1 << 13
+ MemberVariable = 1 << 2,
+ ResetFunction = 1 << 3,
+ NotifyFunction = 1 << 4,
+ DesignableFlag = 1 << 5,
+ DesignableFunction = 1 << 6,
+ ScriptableFlag = 1 << 7,
+ ScriptableFunction = 1 << 8,
+ StoredFlag = 1 << 9,
+ StoredFunction = 1 << 10,
+ UserFlag = 1 << 11,
+ UserFunction = 1 << 12,
+ ConstantFlag = 1 << 13,
+ FinalFlag = 1 << 14
};
public: