summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2013-03-01 15:06:33 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-02 12:58:18 +0100
commit7e5d1c1c2fc764d4cacc3e367542e1f42e6b772e (patch)
treeb2d555f840e30f299c7741574e6e93c4e236fcaa /src
parentb0e58a9008a01cd819d942ddc79534e8dd8ef8bd (diff)
moc: Support the '$' character as an identifier
Both gcc and clang allow the use of '$' in their identifiers as an extension. moc should not throw a parse error if there is one in the file. Instead, consider '$' as valid in identifiers. Task-number: QTBUG-22720 Change-Id: I8be3a52429c0db5b7e8308b8f4fe475d3d3994bf Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/tools/moc/keywords.cpp2
-rw-r--r--src/tools/moc/ppkeywords.cpp2
-rw-r--r--src/tools/moc/util/generate_keywords.cpp9
-rw-r--r--src/tools/moc/utils.h4
4 files changed, 9 insertions, 8 deletions
diff --git a/src/tools/moc/keywords.cpp b/src/tools/moc/keywords.cpp
index 558e99c1d6..dc03af3378 100644
--- a/src/tools/moc/keywords.cpp
+++ b/src/tools/moc/keywords.cpp
@@ -45,7 +45,7 @@
static const short keyword_trans[][128] = {
{0,0,0,0,0,0,0,0,0,546,543,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 546,252,544,547,0,38,239,545,25,26,236,234,30,235,27,237,
+ 546,252,544,547,8,38,239,545,25,26,236,234,30,235,27,237,
22,22,22,22,22,22,22,22,22,22,34,41,23,39,24,43,
0,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,21,8,8,8,8,8,8,8,8,8,31,549,32,238,8,
diff --git a/src/tools/moc/ppkeywords.cpp b/src/tools/moc/ppkeywords.cpp
index e9d199705d..76387d4b18 100644
--- a/src/tools/moc/ppkeywords.cpp
+++ b/src/tools/moc/ppkeywords.cpp
@@ -45,7 +45,7 @@
static const short pp_keyword_trans[][128] = {
{0,0,0,0,0,0,0,0,0,98,12,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 98,76,96,13,0,60,62,97,9,10,58,56,11,57,102,59,
+ 98,76,96,13,1,60,62,97,9,10,58,56,11,57,102,59,
6,6,6,6,6,6,6,6,6,6,92,0,7,81,8,91,
0,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,0,101,0,61,1,
diff --git a/src/tools/moc/util/generate_keywords.cpp b/src/tools/moc/util/generate_keywords.cpp
index 47ff0f9ac8..7ad553608c 100644
--- a/src/tools/moc/util/generate_keywords.cpp
+++ b/src/tools/moc/util/generate_keywords.cpp
@@ -268,7 +268,7 @@ inline bool is_ident_start(char s)
{
return ((s >= 'a' && s <= 'z')
|| (s >= 'A' && s <= 'Z')
- || s == '_'
+ || s == '_' || s == '$'
);
}
@@ -277,7 +277,7 @@ inline bool is_ident_char(char s)
return ((s >= 'a' && s <= 'z')
|| (s >= 'A' && s <= 'Z')
|| (s >= '0' && s <= '9')
- || s == '_'
+ || s == '_' || s == '$'
);
}
struct State
@@ -360,8 +360,9 @@ void makeTable(const Keyword keywords[])
newState(states, pre?"PP_CHARACTER":"CHARACTER", c);
for (c = 'A'; c <= 'Z'; ++c)
newState(states, pre?"PP_CHARACTER":"CHARACTER", c);
- c = '_';
- newState(states, pre?"PP_CHARACTER":"CHARACTER", c);
+
+ newState(states, pre?"PP_CHARACTER":"CHARACTER", '_');
+ newState(states, pre?"PP_CHARACTER":"CHARACTER", '$');
// add digits
for (c = '0'; c <= '9'; ++c)
diff --git a/src/tools/moc/utils.h b/src/tools/moc/utils.h
index aeb9b745f1..a2c65e4b2a 100644
--- a/src/tools/moc/utils.h
+++ b/src/tools/moc/utils.h
@@ -60,7 +60,7 @@ inline bool is_ident_start(char s)
{
return ((s >= 'a' && s <= 'z')
|| (s >= 'A' && s <= 'Z')
- || s == '_'
+ || s == '_' || s == '$'
);
}
@@ -69,7 +69,7 @@ inline bool is_ident_char(char s)
return ((s >= 'a' && s <= 'z')
|| (s >= 'A' && s <= 'Z')
|| (s >= '0' && s <= '9')
- || s == '_'
+ || s == '_' || s == '$'
);
}