diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2013-03-01 15:06:33 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-02 12:58:18 +0100 |
commit | 7e5d1c1c2fc764d4cacc3e367542e1f42e6b772e (patch) | |
tree | b2d555f840e30f299c7741574e6e93c4e236fcaa /src/tools/moc/util | |
parent | b0e58a9008a01cd819d942ddc79534e8dd8ef8bd (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/tools/moc/util')
-rw-r--r-- | src/tools/moc/util/generate_keywords.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
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) |